#include <pic.h>
__CONFIG(0xFF32);
void interrupt ISR(void) ;
unsigned char microSec = 0;
void main(void)
{
PSA = 1;
PS2 = 0;
PS1 = 1;
PS0 = 1;
T0CS = 0;
TMR0 = 0;
GIE = 1;
T0IE = 1;
PORTD = 0x00;
TRISD = 0xfe;
while(1){}
}
void interrupt ISR(void)
{
if(T0IE && T0IF)
{
T0IF = 0;
microSec++;
if(microSec=500)
{
microSec = 0;
PORTD = ~PORTD;
}
}
} |