LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting an ascii string into a binary string

Solved!
Go to solution

Hi,

 

I'm pretty new at LABVIEW but right now I am connecting to a device using a RS232 serial cable.  Anyway I am using VISA read to get the output from the device, and I wanted the device to return the output in ASCII.  It is able to do so but now I'm stuck.  I'm now trying to convert that string of ASCII characters into a binary string.  In other words, if my output was a "QN" from VISA Read, then I would have to be able to get a string that had "0111000101101110".  Any help is appreciated.  Thanks.

0 Kudos
Message 1 of 3
(4,297 Views)
Solution
Accepted by topic author Recca

That does not make a lot of sense, because "0111000101101110" would be "qn" and not "QN". Do you want to throw in a "to lowercase" conversion too?

 

Anyway, here's one possible solution that works with any lenght of string.

 

 

Still, this seems like quite a convoluted task. Typically it's easier to work directly in binary strings instead of binary formatted ASCII. 😉

Message Edited by altenbach on 04-29-2009 11:32 PM
Message 2 of 3
(4,288 Views)
Yeah sorry I meant to say "qn".  But yeah that's exactly what I needed to do so thanks.  I know it seems convoluted but theres other aspects to this project that needed the strings to be in that format.  Anyways thanks very much again for your help.
0 Kudos
Message 3 of 3
(4,273 Views)