PIC interrupts ? [ for PIC16f690 ]

Help
Python
2010-04-03
2013-03-12
  • Python
    Python
    2010-04-03

    Hello , I use sdcc. I want to drive a speaker with it with software pwm. I like to use interrupts to drive the pwm , but I cant get the interrupts to work. I  need to know the interrupt number that is required for timer0 overflowing. Can anyone help me out in finding the address or whatever is  required for the interrupt ?

     

  • Anonymous
    2012-04-28

    That'd be interupt 0. SDCC requires setting it to that value even if there's only one interrupt availale. On PIC14 the correct declaration for the interrupt handler would be:

    static void irqHandler(void) __interrupt 0 {
        if (T0IF) { // Not really necessary, but nice to check anyway
            /*** Your IRQ code goes here ***/
            // Clear timer interrupt bit
            T0IF = 0;
        }
    }
    

    Regards