The MAX6954/MAX6955 are 4-wire and 2-wire serial-interfaced LED drivers that control up to 7-segment, 14-segment, and 16-segment LED digits or an array of 16x8 LEDs. The driver also includes five I/O expander (GPIO) ports, and logic for using some or all of these ports to automatically scan and debounce up to 32 key switches. An optional function of this logic is to alert the system processor to debounced keys through an interrupt output pin. The technique described here extends a MAX6954/MAX6955's capability from 32 up to 80 or more keys with the addition of extra diodes.
|LED Output O0||SW A1||SW B1||SW C1||SW D1|
|LED Output O1||SW A2||SW B2||SW C2||SW D2|
|LED Output O2||SW A3||SW B3||SW C3||SW D3|
|LED Output O3||SW A4||SW B4||SW C4||SW D4|
|LED Output O4||SW A5||SW B5||SW C5||SW D5|
|LED Output O5||SW A6||SW B6||SW C6||SW D6|
|LED Output O6||SW A7||SW B7||SW C7||SW D7|
|LED Output O7||SW A8||SW B8||SW C8||SW D8|
Table 1 and Figure 1 show the standard key switch connections to the MAX6954/MAX6955. The key switch circuit reads 32 keys organized in a 4 x 8 matrix (four columns, eight rows). The eight key matrix rows are driven by the eight LED cathode drive outputs (LED Output O0 through LED Output O7). These LED cathode drive outputs alternately go low for 320µs (nom) and drive their LEDs sequentially as part of the multiplexed LED drive. These drive outputs are also used to each pull one end of two key switches low. The other ends of the keys connect to four input pins (P0-P3), which are internally pulled up to V+ inside the MAX6954/MAX6955. If a switch is pressed, then P0, P1, P2, or P3 is pulled low by the appropriate LED Output Ox output, and the MAX6954/MAX6955 detects and debounces the key press.
The diodes in series with the switches ensure that two or more LED cathode drive outputs are not shorted together if multiple keys are pressed simultaneously. For example, if SW A1 and SW A2 are pressed together, the diodes in series with the keys prevent LED Output O0 from being shorted to LED Output O1. This is because, at any time, at least one of the diodes will be reverse biased. The diodes typically implemented are the low-cost, common-anode BAW56 in SOT23.
The MAX6954/MAX6955 distinguish and discriminate between any combination of the 32 possible keys being pressed and released on any occasion. There are only sufficient registers in the part to provide status for these 32 keys. It is obvious that there is no way to extend this scanning topology beyond the 32 keys that the MAX6954/MAX6955 are designed for. Therefore, it is necessary to take another, more inventive approach.
To be specific, we look for a redundant situation to exploit. In many cases, the application only needs to detect if one key of many is pressed. Typically two-key presses on equipment are either miskeyed entries or a devious means to enter factory diagnostic modes. Accordingly, the redundant situations are two-key presses. The creative approach suggested here is to make additional keys appear as if certain key pairs are being pressed simultaneously. The example in Table 2 and Figure 2 adds 16 more keys by combining P0 and P1, and P2 and P3. For example, when SW AB1 is pressed, it must appear to the MAX6954/MAX6955 as if SW A1 and SW B1 are pressed simultaneously. This extension architecture works well, so long as each original key pair (e.g. SW A1 and SW B1) are not placed physically next to each other, to avoid them being pressed together accidentally. The software should be written to respond to a key active-low IRQ output within the MAX6954/MAX6955's debounce cycle time, to ensure that the result from exactly one key-scan pass is being analyzed. If the software active-low IRQ response is slow, it cannot distinguish between a simultaneous dual key press (identifying our extra keys) and sequential key presses of the same two keys. In either case, the key debounce registers 0x08-0x0B simply show a bit set for each key.
|P0||P1||P2||P3||P0 & P1||P2 & P3|
|LED Output O0||SW A1||SW B1||SW C1||SW D1||SW AB1||SW CD1|
|LED Output O1||SW A2||SW B2||SW C2||SW D2||SW AB2||SW CD2|
|LED Output O2||SW A3||SW B3||SW C3||SW D3||SW AB3||SW CD3|
|LED Output O3||SW A4||SW B4||SW C4||SW D4||SW AB4||SW CD4|
|LED Output O4||SW A5||SW B5||SW C5||SW D5||SW AB5||SW CD5|
|LED Output O5||SW A6||SW B6||SW C6||SW D6||SW AB6||SW CD6|
|LED Output O6||SW A7||SW B7||SW C7||SW D7||SW AB7||SW CD7|
|LED Output O7||SW A8||SW B8||SW C8||SW D8||SW AB8||SW CD8|
Each extra key requires a dual diode (such as the low-cost, common-cathode BAV70 in SOT23), which pulls both P0 and P1 low, or P2 and P3 low, when the switch is pressed.
The Figure 2, Table 2 scheme adds 16 more keys by combining P0 and P1, and P2 and P3. There are actually four more possible two-key combinations for the P0-P3 key-scan inputs. If all six two-key combinations are used, the key count can be extended to 80 switches, as shown in Table 3. Figure 3 shows how the six extra keys are wired for the LED Output O0 row. Again, each extra key switch uses a dual diode.
|P0||P1||P2||P3||P0 & P1||P0 & P2||P0 & P3||P1 & P2||P1 & P3||P2 & P3|
|LED Output O0||SW A1||SW B1||SW C1||SW D1||SW AB1||SW AC1||SW AD1||SW BC1||SW BD1||SW CD1|
|LED Output O1||SW A2||SW B2||SW C2||SW D2||SW AB2||SW AC2||SW AD2||SW BC2||SW BD2||SW CD2|
|LED Output O2||SW A3||SW B3||SW C3||SW D3||SW AB3||SW AC3||SW AD3||SW BC3||SW BD3||SW CD3|
|LED Output O3||SW A4||SW B4||SW C4||SW D4||SW AB4||SW AC4||SW AD4||SW BC4||SW BD4||SW CD4|
|LED Output O4||SW A5||SW B5||SW C5||SW D5||SW AB5||SW AC5||SW AD5||SW BC5||SW BD5||SW CD5|
|LED Output O5||SW A6||SW B6||SW C6||SW D6||SW AB6||SW AC6||SW AD6||SW BC6||SW BD6||SW CD6|
|LED Output O6||SW A7||SW B7||SW C7||SW D7||SW AB7||SW AC7||SW AD7||SW BC7||SW BD7||SW CD7|
|LED Output O7||SW A8||SW B8||SW C8||SW D8||SW AB8||SW AC8||SW AD8||SW BC8||SW BD8||SW CD8|
But why be limited to dual key presses to identify extra keys? Triple and quadruple key combinations can be used instead of or in addition to dual key presses. Table 4 shows these extra configurations. Note that the four triple combinations require a triple diode, and the quadruple combination requires a quadruple diode.
|P0 & P1 & P3||P0 & P1 & P4||P0 & P2 & P3||P1 & P2 & P4||P0 & P1 & P2 &P3|
|LED Output O0||SW ABC1||SW ABD1||SW ACD1||SW BCD1||SW ABCD1|
|LED Output O1||SW ABC2||SW ABD2||SW ACD2||SW BCD2||SW ABCD2|
|LED Output O2||SW ABC3||SW ABD3||SW ACD3||SW BCD3||SW ABCD3|
|LED Output O3||SW ABC4||SW ABD4||SW ACD4||SW BCD4||SW ABCD4|
|LED Output O4||SW ABC5||SW ABD5||SW ACD5||SW BCD5||SW ABCD5|
|LED Output O5||SW ABC6||SW ABD6||SW ACD6||SW BCD6||SW ABCD6|
|LED Output O6||SW ABC7||SW ABD7||SW ACD7||SW BCD7||SW ABCD7|
|LED Output O7||SW ABC8||SW ABD8||SW ACD8||SW BCD8||SW ABCD8|
There is a good reason to discard the triple and quadruple key combinations—they require more diodes. However, if the application needs only a few extra keys above the 32-key limit, then you might want to consider these five first. This is because it is more unlikely that a user would fumble three or four keys by accident than two.
Note: Each of the extension keys discussed is wired to simulate a multiple key press for keys on the same LED cathode drive outputs (LED Output O0 through LED Output O7). With this connection, the keys associated with any multiple key press combination are scanned and debounced at the same time, so the results appear simultaneously. Extra keys that simulate a multiple key press of keys scanned by different LED cathode drive outputs will be unreliable, as the keys would not be debounced simultaneously.