28123 Parallax Inc, 28123 Datasheet - Page 141

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
Example Program: ServoControlWithPushbuttons.bs2
This example program makes the servo’s horn rotate counterclockwise when the
pushbutton connected to P4 is pressed. The servo’s horn will keep rotating so long as the
pushbutton is held down and the value of
pushbutton connected to P3 is pressed, the servo horn rotates clockwise. The servo also
is limited in its clockwise motion because the
below 500. The Debug Terminal displays the value of
running.
' What's a Microcontroller - ServoControlWithPushbuttons.bs2
' Press and hold P4 pushbutton to rotate the servo counterclockwise,
' or press the pushbutton connected to P3 to rotate the servo clockwise.
' {$STAMP BS2}
' {$PBASIC 2.5}
duration
duration = 750
DO
IF IN3 = 1 THEN
ENDIF
IF duration > 500 THEN
ENDIF
duration = duration - 25
Enter the ServoControlWithPushbuttons.bs2 program into the BASIC Stamp
Editor and run it.
Verify that the servo turns counterclockwise when you press and hold the
pushbutton connected to P4.
Verify that as soon as the limit of
that the servo stops turning any further in the counterclockwise direction.
Verify that the servo turns clockwise when you press and hold the pushbutton
connected to P3.
Verify that as soon as the limit of
the servo stops turning any further in the clockwise direction.
VAR
Word
duration
duration
duration
duration
is smaller than 1000. When the
< 500 is reached or exceeded that
duration
> 1000 is reached or exceeded
variable is not allowed to go
while the program is

Related parts for 28123