28122 Parallax Inc, 28122 Datasheet - Page 215

KIT WHAT'S A MICRO:PARTS ONLY

28122

Manufacturer Part Number
28122
Description
KIT WHAT'S A MICRO:PARTS ONLY
Manufacturer
Parallax Inc
Datasheet

Specifications of 28122

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
For Use With/related Products
Board of Education Full Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Example Program: SimpleSubroutines.bs2
This example program shows how subroutines work by sending messages to the Debug
Terminal.
' What's a Microcontroller - SimpleSubroutines.bs2
' Demonstrate how subroutines work.
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
DEBUG CLS, "Start main routine.", CR
What’s a label? A label is a name that can be used as a placeholder in your program.
GOSUB
ON GOTO
end with a colon, and for the sake of style, separate words with the underscore character.
When picking a name for a label, make sure not to use a reserved word. The rest of the
rules for a label name are the same as the ones for naming variables listed in the
information box on page 53.
Examine SimpleSubroutines.bs2 and try to guess the order in which the
commands will be executed.
Enter and run the program.
Compare the program’s actual behavior with your predictions.
DO
LOOP
Subroutine_Name:
RETURN
is one of the commands you can use to jump to a label. Some others are
GOSUB Subroutine_Name
DEBUG "Next command"
DEBUG "This is a subroutine..."
PAUSE 3000
, and
ON GOSUB
. You can use these commands to jump to labels. A label must
Figure 7-11
How
Subroutines
Work
GOTO
DEBUG
,

Related parts for 28122