|
Another interesting application for the Propeller is 1-bit DAC (digital
to analog conversion) using delta modulation. This is made possible by the high
clock speed.
|
1-bit delta modulation uses a single Prop pin
connected to an external capacitor through an external resistor.
The duty cycle of the Prop pin is varied to set the voltage on the
capacitor. The external capacitor and resistor basically filter
out the high frequency output of the Prop pin, leaving just the DC
level. |
|
The Demo Board already has the resistor and capacitors for 2
channels of DAC for stereo audio. There are a few programs in
Object Exchange that generate audio using this method. |
|
|
|
|
|
|
|
Here's an assembly version that can
play stereo, 16-bit PCM wav files up to 48 ksps |
|
Note: Wave players posted to OBEX. |
|
Note: There's a newer assembly version posted in the forum
that uses a newer FSRW... |
|
|
You need to connect an RC filter the output of the DAC pin.
|
This gets rid of the high frequency modulation, leaving just the DC
or low frequency component. |
|
Here's a partial schematic of the demo board showing the 10k
resistors and 10nF capacitors used as the output filter. The
10uF capacitor then blocks the DC level and passes audio frequencies on
to the
MAX4411 headphone audio amplifier.
|
|
|
I could be wrong, but I think the cutoff frequency of this RC filter
is too low... I might try lowering the resistance... |
|
|
If you don't have the demo board, but have powered speakers (or a
computer or sound system with "Line In" input), all you need is a
resistor and a capacitor to get sound.
|
I used a 1k-Ohm resistor and a 0.1 uF cap like this:
|
|
|
|
I tested this with both the "Line In" connection on my computer and
with the audio input of the Parallax 2.5" LCD display and it works OK.
|
|
These are probably not ideal values (just what I had lying around).
One should probably add a DC blocking capacitor to keep DC off the audio
output (like the demo circuit above has). |
|
|