28123 Parallax Inc, 28123 Datasheet - Page 279

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
Your Turn – Changing the Rate and Condensing the Code
You can increase or decrease the rate at which the LED gets brighter and dimmer by
changing the
You can also use a command called
changes the state of a BASIC Stamp I/O pin. If the I/O pin was sending a high signal,
TOGGLE
makes it send a high signal.
' What's a Microcontroller - DigitalPotUpDownWithToggle.bs2
' Sweep digital pot through values.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter
FOR counter = 0 TO 127
NEXT
PULSOUT 6, 1
PAUSE 10
makes it send a low signal. If the I/O pin was sending a low signal,
Modify and re-run the program using
rate that the LED gets brighter and dimmer.
Repeat for
Save DigitalPotUpDown.bs2 as DigitalPotUpDownWithToggle.bs2.
Modify the program so that it looks like the one below.
Run the program and verify that it functions the same as the
DigitalPotUpDown.bs2.
Compare the number of lines of code it took to do the same job.
Running out of program memory is a problem many people encounter when their BASIC
Stamp projects get large and complicated. Using
is just one example of many techniques that can be used to do the same job with half the
code.
PAUSE
VAR
command’s
PAUSE 5
Byte
.
Duration
TOGGLE
argument.
to make this program simpler.
PAUSE 20
TOGGLE
and note the difference in the
instead of two
FOR…NEXT
TOGGLE
TOGGLE
loops

Related parts for 28123