LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa is reading the same characters that LV sent insted of the characters sent to LV from my device

Hello,

I am communucating with my device via VISA. First, a visa read reads 2 bytes from the device which are a "! " (the ready to send signal). next, a visa write sends 5 bytes "0235A", loops around and waits for another "! " and then sends another 5 bytes string. What is happening is the first loop works fine, when it gets to the start of the second loop, there are 7 bytes in the buffer "0235A! " so insted of seeing a "! " to send the next 5 bytes, visa sees "02" and breaks out of the loop. The orignal 5 bytes I seed seem to be echoing from the write buffer into the read buffer. Why is this happening and how can I fix it? Visa is running RS232, LV 7.1. Thanks i
n advance!

Greg
Gregory Osenbach
0 Kudos
Message 1 of 9
(3,031 Views)
It sounds like the device might be set to echo back what has been sent to it. Some devices do this so that communication can be be verified. If there is a setting on the device to turn this off, you should try that. Otherwise, you can do two VISA Reads in which the first one is set to read the same number of bytes that you wrote or do a single VISA Read with a higher byte count and parse out just the last two.
Message 2 of 9
(3,031 Views)
The device is not sending back an echo. This can be confirmed with a simple terminal. I will try your other suggestion though. Thank you.
Gregory Osenbach
0 Kudos
Message 3 of 9
(3,031 Views)
I think that the RS232 interface of your device is probably powered by the RTS/DTR lines of the computer. LabVIEW doesn't initialize the state of these lines the same way hyperterminal does. I've noticed that echo effect when the device interface is not properly powered.

Try to swap the state of these lines using the VISA property nodes Modem Line Settings>RTS State and DTR State.


LabVIEW, C'est LabVIEW

Message 4 of 9
(3,031 Views)
The RS232 is 3 wire. Tx Rx and Ground. We are not using the RTS/DTR lines.
Gregory Osenbach
0 Kudos
Message 5 of 9
(3,031 Views)
Any chance you have the Tx and Rx backwards or crossed (some devices use a standard style connection, and some use a null modem style connection, so this is easy to do, you might try flipping them just to see what happens).

Regards,
Ryan K.
0 Kudos
Message 6 of 9
(3,031 Views)
The other possiblility is that the device is sending back the characters because of an error. Do you need to add a termination character like CR or LF? Hyperterminal does this for you.
Message 7 of 9
(3,031 Views)
I took the first suggestion and wrote some code that checks for the bytes at port and if there are more than two, it strips out all but the last two bytes. The next part of the vi reads the ready to send bytes correctly.

This does not exactly solve the problem as I have not yet figured out what is causing the echo but it will allow me to finish my vi. Thanks for the help.
Gregory Osenbach
0 Kudos
Message 8 of 9
(3,031 Views)
I discovered that my device was echoing characters ONLY on that one particular function. (FYI for anyone who may be interested).

Thanks for the suggestions.
Gregory Osenbach
0 Kudos
Message 9 of 9
(3,031 Views)