PIC16F628A frequency generator?

Discussion in 'Embedded Systems and Microcontrollers' started by iflymyhelishigh, Mar 4, 2009.

  1. iflymyhelishigh

    Thread Starter New Member

    Jan 30, 2009
    Hello. I have been working with PICs. I am wondering if there is a way to output a frequency through a pin to a piezo buzzer. I want to make it beep 3 times. Thank you
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    Microchip and SourceBoost have examples using the PWM Module on the PIC Controller in the PicDem 2+ board, assembly from Microchip, C from Sourceboost. Both of the above are free for download and use, size limitations on Free BoostC.

    The sound can also be made with delays in software if your IC doesn't have an unused PWM module. To make a beep without PWM, turn the piezo on for roughly 250uS, then off for roughly 250 uS, repeat that 500 times for a single, roughly half second tone.

    Changing delays/ratio (pulse width) is encouraged up or down for preferred sound with your particular piezo size.