I am programming a Microchip PIC18F14K50 in C. While checking a code written by another company I stumbled across the following line:
if(MGC_SSPCON2_REG & 0x1F) { // MSSP not idle
...
}
Now, MGC_SSPCON2_REG is implemented as follows
#define MGC_SSPCON2_REG SSPCON2
Where SSPCON is the 8bit MSSP Control register (in I2C MODE).
What I do not understand, is how this if-condition works. Is it true when all the bits of the 8bit binary numbers are set to 1? As far as I understand, the argument is the bit wise AND operation on the 8bit register and the binary number 0001 1111 (0x1F).
I hope that I provided enough code to understand the question. I didn`t want to go to much into detail about how the register works.
Thank you in advance for your help :)
Aucun commentaire:
Enregistrer un commentaire