I've got a question. Have any of you guys ever used TTL / PWM to make music tones from a micro?
I've recently added a 8w amp to my drumbot:
And am trying to make musical notes from driving the amp with TTL logic.
I'm using bascom basic, and the "sound" command as shown below.
My problem is that as I understand sound. We hear from 20 hz to 20 khz.
So I've tried setting the pulses at various levels between 20 and 20k, as well as tried various durations.
When I use 1000, and 1000, as well as 65535, and 10000 I get decent tones.
With small changes to these settings, they sound the same. And any other values I get horrible fax modem noises.
I also tried making my own loops to drive the amp with frequencys in this range. But the output is the same.
So now I'm thinking I might need to make an DAC circuit to properly get (at least) 8 bit sound from this setup.
Thanks for any advise.
Dim Pulses As Word , Periods As Word
Pulses = 65535 : Periods = 10000 'set variables
Speaker Alias Portb.1 'define port pin
Sound Speaker , Pulses , Periods 'make some noise
'periods/pulses range from 1-65535