We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
any macros to make P4 bit addressable?
thank you
Fausto Bartra
The SFR P4 is at address 0xB5. This address is not bit-addressable. You can only set or clear bits by using AND / OR operators that modify the whole SFR with a Read-Modify-Write instruction. Example:
P4 |= 0x01; // set bit P4.0P4 |= 0x02; // set bit P4.1
P4 &= 0xFE; // clear bit P4.0P4 &= 0xFD; // clear bit P4.1
If you like, you can define macros for such expressions, but we don't have predefined ones.
Thank you