28123 Parallax Inc, 28123 Datasheet - Page 103

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
The last statement in the program is
DO
Your Turn – Revising the Design
The marketing department gave your prototype to some game testers. When the game
testers were done, the marketing department came back to you with an itemized list of
three problems that have to be fixed before your prototype can be built into the game
controller.
The “itemized list” of problems and their solutions are discussed below.
Item-1
When a player holds the button for 30 seconds, his score is actually 14000 ms, a
measurement of 14 seconds. This has to be fixed!
It turns out that executing the loop itself along with adding one to the
variable takes about 1 ms without the
and it’s the amount of time it takes for the BASIC Stamp to execute the commands. A
quick fix that will improve the accuracy is to simply comment out the
by deleting it or adding an apostrophe to the left of it.
Instead of commenting the delay, another way you can fix the program is to multiply
your result by two. For example, just before the
number of ms, you can insert a command that multiplies the result by two:
statement.
' PAUSE 1
timeCounter = timeCounter * 2
DEBUG "Your time was ", DEC timeCounter, " ms.", CR, CR
Save
ReactionTimerYourTurn.bs2).
Try commenting PAUSE 1 and test to see how accurate the program is.
Uncomment the
multiply by two solution instead.
"button down again.", CR, CR
ReactionTimer.bs2
PAUSE
command by deleting the apostrophe, and try the
LOOP
PAUSE 1
, which sends the program back to the very first
under
command. This is called code overhead,
DEBUG
a
command that displays the
' <- Add this
new
PAUSE 1
name
timeCounter
command
(like

Related parts for 28123