Differences Between " P1SEL |= BIT5 + BIT6 " vs " P1SEL= BIT5 | BIT6 " in embedded C
The |= operator, like all compound operators, is the equivalent of the first operator (|) used on the left-hand side value and the right-hand side value, then an assignment (=) to the left-hand side.
So a |= b is the equivalent of a = a | b.
In your case, P1SEL |= BIT5 + BIT6 is the equivalent of P1SEL = P1SEL | (BIT5 + BIT6).
So it takes the current value of P1SEL, and does a logical OR with the BIT5 + BIT6. This means that bits that are 0 in BIT5 + BIT6 (most likely, all bits but bits 5 and bit 6) are unchanged, while bits that are 1 in BIT5 + BIT6 (most likely, bits 5 and 6) will be set to 1.
In other words, it sets bits 5 and 6 to 1, and leaves all the rest untouched.
On the other hand, P1SEL= BIT5 | BIT6 just sets the value of P1SEL to BIT5 | BIT6. This means bits 5 and 6 are set, while all the others are set to 0.