06-26-2019 11:03 AM
Hi there,
I was wondering whether you could convert a string of 01110010010 (for example) into text, so if I entered 01111110 I would get ~.
Regards,
Christopher
Solved! Go to Solution.
06-26-2019 11:07 AM
If i understand you right, you want to convert a number to its ascii representation, right?
06-26-2019 11:10 AM
This should do it.
06-26-2019 11:13 AM
You can also see this. https://forums.ni.com/t5/LabVIEW/Converting-a-binary-string-to-a-number/m-p/33935
You'd use scan from string if you have a binary string.
06-26-2019 11:50 AM
@programlad19 wrote:
so if I entered 01111110 I would get ~.
How is that value being entered? Is it a single byte with Binary radix/display? A string of just 1s and 0s in ASCII?
Assuming a single byte, the use Build Array and Byte Array To String.
If the string of 1s and 0s in ASCII, then I would use Scan From String with "0b8" as the format to convert to a U8. Then you just use the Build Array and Byte Array To String to get your character.
06-26-2019 02:36 PM
Oh no I mean like an actual string. So it would be a string (pink) with 1s and 0s inside it. Not sure how you would convert that to a text string.
06-26-2019 02:45 PM
This is what you need.
06-26-2019 02:55 PM
That only works for the first letter. So the way my system works is it takes in a bunch of binary values which no spaces in between for each character, so for example 0110100001100101011011000110110001101111001000000001010 would be the binary string which I want to convert to hello.
06-26-2019 03:03 PM
Whats the source of the data being streamed & size of each data packet? I am assuming its an unsigned 8-bit? You'd have to parse your data packet based on the packet size and then apply the VI that i shared in my previous post.
06-26-2019 03:09 PM