Generating tones using pic16f877

Discussion in 'Embedded Systems and Microcontrollers' started by jt21, May 14, 2010.

  1. jt21

    Thread Starter New Member

    Oct 10, 2009
    7
    0
    Hi all,

    May I know how do I generate different tones on a buzzer using PIC16F877?
    Is it necessary to use the PWN registers or CCP registers? I'm totally clueless here as this is the first time I'm doing it. Also the language to be written in is C.

    Thanks for viewing.
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You can use the PWM. By changing the duty cycle you will control the loudness and by changing the frequency you will change the tone sound.
     
  3. jt21

    Thread Starter New Member

    Oct 10, 2009
    7
    0
    Erm how do I change the frequency and what does CCPR1L and CCP1CON<5:4> means?
     
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Which C compiler are you using?
     
  5. jt21

    Thread Starter New Member

    Oct 10, 2009
    7
    0
    IAR Embedded Workbench
     
  6. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    I am not familiar with this one. Regarding the registers you mentioned before you can find their use in the datasheet.
     
  7. jt21

    Thread Starter New Member

    Oct 10, 2009
    7
    0
    Ok thanks for your help.
     
Loading...