11-06-2013 09:09 AM - edited 11-06-2013 09:20 AM
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
Solved! Go to Solution.
11-06-2013 11:31 AM
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.
11-07-2013 01:22 AM
Hi crossrulz
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
11-07-2013 03:34 AM
Now it works 🙂
Thanks