Go Down

Topic: |= please help! (Read 759 times) previous topic - next topic

btmcmahan

I'm doing some timer stuff, and I dont understand this opperator...  |=
Here's what I'm seeing...

PIT_TCTRL0 = TIE;
PIT_TCTRL0 |= TEN;

nevermind the logic, but what does the opperator mean?  What is the difference between = and |=

SurferTim

http://arduino.cc/en/Reference/BitwiseCompoundOr

marco_c

A |= B is the same as A = A|B

You can use the same for all the other operators (+=, *=, /=, %=, you get the idea). It is just a shorthand, just as A++ is the same as A+=1 or A=A+1.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

Go Up