Introduction #
WAITPEQ and WAITPNE are two complimentary commands that pause execution in a cog until I/O pin(s) meet designated state(s).
WAITPEQ (WAIT until Pins EQual) pauses the cog until pin/s match,
WAITPNE (WAIT until Pins Not Equal) pauses the cog until pin/s no longer match.
Examples #
Using WAITPxx with a single pin:
WAITPEQ mypin,mypin   'wait for it to be high
WAITPNE mypin,mypin   'wait for it to be low
mypin long |<12       'P12 (pin 12)How to wait for either of 2 pins to be low:
WAITPNE mytwopins,mytwopins   'wait for either one (or both) to be low 
mytwopins long |<12 | |<13    'the two pins ORedHow to wait for 2 pins where one is low and one is high:
WAITPEQ mypinstate,mytwopins  'wait for a match 
mytwopins  long |<12 | |<13   'the two pins ORed
mypinstate long |<12          'pin 12 needs be high and pin 13 needs to be lowHow to wait for 2 pins where either one is high:
WAITPNE myzero,mytwopins    'wait for either one to be high 
mytwopins long |<12 | |<13  'the two pins ORed
myzero    long 0            'zero long for WAITPNE state comparisonResources #
Parallax Propeller 1 Documentation