Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA timeout while successfully reading data

Hi, I'm trying to communicate with a serial instrument using NI MAX or LabVIEW. Luckily I've got the instrument manual and know working commands and expected responses. Writing commands proceeds without error. However, when I read them I get a VISA timeout error for 2000 ms, or even up to 10000 ms even though I can still get data in the buffer of MAX. With LabVIEW, the VISARead VI just gives up at the timeout error. I have tried reducing the number of bytes to be read to the expected amount, but this didn't stop the timeout.

 

This is not a situation I have encountered before. How can I resolve the timeout error?

 

Example below of a successful write/read sequence from MAX. The read result is a "status good, no errors" message from the instrument.

14: Write Operation ($STA3504\r)

Return Count: 9 bytes

15: Read Operation
Return Count: 15 bytes
$STA,0301,2ED1\r

 

0 Kudos
Message 1 of 3
(244 Views)

Set the termination character to \r properly when setting up your VISA operation.

 

Highly recommend watching this - https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 3
(212 Views)

By default, VISA sets the termination character to a Line Feed (\n) as most instruments out there end a message with a Carriage Return and a Line Feed or just a Line Feed. It appears your instrument only uses a Carriage Return (\r). So set your termination character to be the Carriage Return (\r, 0xD, 0d13).


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
0 Kudos
Message 3 of 3
(187 Views)