Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Emulate Hyperterminal using LabView VISA

Is it reasonable to loop a VISA read in order to get all the data from a devices buffer or have I configured something wrong? The situation is that if I use Hyperterminal to talk to the device I get all of the data from the buffer. I am trying to use LabView to do the same thing but I only get the first line of data. I do know what to expect at the end of the buffer. Example in Hyper shows.
/SQ RX
Squelch RX mode: Noise
              RX Level: 2
OK
 
If I send the same command and append a carriage return to the string in LabView I only see
/SQ RX
 
If I just repeat VISA read I can get the rest of the lines one at a time. I know to expect "OK" so it would not be tough to loop the VISA read until I see it. I am also using bytes at port wired into the VISA Read vi. An indicator of bytes at port reads 50 yet the VISA read return count reads 8? Have I missed something in the setup or do I need to loop dependent on either the bytes count or "OK"?
 
Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 1 of 3
(3,812 Views)
I think the VISA Read is doing exactly what you programmed it to do. On the VISA Configure Serial Port, there is an input called 'Enable Termination Character'. The help for that and the 'termination char', explains that if true, the VISA Read will terminate as soon as the termination character (default of LF) is detected. It does not matter how many bytes are available or how many bytes you specify to read. In order to get multi-line responses, you will have to set termination character to false, or leave it true and have a VISA Read in a loop and terminate the loop when the number of available bytes is zero. Actually, even with the termination character disabled, it would be a good idea to have the VISA Read in a loop. Unless you do some arbitrary wait after your write, it's possible that the device could still be sending data when the VISA Bytes at Serial Port is executed. If that happens, you won't get all of the data.
Message 2 of 3
(3,809 Views)
Dennis,
 Thanks for clearing that up for me. Looks like I'm on the right track. I'm still getting used to RS232 as I normally use GPIB. Looks like a loop it is then. Didn't think you'd be answering during NI week. Figured they'd pay your way there.Smiley Wink
Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 3 of 3
(3,802 Views)