Hi,
I want to read analog input 10 bit, 0 - 1023. I need to separate the high nibble from the low nibble and and put each into it's own byte.
How would I do this?
Thanks
Ron
splitting 1 byte into 2 bytes
- Steve
- Matrix Staff
- Posts: 3431
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: splitting 1 byte into 2 bytes
Hi Ron,
I just want to clear up some terminology first... A byte is 8 bits of data and a nibble is half a byte (4 bits of data).
So your question should probably be "How to split up a 10-bit value into 8-bit bytes".
The answer is to use the MOD and / functions as below:
I just want to clear up some terminology first... A byte is 8 bits of data and a nibble is half a byte (4 bits of data).
So your question should probably be "How to split up a 10-bit value into 8-bit bytes".
The answer is to use the MOD and / functions as below:
Code: Select all
HiByte = My10BitVal / 256
LoByte = My10BitVal MOD 256
Re: splitting 1 byte into 2 bytes
Hi,
yes.... Boy, did I mess that one up......
10 bits.... yep...
Good thing these guys believe in the old saying.... Give me the answer I need, not for what I actually asked...
Thanks,
Ron
yes.... Boy, did I mess that one up......
10 bits.... yep...
Good thing these guys believe in the old saying.... Give me the answer I need, not for what I actually asked...
Thanks,
Ron