Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Konstantinos L. Angelis
05/21/15 02:30
Read: 802 times
Lamia
Greece


 
#190488 - P1TempState init and update
Responding to: Raghunathan's previous message
1. where is the P1TempState definition/declarartion/initialisation ?
2. how the P1TempState is updated inside Timer0_ISR ?
3. where is the P1FinalState definition/declarartion/initialisation ?
4. this part
  
// T0 is set for 10ms interval generation. Used for Switch Debounce 
void Timer0_ISR(void) interrupt 1 using 0      // Basic 10ms interrupt for the program
{
  static unsigned char debounce_count = 3; 
  TR0     = 0;                                 // Stop T0 timer
  TL0     = (65535UL-18518UL);                 // Load  TMR0 registers (18518 x 0.54us = 10ms)
  TH0     = (65535UL-18518UL) >> 8;
  TR0     = 1;                                 // ISR over. Start T0
	 
  if ( P1TempState == P1  )
    {
      --debounce_count;                        // If Current State of P1 is same as previous, dec, counter  
      if ( debounce_count == 0)
	{
	  P1FinalState = P1TempState;          // State of P1 has been same for 30ms, so valid.   
	  debounce_count = 3 ; 
	}			
    }
  else
   {
     debounce_count = 3;                       // Current state of P1 not equal to previous. Reset counter.
     P1TempState = P1;
   }	    			
	
  ////TR0     = 1;                                 // ISR over. Start T0
	
}	     

 

should be running
...





List of 11 messages in thread
TopicAuthorDate
Timer 0 ISR for Switch Debounce      Raghunathan      05/17/15 05:52      
   I guess      Erik Malund      05/18/15 05:59      
      Yes it is enabled in MAIN. Though not shown !       Raghunathan      05/18/15 08:42      
   unsigned < 0      Maarten Brock      05/19/15 11:39      
      :^)      Michael Karas      05/19/15 12:41      
   P1TempState init and update      KONSTANTINOS L. ANGELIS      05/21/15 02:30      
      Sorry about the delay...      Raghunathan      06/01/15 22:20      
         the code you mentioned is from a very old thread from 8052.c      KONSTANTINOS L. ANGELIS      06/02/15 00:41      
            Thanks to you and Michael Karas !!       Raghunathan      06/02/15 05:01      
               You are welcome!!      Michael Karas      06/02/15 11:51      
                  Old Stuff      Michael Karas      06/05/15 03:45      

Back to Subject List