Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

send Hex code via serial

I want to send the code 0x01 (Hex) on RS232 and read back 2048*2 Bytes..
Anybody has an idea for make the program to send Hex code.

Thank you very much for anybody help.
0 Kudos
Message 1 of 4
(3,170 Views)
Assuming you're using LabVIEW, you can create an array of data you wish to send (U8), convert it to a string, and then use the VISA write vi. For reads, use the VISA read vi and request the number of bytes you wish to read.
Message 2 of 4
(3,170 Views)
Thanks a lot... That is perfect solution.

I still have one question. The data that I read is the array [2048] of unsigned short int (that means I will read 2048*2 bytes). Do you have an idea to read data in every 2 bytes ?

Thank for your help.
0 Kudos
Message 3 of 4
(3,170 Views)
The serial port doesn't know about U16 or U32, just bytes. So your application will need to convert the bytes to U16. There is an easy way to do this in LabVIEW using the Join Numbers vi. It takes two bytes and spits out a U16 (or two U16's and spits out a U32). Very handy.
0 Kudos
Message 4 of 4
(3,170 Views)