BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – POLLMODE
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 323
Table 5.77: Special Purpose
Scratch Pad RAM Locations.
Location BS2p and BS2pe
127
Bits 0-3, Active program slot #. Bits 4-7, program slot for READ and WRITE
operations.
128
Polled input trigger status of Main I/O pins 0-7
(0 = not triggered, 1 = triggered).
129
Polled input trigger status of Main I/O pins 8-15
(0 = not triggered, 1 = triggered).
130
Polled input trigger status of Auxiliary I/O pins
0-7 (0 = not triggered, 1 = triggered).
131
Polled input trigger status of Auxiliary I/O pins
8-15 (0 = not triggered, 1 = triggered).
132 Bits 0-3: Polled-interrupt mode, set by POLLMODE
133 Bits 0-2: Polled-interrupt “run” slot, set by POLLRUN.
134
Bit 0: Active I/O group; 0 = Main I/O,
1 = Auxiliary I/O.
135
Bit 0: Polled-output status (set by POLLMODE); 0 = disabled, 1= enabled.
Bit 1: Polled-input status; 0 = none defined, 1 = at least one defined.
Bit 2: Polled-run status (set by POLLMODE); 0 = disabled, 1 = enabled.
Bit 3: Polled-output latch status; 0 = real-time mode, 1 = latch mode.
Bit 4: Polled-input state; 0 = no trigger, 1 = triggered.
Bit 5: Polled-output latch state; 0 = nothing latched, 1 = signal latched.
Bit 6: Poll-wait state; 0 = No Event, 1 = Event Occurred.
(Cleared by POLLMODE only).
Bit 7: Polling status; 0 = not active, 1 = active.
Demo Program (POLL.bsp)
' POLL.bsp
' This program demonstrates POLLIN, POLLOUT, and the use of the POLLMODE
' instruction. Connect active-low inputs to pins 0, 1, 2, and 3. Then
' connect an LED to pin 7. The program will print "." to the Debug
' window until one of the alarm buttons are pressed. This will cause
' the termination of the main loop. At this point the program will
' save the latched bits, clear them (and the polling process), then
' report the input(s) that triggered the alarm.
' {$STAMP BS2p}
' {$PBASIC 2.5}
FDoor PIN 0
BDoor PIN 1
Patio PIN 2
Rst PIN 3
AlarmLed PIN 7
alarms VAR Byte ' alarm bits
idx VAR Nib ' loop control
NOTE: This example program can be
used with the BS2p, BS2pe, and
BS2px by changing the $STAMP
directive accordingly.