Is this code workable? I need to extract the upper byte and lower byte from array which consist of Hex codes. For example, in 0x0604 I need 6 in upper byte and 4 in lower byte and lower byte will not exceed by 7.
unsigned int TestArray[3] = {0x0604, 0x0605, 0x0606};
void TestRoutine(unsigned char Number)
{
unsigned char Data = TestArray[Number];
unsigned char UpperByte = (Data/256); //upper byte
unsigned char LowerByte = (Data%256 & 0x07); //lower byte
}