09-06-2017 08:05 AM
Hello,
I would like to send commands to a device via a serial connection and then read the reply until the instrument sends OK.
The instrument needs two termination characters for commands and sends two for reads: \r\n.
Example:
Command: "&G7&S&\r\n"
Reply:
"Received &G7&S&\r\n
\r\n
OK\r\n"
I want to finish the program when I get back the OK.
Sending the command works with my program but reading the reply does not. Labview shows the error:
-1073807252, VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.
Thank you for your help!
Solved! Go to Solution.
09-06-2017 08:53 AM - edited 09-06-2017 08:55 AM
You have a data overrun happening, meaning you are not getting the data fast enough. Since you have a clear protocol for the instrument, let's use it.
1. Enable the termination character and set it to be the Line Feed (0xA, \n). Both of these settings are the default for the Configure Serial Port, so let's just delete those controls.
2. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (Did I emphasize that enough?). Since you are using the termination character, just tell the VISA Read to read more bytes than you ever expect in a message. The VISA Read will stop when it reads the termination character (since you now have it enabled).
3. Get rid of the wait in the loop. The VISA Read will determine your loop rate. Don't slow it down. This is the main reason you are getting the buffer overrun.
09-07-2017 02:41 AM
Thank you for your help. The VI works!