28129 Parallax Inc, 28129 Datasheet - Page 33

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
' Basic Analog and Digital - PL2_1R0.bs2
' Program Listing 2.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
a
b
d
INPUT 0
INPUT 1
OUTPUT 4
OUTPUT 5
DEBUG CLS
DO
LOOP
The Output
Here's how the program should work. When no pushbuttons are pressed, the Debug
Terminal output should match Figure 2-4, and both LEDs should be off. Try pressing the
right button (in Figure 2-3). Did the right LED light up? Did the state of P0 in the Debug
Terminal change to 1? Is the decimal equivalent 1? If so, it looks like your circuit and
program are working well so far.
a = IN0
b = IN1
OUT4 = b
OUT5 = a
d = (2*b) + (1*a)
DEBUG HOME, "State of pin P0 is ", BIN a, CR
DEBUG "State of pin P1 is ", BIN B, CR, CR
DEBUG "2-bit binary number: ", CR
DEBUG "P1
DEBUG " ", BIN b, "
DEBUG "Decimal equivalent: ", DEC1 d, CR
VAR
VAR
VAR
P0", CR
Bit
Bit
Nib
", BIN a, CR, CR

Related parts for 28129