LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting text string to binary

I'm taking a numeric value, converting it to hex and sending it to a serial port.  However, I need to convert the hex into binary so that the device recognizes the commands.   I tried using the Flatten to String function, but still no conversion.
 
My code is attached
 
Thanks in advance,
 
 
Rick
0 Kudos
Message 1 of 5
(3,405 Views)
is this what you're looking for?
0 Kudos
Message 2 of 5
(3,396 Views)

Perhaps I should have elaborated.  The hex commands I am sending have to be converted into the non printable code.  I guess it would be the equivalent to the '/' format.

Thanks for your code, I think I can use that for another utility I'm writing.

 

 

Rick

  

0 Kudos
Message 3 of 5
(3,391 Views)
Are you starting with a hex number or a hex string? It sounds like you're starting with a hex number. In that case, why not just use the Type Cast function:



As for the posted VI, I can't quite figure out why it's doing all that, especially using the Type Cast function in 4.1 mode. You can just do this:




Message Edited by smercurio_fc on 12-08-2006 09:28 AM

Download All
0 Kudos
Message 4 of 5
(3,356 Views)
I personally prefer the Byte Array to String primitive (in the String>>Additional... palette), as it works on all numeric types and is not dependant on an internal representation. It converts an array of ASCII values into a string of ASCII chars.

___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(3,330 Views)