Forum : 8051
Post Information | Post |
---|---|
October 24, 2008 - 10:11am
|
Hi, typedef struct unsigned TAAC : 8; // Works Is there a way to make or update RC51 to deal with bit-values up to 32 bits? I hate bit-moving and masking and that was the reason to move from ASM to C ;-) Question 2: Regarding bit ordering within a struct. The structure in placed from address 0x0100...0x010F. The bit order of the structure is: 0x0100 [Bit 127].... 0x010F[Bit 0]. That means, writing 0x03 to CSD_STRUCTURE[127:126] the address 0x0100 contains then 0x03 instead of 0x0C. So i need to change the structure as follows: typedef struct unsigned TAAC : 8; Is there a way to define the LSB and MSB direction of a byte within a struct? Kind regards, |
1. No.. The maximum width is not specified by ANSI, and depends on the compiler implementation. In the case of RC51, we prefer to keep 8 bit as maimum value since the instruction set does not allow to handle larger 'bit fields'.
2. No, the LSB/MSB convention is unique for all the types defined in the compiler.
Kind Regards
Francis