06-20-2022 08:15 PM
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!!
06-20-2022 08:32 PM
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).
06-29-2022 06:14 PM
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.
06-29-2022 08:13 PM
The error screenshot is attached.