# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Breaking a number into it's component byte

Hey, guys.

I know about the existance of the Split Number function. But my problem is a little different.

Let's say I have a 12 bits byte. It is something like this: 0000-1111-1111-1111 or 0FFF.

When i use the Split Number, I get 0F and FF.

But I'm intending to have something like this: 0011-1111 + 0011-1111.

I mean, I want to break my 12bits number into a 6+6bits, not into a 4+8.

What tools should I use to have this result?

Thanks!

Message 1 of 3
(723 Views)
Solution
Accepted by topic author pedroseger

## Re: Breaking a number into it's component byte

1.  AND with 2^12-1 (12 1's) so that you know you are keeping lowest 12 bits (if you want)

2.  AND with 2^6-1 to return the lowest 6 bits

3.  Right-Shift 6 bits to return the upper 6 bits

Or use Integer quotient and remainder.

Divide by 2^6, quotient is upper, remainder is lower

Message 2 of 3
(710 Views)
Solution
Accepted by topic author pedroseger

## Re: Breaking a number into it's component byte

Just a bit if bit manipulation

Always maintain an accurate count of deployed mousetraps.
Message 3 of 3
(705 Views)