This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Writing to non addressable bits

Hi,

I am trying to get to grips with the Keil C compiler. I understand that not all SFR's are bit addressable, if not evenly divisible by 0 or 8 - a pain if you ask me! - you can tell i am new to this ;)

I grabbed this code from the forum for reading bits from SFR's, which i follow ok:

unsigned char mask_table[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };

//bit_n = ( byte & mask_table[ n ] ) != 0x00;

Can someone assist me in writing something similar (easy to use) for writing to a specified bit in a non bit addressable SFR - as I am struggling to come up with something that works...

Thanks

Barry