I would like to set up a simple 'menu' system at the beginning of some code to choose a Variable number.

At the moment i have a reset switch on MCLR, so i want to change that be the switch input (as the circuitry is already there) for the variable selection. I already have a switch on the INTRUPT which is used later on in the code.

So each time the button is pressed the variable counts from 1 to 10 and then back to 1 again. If there is no button push input for 5 seconds, the variable number is set (at whatever the last button push denotes) and then main code starts.

Has anybody performed a similar task and can provide an example piece of code?

Many thanks,

Steve