TIMER0 isr loop problem in atmel

Status
Not open for further replies.

selva murugesan

Advanced Member level 4
Joined
Mar 30, 2012
Messages
116
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Visit site
Activity points
2,007
hi every one,


i am doing one my project based on timers in atmega 8. it properly working for some duration after that , the whole microcontroller process stand still,please give suggestion on that, i am using proteus simulation software
 

As always the best thing is to post the code when asking about a micro-controller code related problem.
 

ok

i post just ISR of timer0
Code:
interrupt [TIM0_OVF] void timer0_ovf_isr(void)              //counting the seconds  
{  

    if (TIMER_start_flag == 0x01)
    {
        count++;
        led_flag = 0X01;
        
              
        if (count >= 5)                                 //note:>= must, EVERY 1 SEC
        {
            count = 0x00; 

            count_sec++;
                
            if (count_sec >= 60)
            {
                count_sec = 0x00;
                    
                count_min--;                                             

                if (count_min == 0xFF)                          
                {
                    if (count_hour == 0x00)
                    {   
                        count_hour = 0x00;
                        count_min = 0x00;   
                    }
                    else
                    {
                        count_min = 59;                         //59
                        count_hour--;                          //00                              
                    }
                }
                
                if ((!count_hour) && (!count_min))
                {
                    TIMER_start_flag = 0x00;                    //make zero to all ten bit and send it
                    TIMER_stop_flag  = 0x01; 
                    led_flag = 0x00;
                    T_OK_flag = 0x00;
                    BUZZER_ON();
                    delay_ms(1000);
                    BUZZER_OFF();                    
                }             
                
            } 
            
        }
    } 
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…