28123 Parallax Inc, 28123 Datasheet - Page 99
28123
Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet
1.28123.pdf
(340 pages)
Specifications of 28123
Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
- Current page: 99 of 340
- Download datasheet (6Mb)
Programming the Reaction Timer
This next example program will leave the bi-color LED off until the game player presses
and holds the pushbutton. When the pushbutton is held down, the LED will turn red for a
short period of time. When it turns green, the player has to let go of the pushbutton as
fast as he or she can. The time between when the LED turns green and when the
pushbutton is tracked by the program is used as a measure of reaction time.
The example program also demonstrates how polling and counting work. Polling is the
process of checking something over and over again very quickly to see if it has changed.
Counting is the process of adding a number to a variable each time something does (or
does not) happen. In this program, the BASIC Stamp will poll from the time the bi-color
LED turns green until the pushbutton is released. It will wait 1/1000 of a second by using
the command
add 1 to the counting variable named
the program stops polling and sends a message to the Debug Terminal that displays the
value of the
Example Program: ReactionTimer.bs2
P15
P14
P3
√
√
220
Enter and run ReactionTimer.bs2.
Follow the prompts on the Debug Terminal (see Figure 3-15).
timeCounter
Ω
470 Ω
PAUSE 1
Vss
10
kΩ
. Each time it polls and the pushbutton is not yet released, it will
1
2
variable.
Vdd
timeCounter
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
X2
X3
1
Vdd
2
. When the pushbutton is released,
Vin
Vss
Figure 3-14
Reaction
Timer Circuit
Related parts for 28123
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: