LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Word Sepration

Hello

I want to Recive an 600*1 array from Serial Port then consider each two byte as one number(Word).

How Should I do this?

0 Kudos
Message 1 of 4
(2,419 Views)

It depends on how the data is sent.  Is it binary or text? Is the low order byte sent first or last? How do you know when the the array starts and ends?

 

None of these things is standardized in any way when transmitted over a serial port.  You have to know how the data is formatted, or you may have a difficult time trying to reverse engineer the data.

 

Lynn

0 Kudos
Message 2 of 4
(2,413 Views)

To add to Lynn's reply, assuming the data is binary, you can read 1200 bytes, then use String to Byte Array to get a 1200 element U8 array, use Decimate 1D array to separate it into two 1D arrays (even and odd) and then iterate over them in a for loop and use Join Numbers to get a U16 (the last step might work without a loop, but I can't check).


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(2,406 Views)

@tst wrote:

the last step might work without a loop, but I can't check.


I checked it for you:  And it works.  LabVIEW Help says the same.

0 Kudos
Message 4 of 4
(2,397 Views)