how can use temp_seconds

Status
Not open for further replies.

sahu

Member
i can't understand ,how can use temp_seconds in TIMER1_isr ?
now i'm use like this ------
Code:
/************************************************/***************************************************************************** 
   Timer1 Interrupt, executed every 10 ms 
  ****************************************************************************/ 
 #INT_TIMER1 
 void TIMER1_isr(void) 
 { 
    // Increment time_elasped to keep track of ms 
    time_elasped++; 
    // Increment seconds variable if 1000 ms have passed 
     
    if (time_elasped == 100)  // @ 1000 ms 
    { 
         seconds++; 
         time_elasped = 0; 
       
    } 
    if (seconds != temp_seconds) // now (ch_3>=950) 
       { 
          odd_or_even = seconds % 2; 
          // Even?  Yes 
          if (odd_or_even == 0) 
             output_high(L3); 
          else 
             output_low(L3); 
       } 
       if (seconds != seconds) // now (ch_3<950) 
       { 
             output_low(L3); 
       } 
    //Reset Timer 1 
    set_timer1(60545); 
    clear_interrupt(INT_TIMER1);    
 } 
 /*************************************************************************** 
  Reads Form AN3 ADC_Value for lod sence 
 ****************************************************************************/ 
 void Process_ch_3(void) 
 { 
       if (ch_3<950) 
 { 
       over_lod_flag = off; 
       ol_counter_flag = off; 
       seconds=seconds; 
 } 
       if (ch_3>=950) 
 { 
       seconds=temp_seconds; 
       BlinkLED2(); 
      lcd_putc("\fOVER SENCE PLASE\n"); 
      lcd_putc(" REDUCE LOAD");  // 
    delay_ms(500); 
 } 
      if ( rest_sec=BLINK_SEC - temp_seconds); 
 { 
       ol_counter_flag =on; 
       rest_sec--; 
       lcd_gotoxy(1,1); 
       printf ( lcd_putc,"\fSECONDS LEFT %lu ",rest_sec); 
       lcd_gotoxy(1,2); 
       printf ( lcd_putc,"FOR OUTPUT CUT"); 
    delay_ms(500); 
 } 

 }


but temp_seconds sec not working.
i want if (ch_3>=950) ,then temp_seconds work .but it work every time [if (ch_3>=950) or if (ch_3<950) ].
pl help me ...
using 4 MHz xtal .CCS c \pic16f72
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…