Hello !

I need a code example that calculate how much time a push-button is keeping pressed and the time elapsed between it was pressed and released.

I want to make a single push-button a multi-purpose entry system, as like the system used in the Cel phones (one key to ABC, another to DEF, etc...)

Since I use most the 12F675 in the projects because I need a small pcb, I end have only one input available and I don't want to use a PIC of more than 8 pins.

I created a RGB controller with LCD and need to complete the system only this type of timing, bellow is how I made it:

GP0-1......... 2 Wire LCD controller
GP2-4-5...... PWM for the RGB leds
GP3............ Input

Actually I'm using the GP3 as a input to change the Pattern selection of the controller. But I need to change also the Speed, but using the same input.

Let's say if keeping the input low (pressed) for 500ms then I can use it to change speed, if less then 500ms then is a single push and I can use it to change the pattern.

I somebody knows how to handle this with a code. It can be in any language, I use JAL, but any code will help me.

Thanks a lot!