void interrupt ()
{
if (TMRF1_bit==1 && PORTC.B1 ==1)
{
LATC.B4 = ~ LATC.B4;
}
else if (TMRF1_bit==1 && PORTC.B2 ==1)
{
LATC.B4 = ~ LATC.B4;
}
else if (TMRF1_bit==1 && PORTC.B3 ==1)
{
LATC.B4 = ~ LATC.B4;
}
else
{TMR1ON_bit==0;}
TMR1IF_bit==0;
TMR1H=0;TMR1F=0
}
void main()
{
// disable analog pins if microcontroller has
// set timer in 16 bit mode using T1CON register
// enable interrupts by setting INTCON register
// set pins (PORTC.B1 , B2, B3) as input
// set pins PORTC.B4 as output
//
do
{
if(PORTB.B1==1)
{
TMR1H =0; TMR1L=0; // put any other value as per your freq requirement
TMR1ON_bit=1;
}
else if(PORTB.B2==1) // put any other value as per your freq requirement
{
TMR1H =0; TMR1L=0xFF;
TMR1ON_bit=1;
}
else if(PORTB.B3==1)
{
TMR1H =0xFF; TMR1L=0; // put any other value as per your freq requirement
TMR1ON_bit=1;
}
else
TMR1ON_bit=0;
}