28128 Parallax Inc, 28128 Datasheet - Page 33

no-image

28128

Manufacturer Part Number
28128
Description
KIT BASIC ANALOG/DIGI PARTS ONLY
Manufacturer
Parallax Inc
Datasheet

Specifications of 28128

Accessory Type
ADC, DAC
Product
Microcontroller Accessories
For Use With/related Products
BASIC Stamp® 2 and Board of Education
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
' 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 28128