I have a ten bit number that I need to split into two 8 bit numbers. The first 8 bit number needs to have 3 zeros followed by the first 5 bits of the 10 bit number. The second 8 bit number needs to start with the last 5 bits of the 10 bit number, followed by 3 zeros. Like the example below:
Original 10 bit number: B1101111101
Turn this into: B00011011 & B11101000
This is for a serial transmission (SPI) program I'm working on.
I was thinking a bitshift operation would be the way to go, but I hadn't thought about &'ing it with an 8 bit number to get an 8 bit result. That's the key.