28123 Parallax Inc, 28123 Datasheet - Page 101

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

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
LOOP
How ReactionTimer.bs2 Works
Since the program will have to keep track of the number of times the pushbutton was
polled, a variable called
The
DO…LOOP
another.
DO
LOOP UNTIL IN3 = 0
LOW 14
DEBUG "Your time was ", DEC timeCounter,
PAUSE 1
timeCounter = timeCounter + 1
DEBUG
timeCounter VAR Word
DEBUG "Press and hold pushbutton.", CR,
DO
LOOP
" ms.", CR, CR,
"To play again, hold the ", CR,
"button down again.", CR, CR
statements can be nested. In other words, you can put one
Variables initialize to zero:
automatically zero until a command sets it to a new value.
DO
LOOP UNTIL IN3 = 1
' Rest of program was here.
commands contain instructions for the player of the game.
"to make light turn red.", CR, CR,
"When light turns green, let", CR,
"go as fast as you can.", CR, CR
timeCounter
is declared.
When a variable is declared in PBASIC, its value is
' Declare variable to store time.
' Begin main loop.
' Nested loop repeats...
' until pushbutton press.
' Back to "Begin main loop".
' Nested loop, count time...
' until pushbutton is released.
' Bi-color LED off.
' Display time measurement.
' Play again instructions.
' Back to "Begin main loop".
DO…LOOP
inside

Related parts for 28123