Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port write in 8 bit hex values

Maybe it is a dumb question.
 
I am trying to use serial port to control a device which requires three words of 8-bit command. when i use regular serial port write vi, it seems it always send the command in a regular format, so the device does not take the commance. Tried with other manual tool to send the command in hex format, the device works perfectly fine.
 
Please advise how to set up in Labview environment. Thanks for any insight tips.
 
PGL
0 Kudos
Message 1 of 2
(3,215 Views)
Hi

This question comes up every time. You can put any 8bit value into an unsigned 8 bit control(U8)
The only problem you have is the correct value.

You can change the display of an U8 control by right clcik and select what you want.
decimal, hex, binary or password etc.
In your case you want to display and type hex.
This display does NOT change the binary value... Its is only another way of viewing the value.
So hex and decimal are two systems that look at values with different eyes but only the representation is changing
not the internal bitpattern.

Transforming a U8 into a string that you can send with the serial vi's is easy but looks complicated.
first building an array of bytes from the U8
then convert this array of bytes to a string

this is all compiler stuff and not much runtime action.
I attach a vi that is the labview implementation of the old pascal CHAR() function



greetings from the Netherlands
0 Kudos
Message 2 of 2
(3,202 Views)