CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

anyone got piezo beep beep code snippet 12f629 4 MHz clock?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Alyn P.



Joined: 01 Aug 2011
Posts: 5
Location: U.K.

View user's profile Send private message

anyone got piezo beep beep code snippet 12f629 4 MHz clock?
PostPosted: Fri Aug 05, 2011 5:34 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 05, 2011 1:06 pm     Reply with quote

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.

View user's profile Send private message

PostPosted: Mon Aug 08, 2011 2:26 am     Reply with quote

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 Very Happy
_________________
Al
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group