27297 Parallax Inc, 27297 Datasheet - Page 45
27297
Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet
1.27297.pdf
(230 pages)
Specifications of 27297
Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
- Current page: 45 of 230
- Download datasheet (3Mb)
Behind the Scenes
As explained in Experiment #1, the state of the BASIC Stamp output bits is stored in
a RAM register called OUTS.
corresponding to I/O pins P0 – P3. Since OUTA is part of the BASIC Stamp’s general
purpose (RAM) memory, values can be written to and read from it like any other
variable.
In this program we simply transfer (copy) the contents of 4-bit variable cntr to
OUTA (alias for the LEDs). Since P0 – P3 have been made outputs, this causes the
value of cntr to be displayed on the LEDs in binary format.
Challenge yourself: Modify the program to count backwards.
Q: Can we get the same results without using the cntr variable?
A: Yes – simply use
Write Code like a Pro
Since we’re dealing with multiple LEDs as a group and we cannot take advantage of
the PIN type declaration, we’re forced to use a standard variable (OUTA in this case)
to update the LEDs simultaneously. When possible, it’s best to group outputs to
match the natural boundaries of the BASIC Stamp I/O and memory structure. Our
programs will not always be as neat and tidy as this experiment, but when we do
indeed end up with groupings of four or eight pins, it’s best to use the BASIC
Stamp’s natural boundaries.
And note that while the LEDsDirs variable does not actually control the state of the
I/O pins, it does set pin directions and this is required for making these pins outputs
with a single line of code. For this reason, it is defined near the
the I/O definitions block. If we needed to make a design change that moved the
LEDs to OUTD, for example, the required changes would take place in the same area
of the program.
LEDs
LEDsDirs
LEDs
VAR
VAR
as the control variable for the FOR-NEXT loop.
The variable OUTA is the lower 4-bits of OUTS,
OUTD
DIRD
' LEDs on P12 – P15
' DIRS control for LEDs
LEDs
declaration in
Related parts for 27297
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: