28123 Parallax Inc, 28123 Datasheet - Page 164

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
That takes care of the scaling, now all we need to do is add the offset of 500. This can be
done with a second command that adds 500 to
Now,
Example Program: ControlServoWithPot.bs2
' What's a Microcontroller - ControlServoWithPot.bs2
' Read potentiometer in RC-time circuit using RCTIME command.
' Scale time by 0.724 and offset by 500 for the servo.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
time
DO
LOOP
Your Turn – Scaling the Servo’s Relationship to the Dial
Your potentiometer and capacitor will probably give you
different from the ones discussed in this activity. These are the values you gathered in
the Your Turn section of the previous activity.
HIGH 7
PAUSE 10
RCTIME 7, 1, time
time = time */ 185
time = time + 500
PULSOUT 14, time
time
time = time */ 185
time = time */ 185
time = time + 500
time = time */ 185
time = time + 500
PULSOUT 14, time
Enter and run this program, then twist the potentiometer’s input shaft and
make sure that the servo’s movements echo the potentiometer’s movements.
Repeat the math discussed in the Programming Potentiometer Control of the
Servo section on page 154 using your maximum and minimum values.
is ready to be recycled into the
VAR
Word
' Scale by 0.724.
' Offset by 500.
' Send pulse to servo.
PULSOUT
time
' Scale by 0.724 (X 256 for */).
' Offset by 500.
' Send pulse to servo.
:
command’s
time
values that are somewhat
Duration
argument.

Related parts for 28123