Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

concat 4 8-bit bytes into 1 32-bit word

I am just getting started up with LabView. I have an FPGA that is sending a signed (2's Comp) 32 bit vector to the PC serial port in four 8-bit chunks. I am having trouble figuring out how to recombine the four bytes into the original 32-bit word. It is a simple task in any programming language using concatenation but I am really having problems with this.

Thanks
Jeremy
0 Kudos
Message 1 of 3
(3,706 Views)
Two ways come to mind immediately.

1) Go from a string (VISA returns a string from a read) to a byte array then loop and shift each byte the correct amount while OR'ing the result with that from each loop iteration.

2) Use the join numbers vi to combine multiple bytes into a single 32-bit word.

I've attached a vi that demonstrates these two solutions.
0 Kudos
Message 2 of 3
(3,706 Views)
Thanks very much, I just figured out how to do it using a really stupid convoluted method. You soulutions are great! "Join Bytes" who would have though.

Ha Ha

Thanks again
0 Kudos
Message 3 of 3
(3,706 Views)