Posted Tue, 18 Jul 2023 19:39:26 GMT by Tarasenko, Sergey
I have DAQ6510 with KTTI-RS232 Card and would like to send and receive "string" data using RS232 port connected to another device. I successfully use TSP commands to control DAQ6510. However, I could not find any TSP commands for RS232 port in the DAQ6510 User Manual nor in the KTTI-RS232 Card manual. Please help me to use all functionality of DAQ6510, including RS232 TSP commands. Thank you.
Posted Fri, 21 Jul 2023 11:01:07 GMT by C, Andrea
Our 2600B series have feature in the TSP runtime engine to utilize the RS-232 port for communication with external device from the instrument scripting.

But same serial API is not defined for the KTTT-RS232 add on card for DAQ6510.
It does have TSP-NET to utilize the LAN port for external device communication.


 
Posted Fri, 21 Jul 2023 14:36:09 GMT by Tarasenko, Sergey
Thank you for your response, Andrea. Unfortunately, it is not easy to use LAN port for this application. Our device has only RS-232 and USB communication interfaces. So, I have couple more questions:
1. Can I utilize DAQ6510 USB port for this communication with TSP commands?
2. How to make TSP-NET communication to convert it to serial or USB interfaces? Do I need to buy additional adapters for TSP-NET and then for Ethernet to RS-232 or USB? Or can I use DAQ6510 Ethernet port with additional converter to RS-232 or USB? Please advise.
Thank you. Sergey

 
Posted Sat, 29 Jul 2023 19:10:22 GMT by C, Andrea
The TSP Runtime for the scripts does not have access to the USB-TMC for communication with external devices.

Only supported way is to use TSP-NET commands and the LAN port.
I've personally used this for communication with AFG or scope from the TSP script.
Just treat it like a raw socket based connection at an IP address and port number.

I have not personally used them, but there are LAN to RS-232 adapters from a google search.
I do not see any reason that TSP-NET would have issues to connect to the LAN side of one of those and allow it to echo the commands on the RS-232.
 
Posted Mon, 14 Aug 2023 21:27:56 GMT by Tarasenko, Sergey
Thank you for your recommendations, Andrea. I bought Brainboxes ES-257 Ethernet to RS-232 dual ports converter, and it works well. I successfully tried both Telnet and TCP_Raw protocols to convert Ethernet to RS-232.
During Telnet communication, I used tspnet.connect("192.168.127.254", 23, "") command.
During TCP_Raw communication, I used tspnet.connect("192.168.127.254", 9001, "") command.
However, during sending of 26 bytes hex string, I met two problems.
1. I could not send entire string, but only 5 bytes fragmentTo solve the problem, I just split the string by several pieces using several tspnet.write commands. Is there another way to do that? Does tspnet.write command limitation for string size?
2. To create hex formatted string, I converted each byte of dat using "\xNN" operator. However, the final RS-232 string was missing "Zero" value data. I tried both "\x00" and "\0" operators. Looks like, "Zero" was interpreted as NULL value and was ignored by "write" command. I spent some time to solve this problem, but not successfully. I believe that Lua has ability to send all kind string data values including "Zero". Please help.
Thank you. Sergey
Posted Sat, 26 Aug 2023 15:00:21 GMT by C, Andrea
Hi Sergey,

The tspnet.write is not limited to just a few characters.  Not sure what the upper limit is, but is not 5.
Here is some sample code where the feature is used to interact with a Watlow temperature controller and many of the commands used there with tspnet.write are longer than 5 characters.

https://github.com/tektronix/keithley/tree/main/Instrument_Examples/DAQ6510/Use_the_DAQ6510_to_Control_a_Temperature_Chamber

Sometimes we have to deal with string is really a null terminated array of characters.
Google up ASCII (decimal) code for certain character.  the Zero is 48.  Null is 0.
Line feed is 10;  Carriage Return is 13.


 
Posted Tue, 05 Sep 2023 23:04:15 GMT by Tarasenko, Sergey
Hi Andrea,
Thank you for the sample code. Yes, it controls an external device such Temperature Chamber using “tspnet” commands and local network. In my project I also try to control an external device using “tspnet” commands and local network. However, difference is that I need to send entire binary package not ASCII symbols data. I represented the binary data package as 26 bytes hex format data and converted each hex byte to ASCII format using “\xdd” operator. I was able to send and receive all hex bytes except “\x00” combination (binary code 00000000). Such bytes were simple missing. Probably, this combination was ignored by TSP compiler. This is my problem. I cannot control the external device with corrupted binary package.  
I hope, there is another way to solve this problem to send actual “Zero” binary hex value not ASCII Zero character. Please help.
With best regards. Sergey

 

You must be signed in to post in this forum.