LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

go from strings of bits to single byte (best practices?)

Solved!
Go to solution

I'm looking for a more eloquent way to perform the conversion:

  • Multiple strings of bits to a single byte.
  • Single string into byte array representing the value of the number

See the VI for a functional but not scalable example.

 

 

Each string will have a value of 0 or 1, and they will be converted into a single byte.

 

 

I'm surprised there isn't a native function in the conversions section that allows a user to do this.

 

I would like to change the conversion into a function with the following inputs:

  • any number of bit strings

Output:

  • Byte or word

 

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 1 of 4
(2,878 Views)

Okay hows this.  If you know each string is only going to be a bit, check to see if the string is not a 0, then you have an array of booleans to turn into a number.

0 Kudos
Message 2 of 4
(2,861 Views)
Solution
Accepted by topic author eximo

I'm on LabVIEW 2012 and I can't open your VI, nor Hoovahh's modified version, so perhaps I'm posting exactly the same thing, but does this snippet do what you want?

bit string array to value.png

Message 3 of 4
(2,838 Views)

That is more elogant than what I have

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 4 of 4
(2,822 Views)