From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unsigned byte too short

Solved!
Go to solution

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!

0 Kudos
Message 1 of 5
(2,521 Views)

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?

0 Kudos
Message 2 of 5
(2,509 Views)
Solution
Accepted by JulIS

@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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 5
(2,471 Views)
Solution
Accepted by JulIS

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

 

multiply.png

 

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?

0 Kudos
Message 4 of 5
(2,462 Views)

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

0 Kudos
Message 5 of 5
(2,449 Views)