Hiya,
For Christmas this year, I created a little board which causes lights to
flash on a "Frosty the Snowman" for presents and which also plays the song.
I used an 'C84 running at 1MHz. The sound generator uses an interrupt
handler which processes interrupts from the Prescaler and Timer.
The Interrupt Handler is table driven and consists of the frequency (ie the
Timer Counter) and duration (how many times the interrupt handler is
executed for this frequency). The tune plays over and over (great for
relatives you *don't* like) waiting until a count of '\0' is encountered and
then goes back to the start of the table.
Hardware wise, an output pin is driving (in series) a 0.47uF cap, a switch,
and a Piezo-Speaker attached to Vcc. To simplify tune development, I
created a couple of quick and dirty "C" programs for DOS which figure out
what are the frequencies for each of the notes and durations for different
lengths of notes.
The software is really optimized for this type of tune, there is no
capability to put in different volumes and pauses in the sound (Like I said,
great for relatives you *don't* like).
If you're interested, let me know and I'll send you a copy of the code,
Myke
{Quote hidden}>I have a project with pic 16c84.
>I need to connect a sound speaker to the pic and use that to produce sound.
>I'm using a 4MHz crystal.
>The sound should be like the sound of a PC car racing game, with=
> acceleration.
>(Or in that category)
>
>Any ideas/suggestions would be appreciated.
>Halldor Festv=E5g Utne
>N-5774 Lofthus
>Norway
>
>Tel. :+47 53661286
>Fax. :+47 53661465
>Email:
.....HalldorKILLspam
@spam@sn.no
>Hpage:
http://www.sn.no/~halldor/
>
>