28128 Parallax Inc, 28128 Datasheet - Page 156

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
Then
Program It
Enter Program 8.1 in your BASIC Stamp Editor, and download to the BASIC Stamp.
' Basic Analog and Digital - PL8_1R0.bs2
' Program Listing 8.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
light
dischargeTime
sound
a
DO
LOOP
The Output
The piezoelectric speaker should beep every half second or so. If you put your hand over
the circuit to shade it, the tone of the beep should get lower. If you face your breadboard
directly at a light in the room, the pitch should get higher. Figure 8-5 a sample output for
a well-lit room.
HIGH 15
PAUSE 100
RCTIME 15, 1, light
dischargeTime = light * 2
sound = (65535 - light) / a
FREQOUT 7, 500, sound
DEBUG HOME
DEBUG "Discharge time = ", DEC5 dischargeTime, " u-seconds."
DEBUG CR, CR, "Sound Frequency = ", DEC5 sound, " Hz."
PAUSE 500
RCTIME
RCTIME 15, 1, light
takes care of the time measurement and data storage.
VAR
VAR
VAR
CON
Word
Word
Word
40

Related parts for 28128