Hi all, I have a very trivial question. I have a 16-bits register. How to retrieve 8-LSBs and 8-HSBs from the register. Give some examples thanks regards /M
Here's one way. I'm sure there are many others.
MSB = (unsigned char)(reg16 >> 8); LSB = (unsigned char)(reg16);
Thanks for reply, LSB = (unsigned char)(reg16); What about if I want to get n-LSB from a 16-bits register? thanks again regard /M
If you only want 4 of the 8 LSBits I would mask it like this.
LSB = (unsigned char)(reg16 & 0x000F);