SX/B Question
I am looking at the·Quadrature Encoder example shown in the·SX/B Help and I have a question about how a variable is defined in this code.
···EncPort········ VAR···· RA····················· ' encoder port
·· encNew = EncPort & %00000011···········' get econder bits
What does the & %00000011 do?
···EncPort········ VAR···· RA····················· ' encoder port
·· encNew = EncPort & %00000011···········' get econder bits
What does the & %00000011 do?
Comments
& %00000011 performs a logical AND operation using the bit pattern that follows the percent sign. In the code section referenced this operation leaves encNew with the value of the first two bits of EncPort (RA). The six higher bits of EncPort are not included in the value of encNew since those bits are AND’ed with zeros.
I hope this helps.
- Sparks