10-12-2018 03:37 PM
I wrote a program that takes in temperature values from a hotplate, and displays real-time on a time vs. Temperature plot. It communicates through serial via VISA. The byte count for VISA read was initially set as 3 and it ran without errors when the temperature was only two digits. However, it displayed wrong numbers when the temperature was three digits (above 100C). Likewise, starting from byte count of 4, I was able to read three digit numbers, but when it was below 100, encountered a timeout error. How can I solve this problem?
10-12-2018 03:46 PM
Ideally there should be a termination character to signal the end of the message, usually a return constant "\r". If the interface doesn't define that, you could use the "bytes at port" property node to see how many bytes to read.
10-13-2018 02:57 PM
There have been dozens of discussions over the past 6 months raising questions/problems about reading data from a VISA instrument that sends data as strings of text. In almost every case, the Original Poster (OP), generally a beginner with LabVIEW, was using Bytes at Port, and encountering problems.
Most (but not all!) devices that send text data via VISA terminate their text strings with a Termination Character of some kind. The most common is "End of Line", which is most commonly either <Carriage Return><Line Feed> or just <Line Feed> (<CR> is 0xD, <LF> is 0xA).
If you look at the Help for VISA Configure Serial Port, you'll notice that two of the top terminals have default values (meaning that they are set to these if you do not wire them) of "Enable Termination Character" and Termination Character = LF. So if your "sending Device" sends lines to text terminated by <LF> (which includes lines terminated by <CR><LF>), then the proper, error-free way to handle VISA Reads is the following:
Bob Schor