Keypad is an array of 4x4 keys with each key being a switch. The four rows are connected to pins 0-3 of Port1 and the four columns to pins 4-7 of Port1 as shown in the figure below. Each column is also connected to supply voltage through a pull up resistor (around 1k Ohms). To read a particular key, the corresponding row is driven to '0'. In a key is pressed and the corresponding row is driven '0' then current flows through the corresponding pull up resistor and the corresponding column reads '0'. Otherwise the corresponding column reads '1' (open circuit). For example if Key 5 is pressed - |