28129 Parallax Inc, 28129 Datasheet - Page 36

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, we need to set the output at pin P4 equal to the input taken at pin P1. The left LED
which is connected to P4 will light up when the left button, which is connected to P1, is
pressed. Likewise, we need to set the output at pin P5 equal to the input measured at pin
P0.
Since the input values were set to the variables,
output values at pins P4 and P5.
We could just as easily have used the commands
using variables to store the values in memory has advantages as the programs get more
complicated. In the next experiment, it will be necessary to use variables to store values.
The reason we used variables in this program is because they can be manipulated
arithmetically, and the next task is to convert from binary to decimal. To do this, multiply
the variable
used to store this new value. This is the method for converting a 2-bit binary number to a
decimal number. The next section shows how to do this for a binary number of any size.
In the calculation we just did using PBASIC, the parentheses are necessary to maintain
the normal algebraic order of operation. This is because the BASIC Stamp performs its
math beginning at the left. Then, it performs each operation it encounters while checking
the line from left to right.
Without the parentheses,
the order in which the operators (+, -,*, /, etc) are encountered. When parentheses are
used, the BASIC Stamp completes operations within parentheses first, and then it does its
sweep of operations from left to right.
BASIC Stamp Memory:
RAM: The BASIC Stamp has 26 bytes of RAM (random access memory) that can be used
for storing variable values. Another 6 bytes of RAM is used to interface the BASIC Stamp
with its I/O pins.
EEPROM: Short for electrically erasable programmable read only memory, EEPROM is
used mainly to store the PBASIC programs. EEPROM can also be used to store data values
that do not change frequently.
OUT4 = b
OUT5 = a
d = (2*b) + (1*a)
b
by 2 and the variable
d
would be set equal to the value ((2 x b + 1) x a) because that's
a
by 1 and add them together. The nibble variable
a
and
OUT4=IN1
b
, we can use
and
a
OUT5=IN0
and
b
to dictate the
; however,
d
is

Related parts for 28129