View previous topic :: View next topic |
Author |
Message |
Alyn P.
Joined: 01 Aug 2011 Posts: 5 Location: U.K.
|
anyone got piezo beep beep code snippet 12f629 4 MHz clock? |
Posted: Fri Aug 05, 2011 5:34 am |
|
|
Hi,
Is there anyone who could help with giving me a short beep beep code to drive a little piezo transducer- its driving me mad! I realise it will probably need a transistor amp. Any help would be gratefully received.
I have tried devising one myself, but I concede defeat, mid-tone kind of beep beep would be fantastic. I will use it for diagnostic purposes.
Thank you. _________________ Al |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 05, 2011 1:06 pm |
|
|
This code will produce an approximately 1 KHz tone from the piezo buzzer
on the PicDem2 Plus board. You must have jumper J9 installed (this
connects pin C2 to the piezo buzzer).
Code: |
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
//==========================================
void main()
{
while(1)
{
output_high(PIN_C2);
delay_us(500);
output_low(PIN_C2);
delay_us(500);
}
}
|
The transistor driver circuit for the piezo buzzer is shown in the middle-
left side of this schematic:
http://ww1.microchip.com/downloads/en/DeviceDoc/PICDEM%202%20Plus%20RoHS.pdf |
|
|
Alyn P.
Joined: 01 Aug 2011 Posts: 5 Location: U.K.
|
|
Posted: Mon Aug 08, 2011 2:26 am |
|
|
Super, thank you very much. That's twice now you have helped out- a few beers for you if I could. Anyway, again its much appreciated.
Al _________________ Al |
|
|
|