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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/21/15 08:30
Read: times


 
#190488 - P1TempState init and update
Responding to: ???'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            01/01/70 00:00      
   I guess            01/01/70 00:00      
      Yes it is enabled in MAIN. Though not shown !             01/01/70 00:00      
   unsigned < 0            01/01/70 00:00      
      :^)            01/01/70 00:00      
   P1TempState init and update            01/01/70 00:00      
      Sorry about the delay...            01/01/70 00:00      
         the code you mentioned is from a very old thread from 8052.c            01/01/70 00:00      
            Thanks to you and Michael Karas !!             01/01/70 00:00      
               You are welcome!!            01/01/70 00:00      
                  Old Stuff            01/01/70 00:00      

Back to Subject List