Camera serializer/deserializer chip set reduces wire count for keypad
Keypad interconnect needs just four wires.
Wallace Ly, National Semiconductor Corp; Edited by Brad Thompson -- EDN, April 28, 2005
Many systems that require a user to manually enter data feature a keyboard similar to that in Figure 1. Although early keypads comprised arrays of individually wired switches, a typical modern keypad comprises a matrix of x and y lines. Pressing a key creates a momentary connection between an x line and a y line. For example, an individually wired keypad comprising discrete switches arranged in four rows and three columns (also known as a 4×3 layout) would require 24 wires. The more economical matrix approach in Figure 2 requires only seven signal wires, but even that number can sometimes prove difficult to route to a microcontroller. To further reduce the number of interconnecting wires from seven to three, plus a ground return, you can adapt a configurable serializer/deserializer such as National Semiconductor's LM2501.
The device typically finds use in adapting video buses, such as wide, low-voltage CMOS-video interfaces for portable electronics to Mobile Pixel Link service. The LM2501's typical application circuit features low-voltage and low-current operation and produces low levels of EMI (Figure 3). The circuit requires only two support devices—a counter (a CMOS CD4017 decade counter) and a 10-MHz clock-oscillator module (Figure 4). In operation, the host microcontroller drives the deserializer's WCLK input pin with a low-voltage-CMOS clock pulse, which translates to an MPL-level signal and then is applied to the serializer. The serializer reconverts the WCLK pulse, which drives the counter's clock input.
Unlike divide-by-10 encoded-output decade counters, the CD4017's internal organization comprises a Johnson counter that activates only one of its 10 outputs at a time. Thus, the counter's outputs D0, D1, and D2 sequentially apply a logic one to the keypad's column lines, and output D3 resets the counter to zero. When a user presses a key and connects a column line to one of four row lines, the serializer samples the keypad's row lines, converts the selected active line to a serial signal, and transmits the signal to the deserializer.
For example, suppose that the user presses the 5 key. The first clock pulse that the CD4017 receives drives column line D0 to a logic one, but, because the user does not press keys 1, 4, 7 and *, row lines A, B, C, and D remain at logic zero. The second clock pulse drives column line D1 to a logic one, and pressing key 5 connects row line B to logic one, whereas lines A, C, and D remain at logic zero. The pseudocode fragment in Listing 1 instructs the microcontroller to decode which key a user is currently pressing. In practice, additional code enables the microcontroller to reject multiple simultaneous key closures.
You can expand the architecture to accommodate a keypad matrix as large as 8×10 keys by using more of the counter's outputs and wiring the Nth output to the counter's reset input. The keypad's rows connect to the serializer's data inputs, and both of the LM2501s' unused inputs connect to pullup resistors, ground, or VCC.
Check out our Best of Design Ideas section!
-
You hit the nail on the head. Unfortunately when all you have is a hammer everything looks like a nail. The LM2501 might be well suited as a camera interface but its use here to sense a keypad, though creative, is just plain overkill.
As I count it, this design has five short control lines from the microcontroller to the deserializer chip, four long control lines from the deserializer chip to the serializer chip and a couple of short control lines from the serializer to the CD4017 counter. The cost of getting the inputs from the switches to the microcontroller is three active devices and a lot of wires to route. Furthermore, the LM2501 also requires an external crystal clocked at 10MHz and some pull-up resistors on the switches.
A simple microcontroller chip (e.g. pic16f818) can sense the switches directly using internal pull-up resistors and then communicate directly with the main microcontroller using only one or at most two data lines for communication depending on your requirements (there are serial several serial protocols available). Furthermore, the PIC chip has an internal oscillator that can run at a much lower clock speed (just try to tap those keys are 10MHz, I dare ya;-).
Cost of this solution is one active device and two control lines and lower power. Plus you can program the controller to debouce the switches at the source rather than doing it on the host cpu. Depending on the serial protocol you use, you can avoid long runs of clock signals and only send data when the switches are actually pressed which reduces emi problems. Using one device instead of three also reduces precious board space.
Murray Coons - 2005-28-4 13:47:00 PDT -
I like it. Just one issue: how do you keep the microcontroller in sync with the remote decade counter? It is simply sending pulses to the decade counter. If for some reason the decade counter misses a pulse, or some noise on the line causes a fake pulse, the microcontroller will think it is scanning the wrong column.
I think you need some way to either let the microcontroller reset the counter, or to let it figure out which column the counter is on. The latter can probably be done while keeping to just four transmission lines. If there are unused row-data lines on the 2501, as in the example, you could tie these to the column lines in a pattern that lets the data value indicate the column. So, for example, if the D0 column was being sampled, the two high order bits would be 00, If D1 was being sampled, the high order bits would be 01, etc.
If there are too few data row inputs available, but there is a column available, you could create a "sync" column and tie all the data inputs to 1 for that column. That way, when the microcontroller saw a data value of 255, it would know that the sync column was being sampled and it could re-sync its counter if needed.
Keith Allen - 2005-28-4 11:58:00 PDT


















