LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Comm across Packets

I am reading a 284 byte serial packet using Visas, and String commands. The problem is that I read "across packets" instead of the one packet at a time. Using the visas I read in 284 bytes and then search for my sync word. Seems like I should be able to look at the port and wait for the sync word and then grab the entire packet at once. Any ideas?
0 Kudos
Message 1 of 2
(2,556 Views)
Hi,

In serial you can specified a termination character that would allow you to break up a read operation. In serial talk, each message would be terminated by a termination character. By specifying a Termination character using the VISA Configure Serial VI, the Read operation would end after receiving a termination character, no matter if other data bytes are received.

Unfortunately, you cannot specify a word, but you could implement it. Make a VI that acts as a serial read, but it internally reads everything from the serial buffer (if there is anything), stores in it's own buffer (a shift register) and returns to the user the packet based on the termination word. You would basically move your parsing code to a lower level VI. If you make this subVI have t
he same connector pane as the VISA read, you could replace it directly in your main VI.

Hope this helps.

DiegoF
National instruments.
0 Kudos
Message 2 of 2
(2,556 Views)