- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- unsigned byte too short

turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

06-13-2018 11:41 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Labels:

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!

Solved! Go to Solution.

06-13-2018 11:53 AM - edited 06-13-2018 11:55 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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?

Solution

Accepted by topic author JulIS

06-13-2018 01:28 PM

06-13-2018 02:25 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@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

Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel .............. Great paleotechnics YouTubeChannel... talk about stone knives and bears skins! Check it out!

Solution

Accepted by topic author JulIS

06-13-2018 01:28 PM

06-13-2018 02:40 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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?

06-13-2018 03:26 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator