5: BASIC Stamp Command Reference - BUTTON
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 85
BUTTON
BS1 BS2 BS2e BS2sx BS2p
BUTTON
Pin, DownState, Delay, Rate, Workspace, TargetState, Address
Function
Debounce button input, perform auto-repeat, and branch to address if
button is in target state. Button circuits may be active-low or active-high.
•
Pin
is a variable/constant/expression (0–15) that specifies the I/O
pin to use. This pin will be set to input mode.
•
DownState
is a variable/constant/expression (0 or 1) that specifies
which logical state occurs when the button is pressed.
•
Delay
is a variable/constant/expression (0 – 255) that specifies how
long the button must be pressed before auto-repeat starts. The delay
is measured in cycles of the Button routine. Delay has two special
settings: 0 and 255. If Delay is 0, Button performs no debounce or
auto-repeat. If Delay is 255, Button performs debounce, but no auto-
repeat.
•
Rate
is a variable/constant/expression (0 – 255) that specifies the
number of cycles between auto-repeats. The rate is expressed in
cycles of the BUTTON routine.
•
Workspace
is a byte variable used by BUTTON for workspace. It
must be cleared to 0 before being used by BUTTON for the first time
and should not be adjusted outside of the BUTTON command.
NOTE: All RAM is cleared to 0 by default upon power-up or reset
of the BASIC Stamp.
•
TargetState
is a variable/constant/expression (0 or 1) that specifies
which state the button should be in for a branch to occur. (0=not
pressed, 1=pressed)
•
Address
is a label that specifies where to branch if the button is in the
target state.
Explanation
When you press a button or flip a switch, the contacts make or break a
connection. A brief (1 to 20-ms) burst of noise occurs as the contacts scrape
and bounce against each other. BUTTON’s debounce feature prevents this
noise from being interpreted as more than one switch action. (For a
1
2
e
2
sx
2
p
2
1
NOTE: Expressions are not
allowed as arguments on the BS1.
The range of the Pin argument on
the BS1 is 0 – 7.
Содержание 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...