02-16-2021 11:36 AM
I need to read an instrument data connected via a serial port (RS-232) with the following characteristics:
The instument sends out every ~0.033 seconds a text string containing 4 numbers: two intergers, followed by two floats. The first two integers are diagnostic data and can be discarded. I am interested only in the subsequent 2 floats, which are the actual instrument reading.
As I am new to labVIEW I started from the example "Continuous serial and write.vi", trying to adapt it to my needs. I erased the writing block, as I am only interested in reading the data.
I then added a series of operations to save the reading of the instrument, together with the current time, in a text file as tab delimited data.
As not need to sample the data every 0.1 s, I slow down the loop with the "wait until next ms mutiple" function.
Here I get a strange behaviour: if I set the time to wait to small numbers (10, 20, 30 ms) everything seems to work pretty fine. Instead if I set larger numbers (50 up to the desired value of 100 ms), after a few seconds I get the Error -1073807252 with the possible reason:
VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.
I do not understand this error, as the data flow is pretty limited and the computational speed should not be a problem.
Attached you can see my code and the error message.
Thanks for the help!
Solved! Go to Solution.
02-16-2021 11:57 AM
What LabVIEW version are you using? Do you have a sample of the serial output? You can collect it with TeraTerm (it's free). Is the output comma delimited with a carriage return for the next line? You may have over complicated your VI. It may be a good idea to separate serial data read from the parsing and data recording function. The producer consumer structure. Let me know what version labview you're using so I can send you a sample code.
02-16-2021 12:48 PM
@davidedalbosco wrote:
I need to read an instrument data connected via a serial port (RS-232) with the following characteristics:
- 8 data bits
- No parity bits
- 1 stop bits
- 19200 baud
- No hardwarehandshake
- No XON/XOFF handshake
The instument sends out every ~0.033 seconds a text string containing 4 numbers: two intergers, followed by two floats. The first two integers are diagnostic data and can be discarded. I am interested only in the subsequent 2 floats, which are the actual instrument reading.
As I am new to labVIEW I started from the example "Continuous serial and write.vi", trying to adapt it to my needs. I erased the writing block, as I am only interested in reading the data.
I then added a series of operations to save the reading of the instrument, together with the current time, in a text file as tab delimited data.
As not need to sample the data every 0.1 s, I slow down the loop with the "wait until next ms mutiple" function.
Here I get a strange behaviour: if I set the time to wait to small numbers (10, 20, 30 ms) everything seems to work pretty fine. Instead if I set larger numbers (50 up to the desired value of 100 ms), after a few seconds I get the Error -1073807252 with the possible reason:
VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.
I do not understand this error, as the data flow is pretty limited and the computational speed should not be a problem.
Attached you can see my code and the error message.
Thanks for the help!
Think about what you just said:
The device sends a message every 0.033 seconds, or 33 ms - yet you are slowing the loop down to read every 100 ms. So the data piles up in the buffer and eventually it overflows.
The represents an incomplete understanding of basic communications (not LabVIEW). For something like this, you read as fast as you can and work on just the data you want and throw out the rest. Notice that "10, 20, 30 ms" are all less than 33 ms, so you're reading the messages as they arrive - if only barely so.
02-16-2021 01:40 PM
Shameless plug: VIWeek 2020/Proper way to communicate over serial
02-17-2021 05:41 AM
I am using LabView 2020. I would like to use labview because the data acquisition software in our laboratory is built in labview.
A line of the of the output of my instrument is something like
3 003 -58.7391 0.5033
The terminination character of the line is hex D (ascii) which corresponds to the carriage return.
02-17-2021 06:04 AM - edited 02-17-2021 06:04 AM
Then I would just do something like this.