LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

viRead question regarding timeout?

Hello Everyone!
I read in data using my viRead function, and fill up my viReadDataBuffer.  This is set to a specified size.
 
The amount of data filling up this buffer varies depending on the situation.
VISA will timeout if the viReadDataBuffer is not completely full.
I have added a message in the data I am reading that is a TERMCHAR (0x0A) and it comes after the end of the message.
However, I have a problem.  0x0A occurs a couple of times before the important data I need so VISA cuts off my program before it gets to the good stuff.
I think this is wishful thinking, but is there a way to set multiple termchar for a particular session (I could have two 0x0A bytes come one after the other).
Or, is there a way to set the term char after VISA begins reading.  If I could manage to set the termchar AFTER I get the important data I need, that would work as well.
Unfortunately, I haven't been able to get VISA to do that.
Any ideas would be appreciated.

Thanks
neemtt 
0 Kudos
Message 1 of 3
(4,157 Views)
Hi neemt,

Unfortunately there isn't an easy way around this. What you can do is to read the entire contents of the buffer and then parse the data with your specifications (look for the third instance of 0x0A) and use that to extract the data. Would this work for you?

Alternatively, you can also ask to read the buffer with the termchar a few times, then concatenate the string together to get your complete data.

Let us know if you have further questions!
Rasheel
0 Kudos
Message 2 of 3
(4,136 Views)

I have an additional question: When I like to read let's say count=10 Bytes, with a timeout expired and let's say 5 Bytes have been arrived so far, does the viRead returns with these retCount=5 Bytes and the Error, or is retCount=0?

0 Kudos
Message 3 of 3
(3,444 Views)