# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## unsigned byte too short

Hello,

Could anyone know why the maximal u8 value would be 128 instead of 255 as it should be? I am trying to convert an array of zeros and ones into the array of zeros nad 255's, so i am converting data array to u8 and trying to use rotate function (http://zone.ni.com/reference/en-XX/help/371361P-01/glang/rotate/) with y=-1...

Any help/ideas appreciated!

Message 1 of 5
(214 Views)

## Re: unsigned byte too short

You are not making any sense.

The max U8 value is 255 and if your rotate by -1, you'll end up with 127. Where does your 128 come from? What does an array of zeroes and ones have to do with any of this?

Can  you show us some code and real data?

LabVIEW Champion Do more with less code and in less time
Message 2 of 5
(202 Views)
Solution
Accepted by topic author JulIS
06-13-2018 01:28 PM

## Re: unsigned byte too short

@JulIS wrote:

Hello,

Could anyone know why the maximal u8 value would be 128 instead of 255 as it should be? I am trying to convert an array of zeros and ones into the array of zeros nad 255's, so i am converting data array to u8 and trying to use rotate function (http://zone.ni.com/reference/en-XX/help/371361P-01/glang/rotate/) with y=-1...

Any help/ideas appreciated!

128 is is "10000000" in binary. It is the largest value of a U8 where only a single bit is set.

Ben

Message 3 of 5
(164 Views)
Solution
Accepted by topic author JulIS
06-13-2018 01:28 PM

## Re: unsigned byte too short

If you're just changing 1's to 255, multiply the array by a constant of 255.

If your data is a binary 1 (00000001) then no matter how you rotate it you'll never get to 255 (11111111). I guess you could subtract 2 from your number instead of rotating?

What are you actually trying to do here?

Message 4 of 5
(155 Views)

## Re: unsigned byte too short

Thank you all for your reply. Yes, I was doing something not very wise suggested by somebody else's code. Thanks a lot!

Message 5 of 5
(142 Views)