User Manual
MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
137
Value1 0 1 0 1 1 1 0 1
Value2 0 0 0 0 1 1 1 1
Result 0 0 0 0 1 1 0 1
As you can see, the high 4 bits are now all set to 0’s, regardless of their original state, but the
low 4 bits retain their original state.
OR ( | )
The OR ( | ) function is a binary operator. It sets the bit to 1 if either or both of the matching bits
are 1 or to 0 if both bits are 0’s.
1 | 1 = 1
1 | 0 = 1
0 | 1 = 1
0 | 0 = 0
Value1 0 1 0 1 1 1 0 1
Value2 1 0 0 1 0 0 1 1
Result 1 1 0 1 1 1 1 1
Exclusive OR (^)
The ^ function is a binary operator. It sets the resulting bits to a 1 if either, but not both, of the
matching bits are 1 or to 0 otherwise.
1 ^ 1 = 0
1 ^ 0 = 1
0 ^ 1 = 1
0 ^ 0 = 0
Value1 0 1 0 1 1 1 0 1
Value2 1 0 0 1 0 0 1 1
Result 1 1 0 0 1 1 1 0