28129 Parallax Inc, 28129 Datasheet - Page 35

TEXT BASIC ANALOG & DIGITAL

28129

Manufacturer Part Number
28129
Description
TEXT BASIC ANALOG & DIGITAL
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28129

Style
Book
Title
Basic Analog and Digital
Contents
Basic Analog and Digital Text
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Next, three variables are defined. Variables can be used to store values while the
program is running. The letters
the variable a can store a single binary digit, likewise with the variable
defined to be a variable that stores a "nibble" of binary information.
This segment of code uses commands introduced in the last chapter. First, two I/O pins
are declared inputs and two more pins are declared outputs. Then the Debug Terminal is
opened and cleared.
We want the BASIC Stamp keep checking the inputs over and over again. We also want
the BASIC Stamp to automatically update the LEDs and the Debug Terminal with the
latest information on the pushbuttons. The way to accomplish this is to keep repeating the
program inside a
send the program back to this point we’ll use the
Next, we need to check the state of the pushbuttons by checking the input at pins P0 and
P1. The first of these two commands sets the bit variable a equal to the state measured at
pin P0. The second command sets the bit variable b equal to the state measured at pin P1.
a
b
d
INPUT 0
INPUT 1
OUTPUT 4
OUTPUT 5
DEBUG CLS
DO
Memory and Food: A bit of memory can store one binary digit, either a 0 or a 1.
A nibble of memory stores 4-bits.
A byte (pronounced bite) stores 8-bits.
A word stores 16 bits.
Since a bit, a nibble, and a byte, all sound like references to eating food, perhaps a better
name for 16-bits might have been "dinner".
a = IN0
b = IN1
VAR
VAR
VAR
DO…LOOP
Bit
Bit
Nib
loop. To define the start point of the loop we use
a
and
b
are defined as variables that store 1-bit each. So,
LOOP
command.
b
. The letter
DO
and to
d
is

Related parts for 28129