Figure 1 YOONROLL CONT ROU07 2DZQ ICI ARI1213D 302 16m SD50
Figure 1
! YOON-ROLL CONT ROU0.7] 2DZQ ICI ARI12-13D 302 -16m SD50 ARMS-7-160 EQ 6060 -14CO 13 ARM7 80 80 2CONTROL 02A ICA 74 LSO2N GND 74LS138N ARMO- uAPPDATAQ APHL 20 20-usAppDATAL 30 30-17APPDALA2 4D 4Q SD50 60 60-14APPDATAS GND IC38 70TQ BDBQ 8. -12AppDA IAl 74LS02N IC3D RD 9 74.502N 74LSO2N RM613 BQ 80- -9-AppDATAI pPDATA3 7070 602 601 A SQ50 4040 GND 18-30 3D IQ1D APPDATA(0.7)Solution
Keypads are a part of HMI or Human Machine Interface and play really important role in a Small Embedded System where human interaction or human input is needed. Martix keypads are well known for their simple architecture and ease of interfacing with any microcontroller. A matrix keyboard reduces the number of connections, thus the number of interfacing lines. The interfacing of matrix keyboard requires two ports: one input port and other output port.
Keyboards and LCDs are the most widely used input/output devices and a basic understanding of them is essential.keyboard fundamentals, along with Key Press and Key Detection Mechanisms are the important features to discuss.
Basically, the 4x3 keypad contains push buttons that are arranged in four rows and three columns produce twelve characters as shown.Sometimes this called as “4x3 switch matrix” due to the arrangement of switches in a matrix form. The internal construction of these keypads includes metal dome contacts and conductive rubber.
CONNECTIONS:
The three column lines of the keypad as shown in the figure 1 are connected to the PORT 1 upper pins (P1.0 – COL1, P1.1 – COL2, P1.2 – COL3) and the four row lines are connected to PORT1 lower pins (P1.4 – ROW1, P1.5 – ROW2, P1.6 – ROW3, P1.7 – ROW7). Three resistors of 10k are connected between the column lines and power supply, to make the column lines are always high. Here one thing should be clear, that the column lines connected to the microcontroller should act as input lines and the row lines acts as output lines.
Remember that, the column lines of keypad are connected to port1 pins and these pins should be configured as input by placing logic high (‘LOGIC 1’) during port initialization. Similarly, the row lines of keypad are connected to port1 pins and configured them as output by placing logic zero (‘LOGIC 0’) during port initialization.
ROW1 = 0; //MAKE ALL ROW LINES OF KEY TO ZERO
ROW2 = 0; // TO MAKE THEM AS OUTPUT LINES
ROW3 = 0;
ROW4 = 0;
COL1 = 1; // MAKE ALL COL\'S AS HIGH
COL2 = 1; // TO MAKE THEM AS INPUT LINES
COL3 = 1;
SCANNING MECHANISM:
The scanning mechanism starts by making the first row (ROW1) of keypad to LOW (LOGIC ‘0’) and all column lines should be high (LOGIC ‘1’). Now check any one of the column lines goes low. If any column line goes low means that particular button is pressed, otherwise nothing is pressed.
Now the question in our mind is “which button is pressed”. This can be identified by checking which column is goes low.
If ROW1 = 0, COL1 = 0, remaining all lines are high means BUTTON1 is pressed.
If ROW1 = 0, COL2 = 0, remaining all lines are high means BUTTON2 is pressed.
If ROW1 = 0, COL3 = 0, remaining all lines are high means BUTTON3 is pressed.
If ROW2 = 0, COL1 = 0, remaining all lines are high means BUTTON4 is pressed
The MCU generates a clock signal and feeds it to the counter IC controlling the columns. Initially, the 0th output of the column counter and row counter is at logic high, and the column counter increments as it receives clock pulses. At the fourth clock pulse, the column counter resets and simultaneously increments by one the counter controlling the rows. As the column controller resets, the row controller increments and the row controller resets with the fifth clock pulse from the column controller. As clock pulses generate, a count variable on the MCU should be incremented and should reset to one upon the fifth clock pulse to the row controller. The output of the keyboard is OR’ed and connected to an external interrupt pin of the MCU.
An interrupt occurs only if a button pressed when both the row and the column of the respective button are at the logic-high level. If either row or column of the button is logic zero, an interrupt will not occur.
When an interrupt occurs, the MCU reads the count value at the moment; that value is equal to the button just pressed.
The clock count kept in the MCU increments as it generates clock pulses in intervals; this count is equal to the switch number on the keypad that could generate an interrupt if pressed.
![Figure 1 ! YOON-ROLL CONT ROU0.7] 2DZQ ICI ARI12-13D 302 -16m SD50 ARMS-7-160 EQ 6060 -14CO 13 ARM7 80 80 2CONTROL 02A ICA 74 LSO2N GND 74LS138N ARMO- uAPPDATAQ Figure 1 ! YOON-ROLL CONT ROU0.7] 2DZQ ICI ARI12-13D 302 -16m SD50 ARMS-7-160 EQ 6060 -14CO 13 ARM7 80 80 2CONTROL 02A ICA 74 LSO2N GND 74LS138N ARMO- uAPPDATAQ](/WebImages/23/figure-1-yoonroll-cont-rou07-2dzq-ici-ari1213d-302-16m-sd50-1054838-1761550156-0.webp)
![Figure 1 ! YOON-ROLL CONT ROU0.7] 2DZQ ICI ARI12-13D 302 -16m SD50 ARMS-7-160 EQ 6060 -14CO 13 ARM7 80 80 2CONTROL 02A ICA 74 LSO2N GND 74LS138N ARMO- uAPPDATAQ Figure 1 ! YOON-ROLL CONT ROU0.7] 2DZQ ICI ARI12-13D 302 -16m SD50 ARMS-7-160 EQ 6060 -14CO 13 ARM7 80 80 2CONTROL 02A ICA 74 LSO2N GND 74LS138N ARMO- uAPPDATAQ](/WebImages/23/figure-1-yoonroll-cont-rou07-2dzq-ici-ari1213d-302-16m-sd50-1054838-1761550156-1.webp)