Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VT100 communication in Labview?

I would like to use Labview to communicate with a device that normally uses a VT100 terminal or emulator. The RS232 that connects the device to my computer is a null modem cable (baudrate 9600, even parity, 1 start and stop bit, no handshaking, 8 databits). The device needs a command (lets say two characters, a comma, and a value) that is finished by a carriage return. As a response, the device will send an answer followed by a carriage return. Communication between the device and a VT100 emulator works fine, but when I am using Labview, the device gives back an error message. It says that a communication error occurs. Does anyone know how to solve this problem?
0 Kudos
Message 1 of 13
(8,487 Views)
How did you send the carriage return? I would have suggested writing something like ab,123\r or use the VISA attribute "Serial End Mode for Writes" to the termination character, the termination character would need to be set to 13 decimal, and the termination enable attribute would need to be set to true. The second method is used to programmatically add the carriage return to writes.

I hope this helps out.

JoshuaP
National Instruments
0 Kudos
Message 2 of 13
(8,487 Views)
Tanks for your fast response!
I´ve tried all the options you mention here before, but the carriage return doesn´t seem to be the problem. Today I managed to get a valid response from my machine only once after sending a command from Labview. This is what happened:

the command gp,5a,0 followed by a carriage return asks my device to get the parameter (gp) for process 5a and variable 0. It should return the answer GP 190 plus a carriage return. When sending the command from Labview, I recieved an error message from the device telling me there is a communication error. But after sending it several times, it suddenly gave the rigth response once. Sending it again, gave again error messages.

The error message also varies. The error *E5 given by my device te
lls me there is a communication error (E5) after the command *, where * is in my case one of the characters (gp,5a,0 + carriage return) that I have send.

I hope these observations give you a clue?
I´m also not sure wheather to use the serial read and write VI´s or the VISA read and write VI´s

regards,
Ellen
0 Kudos
Message 3 of 13
(8,487 Views)
I would definitely suggest using the VISA commands. In addition, try running NI-SPY in the back ground. It will show you exactly what commands and strings are being sent to the device. I would suggest turning the termination off when you configure the serial port. Then, use a VISA Write and send gp,5a,0\r. You have to make sure your control on your front panels is set to '\' Codes Display. You can change this by right clicking on the control. If you don't your serial port will actually send gp,5a,0\\r.

JoshuaP
0 Kudos
Message 4 of 13
(8,487 Views)
again thanks for the suggestions, but unfortunately this is not the solution. I suspect that the problem must be found somewhere in the area of timing. I am planning to measure the exact signal coming out of the rs232 cable. It should sent data packages consisting of 1 start bit, 8 data bits, 2 parity bits and a stop bit. I don´t expect any problems with the data packages themselves (my device looks like it understands separate characters). The problem could be in the timing between the data packages. Somewhere in the manual of my device, it is said that there should not be more than 10ms between the different characters for the device to understand the full commands (consisting of several characters). Do you know what influences this speed
, and can it be changed if necessary?

Thanks for your help,
Ellen
0 Kudos
Message 5 of 13
(8,487 Views)
I have made a few changes to the serial communication vi so it should run as is for your device. Just make sure the correct serial port is selected. Then just run the program.

-JoshuaP
0 Kudos
Message 6 of 13
(8,486 Views)
I am sorry to dissapoint you again, but this also doesn´t work. I have been running programs like this one (and many many variants), but I keep getting the same kind of error: i.e. one of the command characters followed by E5\r (which stands for a communication error; the \r is send after all replies from the device). Working with a timeout instead of a termination character only results in several error messages (instead of only one).
I am starting to feel that it isn´t as much a problem with the Labview programs, but more with the data flow (timing etc.).
0 Kudos
Message 7 of 13
(8,486 Views)
If these commands work with hyperterminal than it is possible that you are correct. LabVIEW sends these characters hundreds of times faster than hyperterminal and it is possible the device can not respond or recieve the commands that quickly. I modified the last example that I sent you to send on character every second. This should more accuratly represent how hyperterminal works.

-Josh
0 Kudos
Message 8 of 13
(8,486 Views)
Good news: this solved the problem. Thanks to the signal measurements and your "slow"-serial.vi I am finally able to communicate with my device (which is a welding power source, in case you got curious). I already started to think I was doing a PhD in serial data communications, but luckily I can get back to my real subject now...:) The good thing that came out of this is that our research group here now has an RS232 expert.
Thanks for all the help.
0 Kudos
Message 9 of 13
(8,486 Views)

Hi,

I found old threads (2004) about this but when I tried to open the modified Serial Communication.vi (in LV8.6), it couldn't find one of the subVIs.  I am trying to replace Hyperterminal (VT100 dumb terminal) with a screen that 'looks' like Hyperterminal but is actually a LabVIEW VI running.  Does anyone know of code written for such an application? 

thanks, Leo

0 Kudos
Message 10 of 13
(7,142 Views)