BGAmodz
Member
Hi all .
I don't know whats wrong with my program , it is for a simple led blinking with a delay of 5 seconds .
The led turns on after 5 seconds but wont turn off after another delay .
This is the program script :
I don't know whats wrong with my program , it is for a simple led blinking with a delay of 5 seconds .
The led turns on after 5 seconds but wont turn off after another delay .
This is the program script :
Code:
int time = 0;
void interrupt () {
if (TMR1IF_bit ) {
TMR1H = 0x0B ;
TMR1L = 0xDB ;
time++ ;
}
PIR1.TMR1IF = 0;
}
void main() {
T1CON = 0x39 ;
INTCON = 0xC0 ;
TMR1IE_bit = 1 ;
TMR1IF_bit = 0 ;
TMR1H = 0x0B ;
TMR1L = 0xDB ;
TRISA = 0x00 ;
PORTA = 0 ;
while(1) {
if ( time == 10) {
porta = ~porta ;
time=0;
}
}
}