PDA

View Full Version : 30hz sound



Kmt
- 29th June 2004, 21:41
I need som help too make a 30 hz sound wwith a PIC12F675

Thanks
Kent

Melanie
- 30th June 2004, 08:49
FREQOUT is the obvious choice, but it won't work with the 12 series PIC's. So you have to generate the tone manually by switching a pin on/off...

The Period time of 30Hz is 33.333mS (1/freq).

That means your ON time is 16.666mS and your OFF time is 16.666mS (16.666+16.666=33.333mS).

Knowing that, and the blink.bas example in the PBP manual, are you able to carry forward the changes needed or are you still stuck?

Naturally you no longer have an LED connected, but a Speaker or Sounder to the relevant pin. Note, don't connect a low ohmage speaker directly to the pin, but via a Capacitor (eg 1uF).

Now the 12F is a little tricky to start playing with if you have never met it before. So I've appended a program for you to play with, however, before downloading it, I would ask you to try modifying blink.bas for your 12F675 first. You learn more by doing yourself rather than by copying someone elses's code.

Finally, if you do download my program, I refer you to the PIC's Datasheet to cross-check the settings of TRISIO, ANSEL and CMCON. Look in the "Special Features of the CPU" section to work out the device programming definitions that I've used.

Melanie