Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to read inputs from 4*4 hexadecimal keypad?

Status
Not open for further replies.

asic1984

Full Member level 5
Joined
Nov 15, 2003
Messages
257
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
2,340
hi all

how to read inputs from 4*4 hexadecimal keypad.........

thanks for help
 

interfacing keypad

You can choose one of two methods:

- keyboard scan
- interrupt program

If your project is not too complex, the first method is better (easily understand and implement).
If your project requires to save your I/O ports (save your address space), the second one is better. In this case you should study how to write an interrupt procedure.

good luck,
 

interfacing a keypad

Pls see whether the following articles will help or not:


Keypad Interface Code
**broken link removed**



From an article said:
Software Interface
In this section, we will show how the scan code is generated using a Software Interface. As stated before, the keyboard switches are arranged in a matrix of rows and columns. To show how a scan code can be generated using a software interface we shall take, as an example, the hexadecimal keypad.


Circuit Description
* The keypad Switches are connected in a matrix of rows and columns :
-The rows of the matrix are connected to four output port lines.
-The columns of the matrix are connected to four input port lines.
-For simplicity, the rows of the matrix are connected to four input lines.

* When no key is pressed, the column lines are high.

* When a key is pressed, it connects a row to a column.

* If a row is at low and a key in that row is pressed, this low will appear on the column that contains the pressed key and it can be detected on the input port.

* If we can determine the row and column of a key, then we can determine which key it is and so we can assign to it an ASCII code.


Algorithm Description
The following Algorithm shows how to determine the row and column of a key and generate its Scan code:

1-Step One : Output Zero’s to all rows.

2-Step Two : This step consists of a Loop in which we read columns over and over until the columns are all high. We do this to make sure that the previous key has been released before we look for the next one. This is called Two-key lockout.

3-Step Three : Upon exit from Step Two, control goes to this step which is also a Loop. This loop reads columns over and over until one column is low which indicates that a key has been pressed.

4-Step Four : Upon exit from the previous loop, a check is done to avoid the effect of noise. During this stage, columns are read so that if they are high again, this means that the low detected in the step Three was caused by a noise rather than a key press. In this case, control goes back to step Two otherwise step Five is executed.

5-Step Five: Once we reach this step, we need to determine the row and column of the pressed key. This is done in this step which is also a LOOP. In this loop, a low is output on one row and then columns are checked. The loop continues until a low on a column is detected. The row of the pressed key is the row which is low at this moment and its column is the low column.

At this stage we can determine the Scan code which is the 8-bit read from the input port. It consists of D0..D3 which represents the column of the pressed key and D4..D7 which is the row of the pressed key.

...more details, pls read **broken link removed**
 

keypad interfacing

hi

thanks for your help

i want to make keypad scanning (software)...............but can u givemore details about how can i do it

thanks for help
 

key pad interfacing program for arm at91sam7s256

write 3 routines:
1) getRowValue
- drive columns low sequentially
- for each column driven low look for 2 rows (max) being low (this way you can implement chording)
2) getKey
- this calls routine 1 and returns max 2rows 2 columns = 2 keys pressed at the same time
3) handleKeypad
- this is your control algoritm

You can also maintain an array of rows x columns and mask it against a previously scanned version of the array to get the changes in keys
cheers
 

keypad interface what is

asic1984 said:
hi

thanks for your help

i want to make keypad scanning (software)...............but can u givemore details about how can i do it

thanks for help

Which language are you using?

If you are using C and the CCS compiler there are examples that come with the compiler. In this case take a look at them ...

best regards
 

keypad on parallel port

this is my sample code, very easy to understand:

