Keil Logo

union, bit field and bdata

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
gouezel yann
Posted
20-Jul-2001 16:02 GMT
Toolset
None
New! union, bit field and bdata
I want to fix (in C langage if possible)
in bdata memory a word (u16). At the same address I want to use 2 bytes (u08) and always in the same area (0x20 and 0x21 addresses for example) to declare bits with sbit structure.
---------------------------------------
u16 bdata myByte;
sbit myBit15 = myWord ^ 15;
sbit myBit3 = myWord ^ 3;
// it does affect the right bit. Why ?
---------------------------------------
union u{
u08 bdata msb;
u08 bdata lsb;
} myWord;
union {
u16 bdata word _at_ 0x20;
union u myWord;
} MYword;
sbit myBit15 = myWord.msb ^ 7;
sbit myBit3 = myWord.lsb ^ 3;

... // use
{
MYword.word;
myWord.msb;
myWord.lsb;
myBit15; // not known by compiler ?
myBit3; // not known by compiler ?
}
Read-Only
Author
Andrew Neil
Posted
20-Jul-2001 17:17 GMT
Toolset
None
New! RE: union, bit field and bdata
http://www.keil.com/support/docs/928.htm
http://www.keil.com/support/docs/1279.htm

And, of course, the C51 User's Guide, C51.pdf

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.