28123 Parallax Inc, 28123 Datasheet - Page 62

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
decisions based on a variety of conditions. In this activity, you will program the BASIC
Stamp to stop flashing the LED on and off after ten repetitions.
Counting Parts and Test Circuit
Use the example circuit shown in Figure 2-11 on page 48.
How Many Times?
There are many ways to make the LED blink on and off ten times. The simplest way is to
use a
loop can be used to repeat commands a fixed number of times,
The
on and off. A variable is a word of your choosing that is used to store a value. The next
example program uses the word
turned on and off.
Example Program: LedOnOffTenTimes.bs2
The program LedOnOffTenTimes.bs2 demonstrates how to use a
an LED on and off ten times.
FOR…NEXT
FOR…NEXT
Your test circuit from Activity #2 should be built (or rebuilt) and ready to use.
Enter the LedOnOffTenTimes.bs2 code into the BASIC Stamp Editor.
Connect power to your Board of Education or HomeWork Board.
Run the program.
Verify that the LED flashes on and off ten times.
Picking words for variable names has several rules:
1.
2.
3.
4.
loop depends on a variable to track how many times the LED has blinked
The name cannot be a word that is already used by PBASIC. These words are
called reserved words, and some examples that you should already be familiar with
are:
The name cannot contain a space.
Even though the name can contain letters, numbers, or underscores, it must begin
with a character.
The name must be less than 33 characters long.
loop. The
DEBUG
,
PAUSE
FOR…NEXT
counter
,
HIGH
loop is similar to the
,
LOW
to ‘count’ how many times the LED has been
,
DO
, and
LOOP
.
DO…LOOP
FOR…NEXT
FOR…NEXT
. Although either
is easier to use.
loop to blink

Related parts for 28123