SCPS222C May 2010 – October 2015 TCA8418E
Information in the following applications sections is not part of the TI component specification, and TI does not warrant its accuracy or completeness. TI’s customers are responsible for determining suitability of components for their purposes. Customers should validate and test their design implementation to confirm system functionality.
The TCA8418E supports multiple key presses accurately. Applications requiring three-key combinations (such as <Ctrl><Alt><Del>, or any other combinations) must ensure that the three keys are wired in appropriate key positions to avoid ghosting (or appearing like a 4th key has been pressed).
To avoid ghosting, it is best to keep 3-button combinations that will be pressed on separate rows and columns. Consider the situation with the keypad described in Figure 28
In the keypad setup in Figure 28, there is a 4x3 keypad matrix, connected to ROW0-ROW3, and COL0-COL2. All of the ROWs are configured as inputs with pullup resistors. The COLs are configured as outputs, driving low. When a key press is made, one of the ROW inputs will be pulled low, letting the TCA8418E know that a key has been pressed, and the TCA8418E will then start the key scanning algorithm. During this algorithm, It will sweep the output low across the columns, such that only 1 column is driven low at a time. While this is done to each column, the TCA8418E will read the ROW inputs, to determine which keys on a column are being pressed.
Ghosting can occur when multiple keys are pressed that can make it appear that additional keys (which are not being pressed) are being pressed.
In Figure 29, keys 1, 2, and 11 are pressed, which causes a ghosting issue. Since R1 becomes pulled to ground through key 1 (which is pulled through key 2 when C1 is transmitting a low), when C1 is driving low, the TCA8418E will see a low signal at both R0 and R1. This will falsely trigger key 12 as being pressed (the key highlighted as yellow).
The reason for this is that keypad matrices will short the columns to the rows connected together. When C1 is driving low, the low gets transmitted onto R0 via key 2. Key 1 is being pressed, which also shorts C0 to ground. Key 11 is pressed, which then shorts R1 to C0. In this process, R1 is shorted to C1, which is the reason ghosting occurs.
Keypad matrices can support multiple key presses properly, if care is taken when choosing the layout. In Figure 30, we see a 3 button combination which will work as expected. Keys 1, 11, and 21 are pressed (this also is the combination that will set the <Ctrl><Alt><Del> interrupt, see Control-Alt-Delete Support for more information).
Figure 31 shows a typical application of the TCA8418E. In this specific example, a common 12 key number pad layout is used. This number pad has keys for numbers 0 to 9, *, and #.
The system designer needs to know a few key pieces in order to design their system for the TCA8418E.
The first steps towards designing a keypad array is to determine the desired layout, and to map each key to the appropriate value which will show up in the FIFO. For this example, the number pad below is the physical location of the keys that are desired. The layout is a 4 x 3 array, using rows 0-3 and columns 0-2. For this example, we will not assume any of the other pins will be used.
The following behavior is desired for this example design
Since the TCA8418E will report keys pressed according to the values in the key value table, it will be important to know what the TCA8418E’s values for these key locations are.
According to the key event table, the key presses are assigned in the following way:
|Key Event Table Value (Decimal)||1||2||3||11||12||13||21||22||23||31||32||33|
The schematic for this keypad layout is shown in Figure 33, with the key event table values. Note that no external pullup resistors are needed, because the TCA8418E has integrated pullup resistors.
The next step to design a keypad array for the TCA8418E is to configure the appropriate hardware registers.
The registers that will need to be modified for the desired features are the following:
|STEP||REGISTER TO EDIT||VALUE TO WRITE||DESCRIPTION|
|Setup keypad array||KP_GPIO1 (0x1D)||0x0F||Set ROW0-ROW3 to KP Matrix|
|KP_GPIO2 (0x1E)||0x07||Set COL0-COL2 to KP Matrix|
|KP_GPIO3 (0x1F)||0x00||Set COL8-COL9 to GPIO|
|Setup Interrupts||CFG (0x01)||0x95||Set the KE_IEN, K_LCK_IEN, INT_CFG, and AI bits|
|Setup Unlock Key Combination||UNLOCK1 (0x0F)||0x21||Set first unlock key to key 33|
|UNLOCK2 (0x10)||0x01||Set second unlock key to key 1|
|Set Keypad Lock Timers||KP_LCK_TIMER (0x0E)||0x52||Lock1 to Lock2 set to 2 seconds. Interrupt mask timer set to 10 seconds|