hi, i m trying to interrupt timer on specific time but its doing randomly please help me out.
#include <htc.h>
unsigned char vary,count=10;
#define _XTAL_FREQ 4000000
void main()
{
TRISD=0b00000000;
//PORTD=0b00000000;
GIE=1;
T0IE=1;
TMR0=0;
PSA=0;
T0CS=0;
PS0=1;
PS1=1;
PS2=0;
T0SE=1;
while (1)
{
PORTD=0b00000000;
}
}
static void interrupt isr()
{
if (T0IF == 1)
{
GIE=0;
T0IF=0;
vary++;
if (vary=1)
{
PORTD= 0b11111111;
}
vary=0;
GIE=1;
T0IE=1;
}
}