27220 Parallax Inc, 27220 Datasheet - Page 138

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
' -----[ Subroutines ]-----------------------------------------------------
Show_Level:
Behind the Scenes
While most BASIC Stamp applications will deal with digital signals, some will require
analog output; a variable voltage between zero and some maximum voltage. The
BASIC Stamp’s PWM instruction is designed to generate an analog voltage when
combined with an R/C filter. The PWM instruction produces a series of pulses which
have a programmable on-time to off-time ratio (duty cycle). The output voltage of
the circuit corresponds directly to the
larger value for
the capacitor to five volts.
In order to ensure that the capacitor is properly charged, the
should be set to at least five R/C time constants. In the circuit above, one time
constant is one millisecond (10 kΩ x 0.1 µF), so setting the
milliseconds guarantees the capacitor will be changed to the level set by
In this experiment, one half of the LM358 is configured as a voltage follower and
serves to provide a buffered output to the LED or other circuitry. The op-amp buffer
prevents the capacitor from discharging too quickly under load. The LED brightens
and dims because the changing voltage through its series resistor changes the
current through the LED. Notice that the LED seems to snap on and get brighter,
then dim to some level and snap off. This happens when the output of the LM358
crosses the forward voltage threshold (the minimum voltage for the LED to light) of
the LED (about 2.3 volts for the blue LEDs on the PDB – other LEDs will differ).
mVolts = level */ $139B
DEBUG CRSRXY, 10, 2,
RETURN
DEC level, CLREOL,
CRSRXY, 10, 3,
DEC1 (mVolts / 1000), ".", DEC3 mVolts
Duty
will result in a higher output voltage. A
Duty
parameter of the PWM instruction – a
' level * 19.6 mV
Duty
Duration
of 255 will charge
Duration
Duty
parameter
.
to 10

Related parts for 27220