LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Struct TCP/IP

if i have a c struct defined like

typedef struct
{
uint8 test1 :1
uint8 test2 :1
uint8 test3 :6
}

How do i represent the 1 bit and 6 bit in labview to eventually send it tcp/ip?
0 Kudos
Message 1 of 4
(2,992 Views)
That can be done with a character string of 8 bytes.

Take an array of 8 U8's and convert it to a string. That will wire directly to LV's TCP/IP functions.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,992 Views)
If i take an array of 8 U8's and convert it to a string it sends 8 bytes over the network i want to send the struct below for a total of 1 byte being sent over the network. Is this possible?

struct
{
uint8 test1:1
uint8 test2:1
uint8 test3:1
uint8 test4:1
uint8 spare:4
}
0 Kudos
Message 3 of 4
(2,992 Views)
LV doesn't support bitfields directly. You can either use an array
of Booleans and convert that to an integer, or you can direcely define
some constants and use the Boolean nodes to construct the I8 that you
want to send.

Anyway, send the struct of a byte and a byte are the same as far as
the compilers are concerned.

Greg McKaskle
0 Kudos
Message 4 of 4
(2,992 Views)