At 07:25 AM 25/03/1997 +0100, you wrote: >I am searching for a routine that could decide between a single press on >a switch and a long press on a switch (more than 500ms or 1s). I'd make one suggestion here. Set up your algo. in such a way that you accept the single press as an action that occurs between the debounce period (50-100ms) and your long press. There is nothing more frustrating to an equipment user than to have the action occur after the button is released. In your example an operator would feel frustrated if they pressed the button down for 400ms and nothing happened but if they pressed for 401ms it did. From an ergonometric prespective users prefer the act of pressing the button to cause an action rather than releasing the button. If the button is used for two totally opposite things you may find this difficult to impliment. Try adding feedback at the moment the debounce period is complete but before you make a choice on button action. An operator, who hears a beep or sees a LED blink, and just wants the short press, will then release the key at which time you could invoke the action. John Pioneers are the ones, face down in the mud, with arrows in their backs. Automation Artisans Inc. Ph. 1-250-544-4950 PO Box 20002 Fax 1-250-544-4954 Sidney, BC CANADA V8L 5C9