07-13-2020 02:49 PM
Hello,
I am implementing VISA communication for an instrument that functions differently from my all of my other instruments. Every second the instruments emits a data packet of 24 bytes of binary data with no stop character. The problem is that in the first read it always reads 6 bytes instead of 24. Then, in every consecutive read, the 24 bytes are offset by 6 bytes. This is without calling VISA clear after every read. If I do that, I get 6 bytes every time. I assume that I will need to clear it after every read or else it will be reading old information and will eventually overflow.
Here is the manual of the instrument. It talks about serial communication on page 26.
Thanks for the help.
Solved! Go to Solution.
07-13-2020 02:59 PM
I guess something is wrong with the code you have written.
07-13-2020 03:06 PM
My code is just configure serial port -> visa open -> visa read.
I get the same result by clearing and reading bytes manually in NI MAX.
07-13-2020 03:10 PM
I'm not going to speculate. It won't do either of us any good.
07-13-2020 04:14 PM
Did you disable the termination character in your Serial configure?
Since your data appears to be binary, the default termination character of line feed which is enabled by default, could very well be showing up in your data stream at byte 6. The next 24 characters read will give you bytes 7-24 and bytes 1-6 of the following packet.
07-13-2020 04:23 PM
That was it! Thanks so much.