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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/08/09 15:39
Read: times


 
#171517 - To check debounce
Responding to: ???'s previous message
This is what i did. have not check it yet on my hardware.

'st_stop_press_count' is a long int. I have used it to count. there are 4 buttons including this that have the same kind of loop. Debounce has a value of 500. if the button is pressed and the value of 'st_stop_press_count' reaches 500 the button loop is executed


if(st_stop == 1)
 {
 st_stop_press_count++;
 if(st_stop == 1 && st_stop_press_count == debounce)
      {
 	  if(cycle_run == 1)//this means machine was already running
	      {
 	      st_stop_press_count == 0;
		  machine_stop_function();
		  }
	  else if(cycle_run == 0)//this means that the machine was stopped earlier
	  	  {
 	      st_stop_press_count == 0;
 	      machine_run_function();
	      }
	  }
 }

 



About the mode issue. What i have decided to do is that when the operator presses the mode button he will have 2 seconds after that to make the adjustments using the available 3 sets of 'up/'down' buttons

List of 15 messages in thread
TopicAuthorDate
one key, multiple jobs assigned to it            01/01/70 00:00      
   Step by step            01/01/70 00:00      
      What methods do you have for keeping track of time now?            01/01/70 00:00      
         Timing in Siemens ;)?            01/01/70 00:00      
            RC circuit            01/01/70 00:00      
               Yep, touché!...            01/01/70 00:00      
   Another idea...            01/01/70 00:00      
   State machine            01/01/70 00:00      
      State Transition Diagram            01/01/70 00:00      
   Timers can help!!            01/01/70 00:00      
      In theory, zero timers are needed            01/01/70 00:00      
   "I do not have any timer interrupts left."            01/01/70 00:00      
      Software timers            01/01/70 00:00      
   To check debounce            01/01/70 00:00      
      what happens when            01/01/70 00:00      

Back to Subject List