I am using a 40X1 and a 3x4 Matrix Keypad. I need to debounce the return values.
I have had success debouncing single input buttons but not a matrix configuration.
here is part of the code:
<code><pre><font size=2 face='Courier'>
Keyscan:
let key_value = 9
high portc 4
gosub key_test
low portc 4
if key_value<>9 then process
let key_value = 6
high portc 5
gosub key_test
low portc 5
if key_value<>6 then process
let key_value = 3
high portc 6
gosub key_test
low portc 6
if key_value<>3 then process
let key_value = 0
high portc 7
gosub key_test
low portc 7
if key_value<>0 then process
Process:
if key_value<>0 then
sertxd (#Key_Value,13,10)
endif
return
Key_test:
if pin1 = 1 then let Key_value=key_value+1 endif
if pin2 = 1 then let Key_value=key_value+2 endif
if pin3 = 1 then let Key_value=key_value+3 endif
return
</font></pre></code>
I have had success debouncing single input buttons but not a matrix configuration.
here is part of the code:
<code><pre><font size=2 face='Courier'>
Keyscan:
let key_value = 9
high portc 4
gosub key_test
low portc 4
if key_value<>9 then process
let key_value = 6
high portc 5
gosub key_test
low portc 5
if key_value<>6 then process
let key_value = 3
high portc 6
gosub key_test
low portc 6
if key_value<>3 then process
let key_value = 0
high portc 7
gosub key_test
low portc 7
if key_value<>0 then process
Process:
if key_value<>0 then
sertxd (#Key_Value,13,10)
endif
return
Key_test:
if pin1 = 1 then let Key_value=key_value+1 endif
if pin2 = 1 then let Key_value=key_value+2 endif
if pin3 = 1 then let Key_value=key_value+3 endif
return
</font></pre></code>