5: BASIC Stamp Command Reference – POLLWAIT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 237
to sleep for another 18 ms. If I/O pin 0 is high, it runs the next line of
code, which toggles the state of I/O pin 1. Then the loop starts all over
again. Note: Due to the nature of low-power mode, I/O pin 1 may toggle
between high and low (at 18 ms intervals in this case) even if I/O pin 0
stays low. This is an artifact of the "reset" condition in the interpreter chip
that occurs when the chip wakes up from a low-power state. Upon this
"reset" condition, all the I/O pins are switched to inputs for apx. 18 ms. It
is the switching to inputs that will cause I/O pin 1 to appear to toggle. See
the NAP or SLEEP commands for more information.
If low-power mode is not required, change the POLLWAIT command in
the example above to "POLLWAIT 8" instead. This will have the effect of
keeping the BASIC Stamp in normal running mode (ie: no low-power
glitches) and will also cause the TOGGLE command to execute in a much
shorter amount of time after a polled-input event occurs.
Demo Program (POLLWAIT.bsp)
' This program demonstrates the POLLWAIT command. I/O pin 0 is set to watch for a
' high signal. Once the Loop routine starts running, the POLLWAIT command causes the
' program to halt until the polled event happens (I/O pin is high) then it prints
' a message on the PC screen. It will do nothing until I/O pin is high.
'{$STAMP BS2p} 'STAMP directive (specifies a BS2p)
POLLIN 0, 1 'Set I/O 0 to polled-input looking for a high
POLLMODE 2 'Set mode to enable polled-outputs and polled wait
Loop:
POLLWAIT 8 'Wait for polled event (in normal power mode)
DEBUG "I/O 0 is HIGH!", CR 'Print to the screen when polled event occurs
GOTO Loop
p
2
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...