Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I output a hexadecimal string to equipment using the Visa Write function

If I input a hexadecimal string to a Visa Write function, it gets converted to ASCII before it is output to the device. I need to send a hexadecimal string to a piece of equipment. The online help suggests using the type cast function, but this function requires two separate inputs, and I only have one
0 Kudos
Message 1 of 3
(3,758 Views)
Hi Ackight -

I got this information off of our external website. I think this is what you refer to in the passage above. Typecast works as follows - The 2 inputs are the 1.) input data (on the left) 2.) the resulting data type to cast it as (on the top)

It then outputs the string to write to your instrument on the right. The following passage says the same thing in a different way, it is the previously mentioned passage ->

The questions is : how do I send a hexadecimal 1Ch or 0Ah or 03h to my instrument from labview ?
Well, basically you have to typecast a numeric into a string using a string constant as a type caster input. It is important to notice that the data type of the numeric should be an 8 bit format to generate a 2 digit hexadecimal, if you wi
re a 32 bit you'll get a lot of zeros and the value, so use an Unsigned 8 bit : U8. So you create a numeric control or constant you use Decimal or Hexadecimal format whatever, then you typecast it as a string and send it using serial write.

Check out the attached vi for a graphical explanation.
hope this helps -

ben schulte
national instruments
Message 2 of 3
(3,758 Views)
Thanks so much! That helped me immensely!
0 Kudos
Message 3 of 3
(3,758 Views)