In order for this circuit to function the first four IO lines of the PCF8574 (P0-P3) are used as outputs and the second four (P4-P7) are inputs. As stated earlier to do this a logic 1 must be written to P4-P7 and a logic 0 must be sent to P0-P3. (iomask = &B11110000)
Without the load provided by R5-R8 the outputs of P4-P7 would go into a hi logic state, however with these in place a logic 0 is present on the all 4 lines.
Next to check ROW 0 for a key press the first output of PCF8574 (P0) must be switched on(Row0 = &B00000001) while maintaining the IO arrangement of the device. This is achieved by sending the iomask patten(&B11110000)combined with the Row0 pattern(&B00000001) to the device (&B11110001).
If this is done Row 0 will be in a logic 1 state and Rows 2-4 will be at logic 0 at the same time because of R5-R7, P4-P7 will also be in a low logic state.
If however any of the keys on Row 0 are pressed during this time, the current provided by output P0 and R1 will make its way down to one of the column inputs P4-P7 depending on the which of the keys being pressed.
This is shown graphically below where the keys 1,2,3 or A corresponding to an input on P4,P5,P6 or P7. The process is then repeated for all the other rows in order to check for a pressed key.
To make decoding easier weighting is applied to each of the energised rows and the activated columns, for example if 9 is pressed P2 with a weighting of 8 and P6 with a weighting of 3 will both be activated at the same time. If these are added together 8+3 = 11 the 11th entry of a lookup table can be used to hold the corresponding key value. This system is used in the example MicroMite program described later.
Within the design 3 links are also provided in order to select the address of the I2C keyboard upon the bus. The design uses an PCF8574 which, according to the data sheet, with the AO link made should respond to an address of H&21.
The I2C bus connection, with the exception on the INT output has been made the same as the I2C bus of LCD converter mentioned above to make connection easier.
Finally for this design a supply of 5V has been used in which a 100nf capacitor is used for suppression, as I am using this with a MicroMite controller the bus is 5V tolerant so this should not pose a problem in the long term. As it stands however I am not sure if this would be a problem anyway as the design dose not have any local pull ups to the +5V rail, instead pull ups are only present on the MicroMite board to the local 3.3V supply.