From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA serial read framing error

Hi! 

I am reading continuous stream of ASCII data. As I need to capture all the data, I start the VISA read VI before applying power to the instrument.

This result in framing error as there is no data on the port and takes few msecs before it becomes available. How do I handle framing error without using initial delay in the read code as I don't know exactly how much delay is there when the data is available.

 

Thank you!!

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 4
(760 Views)

If there is no data in the read buffer, you will get a timeout error.  This is different from the framing error.  The easy solution is to use the Bytes At Port solely to see if there is any data available to read.  If there is, read a full message.  If no data is available, wait.  Do not use the Bytes At Port to tell the VISA Read how many bytes to read.  How exactly the read is done is dependent on the messaging protocol.

 

Framing errors are quite common when powering up an instrument/device.  I just usually just ignore them (Clear Error with the framing error code).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(756 Views)

Thank you, the suggestions helped.

I am ignoring framing error but is I/O error also common to receive when the instrument is powered ON?

 

I/O error are received initially when I power on the instrument as I start the read function before that.

Also at certain point no data is streamed from the instrument and often receive I/O error.

Tried to flush the COM port after initializing but did not help.

*************************************************
CLD
*************************************************
0 Kudos
Message 3 of 4
(700 Views)

The error screenshot is attached.

*************************************************
CLD
*************************************************
0 Kudos
Message 4 of 4
(692 Views)