***************
4x4 keypad
+--+--+--+--+
| 1 | 2 | 3 | A |
+--+--+--+--+
| 4 | 5 | 6 | B |
+--+--+--+--+
| 7 | 8 | 9 | C |
+--+--+--+--+
| * | 0 | # | D |
+--+--+--+--+
****************
// declare the variable first, i jump straight to the program
while(!kbhit()) {
for(i=0; i<4; i++) {
p1 = 0xff & ~((1<<4) << i);
// send p1 to IO where keypad is connected, for example GPIO
setgpio(0x47, p1); // set row first, can use outportb() instead, send data to that index
for(j=4; j<8; j++) { // scan keypress here
c = getgpio(0x46); // read data from index, can use inportb()
// results of keypress...
switch(c) {
// row 1
case 0xee: printf("1 pressed."); delay(250); break; // put delay to avoid printing several times
case 0xed: printf("2 pressed."); delay(250); break;
case 0xeb: printf("3 pressed."); delay(250); break;
case 0xe7: printf("A pressed."); delay(250); break;

// row 2
case 0xde: printf("4 pressed."); delay(250); break;
case 0xdd: printf("5 pressed."); delay(250); break;
case 0xdb: printf("6 pressed."); delay(250); break;
case 0xd7: printf("B pressed."); delay(250); break;


// row 3
case 0xbe: printf("7 pressed."); delay(250); break;
case 0xbd: printf("8 pressed."); delay(250); break;
case 0xbb: printf("9 pressed."); delay(250); break;
case 0xb7: printf("C pressed."); delay(250); break;

// row 4
case 0x7e: printf("* pressed."); delay(250); break;
case 0x7d: printf("0 pressed."); delay(250); break;
case 0x7b: printf("# pressed."); delay(250); break;
case 0x77: printf("D pressed."); delay(250); break;

default: break;
}
}
}
}

***note: setgpio() and getgpio() function was created to easily set and read data to/from index, of course you can create your own function with outportb() and inportb() - easy task! (is it??)

I hope you can understand what is the code all about.

best regards,
Triple_X, MY
Jom lawat Terengganu Kiteee :D
 

    asic1984

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
interfacing of keypad

hi

thanks all for help

for nicleo: is this algorithm mean that i will connect the keypad directlly to parallel port without any interfacing to pullup resistors and positive supply voltage as what i already do (but characters are not reading correctly)

also how can i overcome debounce problem

if someone can send schematic for the connection

and thanks all for help
 

explain 3 x 4 array keypad matrix explain pdf

asic1984 said:
for nicleo: is this algorithm mean that i will connect the keypad directlly to parallel port without any interfacing to pullup resistors and positive supply voltage as what i already do (but characters are not reading correctly)

also how can i overcome debounce problem

if someone can send schematic for the connection

and thanks all for help
For parallel port interfacing to keypad, I think you need pullup resistors as shown in Figure 1. You may also wish to read this INTERFACING WITH THE KEYPAD A MORE COMPLEX PARALLEL PORT EXAMPLE **broken link removed**

Switch Debouncing (hardware)
**broken link removed**

Switch Decouncing (software)
**broken link removed**
 

read a keypad by parallel port

hi

thanks every one for your help

it works now
 

8052 interrupt keypad

hi

U can try with a keypad encoder also.
Its not nessary to scan or poll. U can find the key when its pressed using the interrupt
U can use the IC MM74C922 . even a layman can do the program using this

Have a nice day

Regards
Gopi
 

4x4 matrix keypad scanning in c

just want to say that this topic helped me a lot

thanks for all
 

noise generated by keypad

HI
I have problem with keypad interrupt. my 8051 colums comes from one port and rows from anther port and it havng one encoder interrupt from 74HCT21 how to scan this key pad using C rograming. pls help me out

Regads
wahid
 

matrix keypad scanning in c

learn
8051 microcontrollers
I SCOTT MACKENZIE or
microcontrollers and interfacinmg
by
HALL
 

Re: keypad interfacing?

hi
how to use the 4x3 keypad?

You have asked the same question in 11 different threads in this forum in the last 2 hours,
don't you think that 1 or 2 posts are enough?

Alex
 

Re: keypad interfacing?

you can use sx1508/sx1509 encoder to build your module and then interface it to controller
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top