Gast
#567252
I want to kown the differece between PIOUT&=~BIT0 andPIOUT ^=BIT0. they are all Reset ,all right ?
|
Anzeige
|
a question
Gast
#567252
I want to kown the differece between PIOUT&=~BIT0 andPIOUT ^=BIT0. they are all Reset ,all right ?
Gast
#567264
yes right No! Neeeeeee.... PIOUT ^= BIT0 ^ ist die XOR-Funktion. Daher ist das ein Pin-Toggle.
Gast
#567276
Hi, PIOUT&=~BIT0 resets (while BIT0 must be a bitmask) while PIOUT ^=BIT0 is a "exlusive or", i.e. it reverses. > I want to kown the differece between PIOUT&=~BIT0 andPIOUT ^=BIT0. they > are all Reset ,all right ? No. & means and ^ means xor (exclusive or) So in the first case bit BIT0 gets reset. But in the second case the bit gets toggled. It depends on the previous state of of the bit what its new state will be. 0 toggles to 1, 1 toggles to 0 > thank you! you are welcome Antwort schreibenBitte melde dich an, um einen Beitrag zu schreiben. |
Anzeige
|