LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

See what VISA Read has so far

Solved!
Go to solution

Is there a way to peak at what's already read off the wire?

let's say I define 1000 bytes to read

return value is variable and can be either \r terminated or no termination (just a single ^).

In the latter case, it will wait the full time out period before it proceeds.  

 

So my question is if there is a way to peak at what's already read so far, while it's still within the time out period.

VISA read is one atomic command, so not sure how to access what's already read.

 

0 Kudos
Message 1 of 4
(214 Views)
Solution
Accepted by topic author shuttlefan

Hi fan,

 


@shuttlefan wrote:

So my question is if there is a way to peak at what's already read so far, while it's still within the time out period.

VISA read is one atomic command, so not sure how to access what's already read.


Lower the timeout period and read the buffer.

What is the longest time you need to wait for a message with a TermChar (\r)? Set that time plus some safety margin…

 

(Or read byte by byte until you received your message.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(188 Views)

I've also been known to use the ^ or similar as the termination character in certain situations and use Trim Whitespace to clear out any potential end of line characters before analyzing the read data.


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 4
(174 Views)

@GerdW wrote:
What is the longest time you need to wait for a message with a TermChar (\r)? Set that time plus some safety margin…

I don't have a good feel for how long the device will take to respond if it's doing something else at same time so not sure how low to lower it.

 

 

(Or read byte by byte until you received your message.)

 

I think this might be the safest way to do it.  For the commands that don't return a termination char, read it one by one to not rely on timeout.  Didn't know if there was a way to peak so it's sounding like there isn't.

 

 


 

0 Kudos
Message 4 of 4
(167 Views)