Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA serial buffer not containing all received data

Solved!
Go to solution

Hi

 

I'm receiving the contest of the LGRTest.txt file transmitttet to my com3 port (9600n81) every second.

Using "VISA Wait on Event Function" I was supossed to read the contens after detecting a end character of 0xA.

But I'm only randomly receiving parts of the 486bytes transmittet.

 

In earlier versions of my code, it did receive the lot. But I found out that it was old data stored in the buffer.

Then I added "VISA Flush Function" before waiting for the end char and then I got the first problem I descriped.

 

Regards

 

Morten Skov

 

Download All
0 Kudos
Message 1 of 4
(4,230 Views)
Solution
Accepted by topic author msskov

The Wait For VISA Event is waiting for ANY character to be recieved.  So if you check the number of bytes in the port when half of the message has been sent, you will only read half of the message.

 

If you are truely using the termination character, don't bother with the VISA Events.  Just do a VISA Read with the number of bytes to read set to something rediculously high.  The read will complete when it finds the termination character.


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 2 of 4
(4,220 Views)

Hi 

 

I'll try what you suggested. I'm just wondering why NI did make a function to wait for an end character that dosn't do that ?

 

Regards

Morten

0 Kudos
Message 3 of 4
(4,203 Views)

Now it works 🙂

Thanks

0 Kudos
Message 4 of 4
(4,196 Views)