From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to map 8 Booleans into 1 byte for TCP/IP?

I'm building a cRIO <-> TPC-2006 communication scheme.  I'd like to map 8 Booleans into a single byte for TCP-IP comm between the devices.  I've searched through the available vis and haven't found a clean way to do it.  My backup idea is multiply each of them invidually by appropriate powers of 2 and then add to create a numeric byte that I would convert to a string for TCP-IP.  Is there a better way?
Jeff
Climbing the Labview learning curve!
Sanarus Medical
Pleasanton, CA
0 Kudos
Message 1 of 3
(2,321 Views)
Hello Jeff.
I would use the "Boolean Array To Number" function from the Boolean palette.
Is there a good reason not to do so?
Best regards, Guenter
0 Kudos
Message 2 of 3
(2,318 Views)

Other than using the previous suggestion (followed by Byte Array to String, or course), you should consider whether you want to complicate your code and spend processor power on doing this just to save bandwidth.

LV allows you to do communication protocols extremely easily by providing VIs (in the advanced palette) for flattening and unflattening any data to and from a string. If you search the example finder for "TCP" you should find some examples of this. Also, if you search the site for "messaging protocol" you should find a good tutorial about this.


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