28123 Parallax Inc, 28123 Datasheet - Page 94

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
Programming Pushbutton Control
In the previous activity, you experimented with making decisions using an
IF…THEN…ELSE
It works great for deciding which LED to flash on and off. The next example program
shows how it works.
Example Program: PushbuttonControlOfTwoLeds.bs2
' What's a Microcontroller - PushbuttonControlOfTwoLeds.bs2
' Blink P14 LED if P3 pushbutton is pressed, and blink P15 LED if
' P4 pushbutton is pressed.
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
Enter PushbuttonControlOfTwoLeds.bs2 into the BASIC Stamp Editor and
run it.
Verify that the LED in the circuit connected to P14 flashes on and off while
the pushbutton in the circuit connected to P3 is held down.
Also check to make sure the LED in the circuit connected to P15 flashes while
the pushbutton in the circuit connected to P4 is held down
statement. There is also such a thing as an
P15
P14
P13
P12
P11
P10
P9
P8
P7
P6
P5
P4
P3
P2
P1
P0
X2
X3
Vdd
Vin
+
+
Vss
Figure 3-13
Wiring Diagram:
Two Pushbuttons
and LEDs
IF…ELSEIF…ELSE
statement.

Related parts for 28123