Shop OBEX P1 Docs P2 Docs Learn Events
Pulse-density modulation PDM — Parallax Forums

Pulse-density modulation PDM

tonyp12tonyp12 Posts: 1,951
edited 2011-03-20 12:46 in Propeller 1
Audio 1bit DACs uses this technique.
As it's very simple to create an analog signal by avaraging the bits sent with a low-pass filter.

To create a 50% voltage value you would send 01010101
And a 25% you would send 00100100

I guess you could create a 255 long table if you are using 8 bit.
But when going with 16 bit that would not be an option.

I was thinking if you to is the same way a prop counter does in duty mode.
send a 1 when the value rolles over.
(innerloop)

mov buffer,myaudio      '16+16bit L/R wave audio
and buffer,_#$FFFF0000  'keep left audio
mov counter,_#$FFFF     'run the loop 65'535 times (not practical, use 12bits?)
loop:
add buffer2,buffer wc
muxc outa,#serpin
dbnz counter,#loop 

I'n on the right track?

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-20 12:40
    Yup, that's the way DUTY mode works. 'No need for a program to do it.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2011-03-20 12:46
    As I have to send both left and right channel on the same pin inside a 3mhz clk signal
    clk low> right channel bit, clk high> left channel bit

    It probably would be harder to use 3 counters than to bit banging it with my own code.
Sign In or Register to comment.