ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bit array binary string (from TCP Read) to LV boolean array (and back)

Solved!
Go to solution

@Blokk wrote:
Thanks altenbach! The only difference here is that, if the binary string has more data after the starting 16 bits. 

Yes, I mentioned the "4.x typecast mode" more as a curiosity that most younger programmers don't know about. 🙂

 

We really need to know much more about the actual application to decide on the best solution. I went with the assumption (as described in the original problem description) that we have exactly 16 bits total.

0 Kudos
Message 11 of 12
(1,313 Views)

A few posts before I mentioned some info about this special PLC data block which i need to convert into several LV data types. Just as a second thought, I think I could use the "4.x TypeCast" method, If first I split up my binary string. In a normal string one character takes 1 byte, 8 bits. Keeping this in mind, for example I could split out 2 characters from the string at the appropriate position, and typecast this 16 bits into Boolean Array. This should also work, yes?

 

Edit: of course, I would use the "4.x" version for the Bool array, and the "normal" TypeCast for other data types...

0 Kudos
Message 12 of 12
(1,309 Views)