Hi, I am trying to toggle an led using the rollover of timer0 but nothings happening. I have added the code I have used.
Code:
#include <pic16f1939.h>
#include <xc.h>
#define _XTAL_FREQ 500000 //1ms delay
void interrupt delay(void);
void main()
{
ANSELA=0;
TRISA=0;
PORTA=0;
OPTION_REG = 0b10001000; //WPU's disabled No Prescaler
INTCONbits.GIE = 1;
INTCONbits.PEIE = 1;
while(1)
{
;
}
}
void interrupt delay()
{
TMR0 = 0x00;
INTCONbits.TMR0IF = 0;
INTCONbits.TMR0IE = 1;
while(!INTCONbits.TMR0IF)
{
PORTAbits.RA0 = !PORTAbits.RA0;
INTCONbits.TMR0IE = 0;
}
}