Hallo Thomas,
Dir kommt es ja auf die Bits 0 und 1 von STATUS an. Das Maskieren geht dann so:... was ist denn nun richtig ???
AND 0x01 --> wird <> 0, wenn Bit 0 = 1 ist (andere Bits egal!).
AND 0x02 --> wird <> 0, wenn Bit 1 = 1 ist (andere Bits egal!).
AND 0x03 --> wird <> 0, wenn Bit 0 oder Bit 1 oder beide Bits = 1 sind.
AND 0x03 ist identisch mit AND 0b00000011
Wie Du das dann in Deinem Programm umsetzt, ist Deine Sache. Da Du das ACS rechts/links auslesen willst, wären die Tests dazu:
if (STATUS and 0x01)<>0 --> links
if (STATUS and 0x02)<>0 --> rechts
if (STATUS and 0x03)<>0 --> links und/oder rechts
Gruß Dirk
Lesezeichen