I haven't seen the electronics magazine article on 1 pin keypad, but here is my answer to Ashley Barnett on basically similiar topic. I have a working version of this on a proof of concept PCB that handles I.R. coms, 128k bit EEprom(I2C), async serial, 4-bit LCD, piezo drive. Using a 16C74 this leaves: 7 spare analog inputs, 9 digital I/O. I designed it to run with a DS1307Z SMD I2C Real Time Clock also except no DS1307Z from my supplier in 10 months G.Daniel Invent Design wrote: > > ashley barnett wrote: > > > > Keypad Scanning Question, help reqd. > > > > I have a 3x4 keypad connected to portB of a pic16c74 and written the basic c ode > > which will jump to the interrupt vector whenever any key is pressed. I then will > > read portB and move the value to another register. thats the code so far, > > > > What I want to do are the following. > > > > a) discover which key was pressed > > b) use each key to call a different subroutine > > > > My problem is how to implement the key descrimination as there is no compare > > command > ???????? > movlw test_value1 > subwf portb,w > bz test_value1_code > the above is a very simple structure that you can repeat for each key, > you can compact by reading test values out of a table read. > > , I think I need to XORLW ? but what then etc, > > I also need to implement a table read, don't I ? > > > > Any help and direction appreciated > > > > Email to - ashsparky@clara.net - thanx for your time > > That's a lota pins tied up with your keypad, are you sure you don't have > a spare A2D pin ? ; use it to measure a value from keypad as follows: > > +5---------1---2---3 each key will give > | | | | a different value. > [1k] | | | > | | | | by testing values, > ------4---5---6 you can determine > | | | | key thresholds & > [1k] | | | then perform a > | | | | computed jump. > ------7---8---9 > | | | | these computed jump locations > [1k] | | | can have GOTO hash,GOTO star,GOTO zero etc. > | | | | > ------*---0---# > | | | > [5k][5k][5k] > PICpin_____|___|___| > | > [1k] > 0volts_________|