LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting proper output from VISA read of constant size with no stop character

Solved!
Go to solution
Highlighted

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.

0 Kudos
Message 1 of 6
(224 Views)
Highlighted

I guess something is wrong with the code you have written.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(217 Views)
Highlighted

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.

0 Kudos
Message 3 of 6
(209 Views)
Highlighted

I'm not going to speculate.  It won't do either of us any good.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 6
(205 Views)
Highlighted
Solution
Accepted by topic author MilesT

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.

Message 5 of 6
(170 Views)
Highlighted

That was it! Thanks so much.

0 Kudos
Message 6 of 6
(162 Views)