desmond1310
Member level 1
To the moderator: Please don't delete my thread. I'm sorry if this is a repeat, but here's how my problem is about:
I've been trying to use Timer1 interrupt as a timer where before reaching 6 sec, it should display 'Drying in Process', and after 6 sec, it should display 'Drying is Complete!'
Problem is after i programmed my PIC with my codes below (incomplete, but they are the most key of my program), it will only display a line of blank boxes. I cross referenced with a few programs, and i get the feeling mine should be working fine, but it's not :\
Can anyone point out my mistake(s)? Sorry for a long post.
Setup Timer1 (i placed this to initialize in my main() function)
ISR
Application section
I've been trying to use Timer1 interrupt as a timer where before reaching 6 sec, it should display 'Drying in Process', and after 6 sec, it should display 'Drying is Complete!'
Problem is after i programmed my PIC with my codes below (incomplete, but they are the most key of my program), it will only display a line of blank boxes. I cross referenced with a few programs, and i get the feeling mine should be working fine, but it's not :\
Can anyone point out my mistake(s)? Sorry for a long post.
Setup Timer1 (i placed this to initialize in my main() function)
Code:
void init_timer1(void)
{
T1CKPS1 = 1;
T1CKPS0 = 1;
T1OSCEN = 1; //Prescaler of 1:8
T1SYNC = 1;
TMR1CS = 0;
TMR1H = 11;
TMR1L = 219; //Period of 0.1 secs
TMR1IE = 1;
PEIE = 1;
GIE = 1;
TMR1ON = 1;
while (1);
}
ISR
Code:
void interrupt ISR(void)
{
if(TMR1IE && TMR1IF)
{
//TMR0 Overflow ISR
varinc++; //Increment Over Flow Counter
if(varinc==10)
{
counter++;
varinc = 0;
}
//Clear Flag
TMR0IF=0;
}
}
Application section
Code:
void sixseconds(void)
{
if(counter<6)
{
lcd_clr();
lcd_goto(0) ;
send_string("Drying In ");
lcd_goto(20);
send_string("Process. ");
}
else if (counter==6)
{
counter = 0;
lcd_clr() ;
lcd_goto(0) ;
send_string("Drying Is ");
lcd_goto(20);
send_string("Complete! ");
}
}