wijnendael
Member
Looks like i have run into another problem, i am attempting to display the results of keypad presses on the display but just get lots of garbage. My test is some code taken from Ron Hacketts book the evil genius for the keypad interface where i have made the circuit for using the keypad on the adc input and checking with a mm when keys are pressed appears to function ok how ever i cannot get the oled display to show the key presses to see what readaings i get for each key press. A copy of his code is here with my attempt to get it to show on the display, am i doing this wrong ? i have commented out the send to terminal.
Code:
' Program uses an ADC approach to decoding a 4X4 matrix keypad.
' It sends the keypress ADC key value to the terminal window.
' === Variables ===
symbol key = w0 ' used in adc10; word variable is required
symbol junk = b2 ' throwaway variable used for debouncing
' === Directives ===
#com 3 ' specify serial port
#picaxe 08M2 ' specify processor
#terminal 9600 ' open terminal (8MHz produces 9600 BAUD)
' ==================== Begin Main Program =====================
setfreq m8
dirsC = %00010011
' as fast as possible
do
wait_for_keypress:
readadc c.2, junk
if junk < 5 then wait_for_keypress
pause 100 ' debounce keypress
readadc10 c.2, key 'get ADC value
wait_for_release:
readadc c.2, junk
if junk > 5 then wait_for_release
;sertxd ("key = ",#key,cr,lf) ' send ADC value to terminal
serout 0, n2400, (254,1)
pause 30
serout 0, n2400, (w0,cr,lf)
loop