keypad counter
mike5321
Posts: 4
I want to count and store to eeprom the number of times each key is pressed on a 4x4 keypad. I have it working for the most part but would like some help to reduce all of the·"IF "statements. Attached is the code.
thank you
thank you
Comments
Main:
· DO
··· GOSUB KeyScan
· LOOP UNTIL (press <> 0)······················· ' wait for key press
· DEBUG "Key pressed = ", HEX key, CR··········· ' show it
· READ (key * 2), Word temp····················· '·read·current key value
· temp = temp + 1······························· ' increment
· WRITE (key * 2), Word·temp···· ··············· ' save updated count
· FOR key = 0 TO 12····························· ' show all counters
··· READ (key * 2), temp························ ' read the key count
··· DEBUG "Key ", DEC2, ": ", DEC temp, CR·······' show it
· NEXT
· GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax