5: BASIC Stamp Command Reference – PULSIN
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 241
PULSIN
BS1 BS2 BS2e BS2sx BS2p
PULSIN
Pin, State, Variable
Function
Measure the width of a pulse on Pin described by State and store the result
in Variable.
•
Pin
is a variable/constant/expression (0 – 15) that specifies the I/O
pin to use. This pin will be set to input mode.
•
State
is a variable/constant/expression (0 – 1) that specifies whether
the pulse to be measured is low (0) or high (1). A low pulse begins
with a 1-to-0 transition and a high pulse begins with a 0-to-1
transition.
•
Variable
is
a variable (usually a word) in which the measured pulse
duration will be stored. The unit of time for Variable is described in
Table 5.62.
Quick Facts
BS1
BS2
BS2e
BS2sx
BS2p
Units in Variable
10 µs
2 µs
2 µs
0.8 µs
0.75 µs
Maximum pulse
width
655.35 ms
131.07 ms
131.07 ms
52.428 ms
49.125 ms
Explanation
PULSIN is like a fast stopwatch that is triggered by a change in state (0 or
1) on the specified pin. The entire width of the specified pulse (high or
low) is measured, in units shown in Table 5.62, and stored in Variable.
Many analog properties (voltage, resistance, capacitance, frequency, duty
cycle) can be measured in terms of pulse durations. This makes PULSIN a
valuable form of analog-to-digital conversion.
PULSIN will wait, for the desired pulse, for up to the maximum pulse
width it can measure, shown in Table 5.62.
If it sees the desired pulse, it
measures the time until the end of the pulse and stores the result in
Variable. If it never sees the start of the pulse, or the pulse is too long
(greater than the Maximum Pulse Width shown in Table 5.62) PULSIN
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.
Table 5.62: PULSIN Quick Facts.
S
PECIFICS OF
PULSIN'
S OPERATION
.
Содержание 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...