Dear Friends,
I am working on TImer 2 of PIC16F877.
Code is given below.
But this code is not working.
Can anybody suggest what may be the problem???
I am working on TImer 2 of PIC16F877.
Code is given below.
Rich (BB code):
void main()
{
TRISB0 = 0;
RB0 = 0;
inittimer2();
while(1)
{
}
}
void inittimer2(void)
{
TMR2 = 0x00;
T2CON = 0x75; // Prescaler 4, Postscaler
TMR2IF = 0;
TMR2IE = 1;
PR2 = 0xFF;
}
void interrupt ISR(void)
{
if(TMR2IF)
{
RB0=~RB0;
TMR2IF=0;
}
}
Can anybody suggest what may be the problem???
Last edited by a moderator: