Variable Debouncing Command
I am looking for a command in which I can use to debounce a variable.
I normally use this code when I have a button connected directly to the·prop so that the user has to press and release the button for the command to take place. Otherwise I was having problems with the command happening multiple times (if the users input was to send a serial command, it would send the command several times)
That command works great if I am using an input pin directly on the prop, but how about if I need to do the same thing with a variable? I have a object that scans multiple 74165 shift registers that have buttons connected to them. I have been using a simple waitcnt command until now, but it just doesn't work very well if the user presses buttons in a row.
Basically, the command I am looking for would be 'Wait Until input.display3 := 0. From looking in the manual it appears the WAITPNE and WAITPEQ only work on the direct pins.
Any ideas?
I normally use this code when I have a button connected directly to the·prop so that the user has to press and release the button for the command to take place. Otherwise I was having problems with the command happening multiple times (if the users input was to send a serial command, it would send the command several times)
if ina[noparse][[/noparse]21]
waitpne(|<21,|<21,0)
That command works great if I am using an input pin directly on the prop, but how about if I need to do the same thing with a variable? I have a object that scans multiple 74165 shift registers that have buttons connected to them. I have been using a simple waitcnt command until now, but it just doesn't work very well if the user presses buttons in a row.
if input.display3
waitcnt((10_000_000 + cnt))
Basically, the command I am looking for would be 'Wait Until input.display3 := 0. From looking in the manual it appears the WAITPNE and WAITPEQ only work on the direct pins.
Any ideas?

Comments
John Abshier
if (new_input == old_input) { //still the same count = 10; } else { //changed if (--count == 0) { //wait until counter expires old_input = new_input; input_changed = TRUE; count = 10; //reset counter } }...this code (in C) compares the new and old input values and will only update the old value once they have been different for 10 clock ticks. It also sets a flag (input_changed) to let the rest of the program know that it has a new value to process.