??? 08/27/08 10:17 Read: times |
#157789 - Alternative split Responding to: ???'s previous message |
unsigned addr; unsigned char low,high; addr = 0x1234; low = addr & 0xff; /* or low = (unsigned char)addr */ high = (addr >> 8) & 0xff; /* or high = (unsigned char)(addr >> 8) */ The masking with 0xff is more compatible with architectures with funnier word and character sizes, and a good compiler should note that masking with 0xff is a null-operation when assigning to an 8-bit variable. |
Topic | Author | Date |
Keil - Watch window | 01/01/70 00:00 | |
use long data type | 01/01/70 00:00 | |
Apparently, no | 01/01/70 00:00 | |
Thanks. I use version 3.51 | 01/01/70 00:00 | |
truncating the low byte...hmmm | 01/01/70 00:00 | |
Moved the variable | 01/01/70 00:00 | |
Alternative split | 01/01/70 00:00 | |
Yeah got it...![]() | 01/01/70 00:00 |