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.

using PIC to detect keyboard key pressed

Status
Not open for further replies.

clayofjunk

Junior Member level 2
Joined
Oct 18, 2004
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
200
i m trying to use a PIC to detect key presses on a 6*7 matrix keypad that contains 72 buttons, my program should be able to to detect 2 and 3 key combination. can anyone give some idea as a head start. idea as in programming idea.

i m an amature, pls help. :?
 

Hi

Be clear with your Question 6*7 combination comes to 72 buttons???

I dont get you. Is it 42??
Ok I suggest the Old method of keypad scanning.
Ok. If you have more I/O pins just go for keypad scanning.

Use two deticated ports for the keypad scanning . Using some latch ICs U can use the I/O ins for controlling of other periperals also.

Try this method out.

bye
gopi
 

Sorry if i didn't explain with more details, normal 6*7 matrix kaypad has 42 button but consider this there is an additional 30 buttons where one button contains 2 switch in it something like the below diagram.
 

thanks c-man, how about key detection using PIC, Swapgo said something about Old method detection, which i assume is the "set output bit then clear input bit , then check and see wheather the output is pull to low which indicates a key has been press" idea. But as u can see the keypad i m given is no ordinary one. Is there a better way to check for keypress other then the Old method detcetion.
 

What is your real problem?

Do you have too much keys to control using standard method with two full 8 bit ports which would give a max. of 64 keys?

Or do you want to use as few lines as possible to control your keys?

Or do you need to scan 72 keys and do not know how?

Also which language are you planning to use on the PIC and which PIC?

best regards
 

the PIC i m suppose to use is PIC16F872, 28-pin; 8-bit

i need to scan 72 keys with 13 pins: 6 output pins and 7 input pins. i m looking for the fastest and most reliable way to scan all the keys.
 

clayofjunk said:
the PIC i m suppose to use is PIC16F872, 28-pin; 8-bit

i need to scan 72 keys with 13 pins: 6 output pins and 7 input pins. i m looking for the fastest and most reliable way to scan all the keys.

OK you are really lucky as I have done similiar things :)

With 7 pins you can scan 7 * 6 = 42 keys and with 6 pins you can scan 6 * 5 = 30 keys so 30 + 42 = 72 keys ...

That should be possible. See the attached schematics of a 4 * 3 keyboard. The trick is that only one pin is an output, the others are used as inputs at each step. Set pin X to output and low, read the sorrounding X keys and continue by switching output X to input and pin Y to output low ...

The worst problem is that you need more then 8 * 7 keys so you have to split your keys in two groups (7 * 6 and 6 * 5) and you will need a separate routine for each block :-(

hope this helps and best regards
 

Hi clayofjunk,

Ur Keypad is not common keypad. I understand that. U have a inner row and a inner column . My Doubt here is how u detect a key present in the inner row or column.

Consider a button present in between Colum1 ,Colum2, Row1 and Row2.

U can develop a board which makes all 4 leads have contunity if the inner button is pressed .

if u develop a board like this then you can have a keypad which will have 6*7 , supporting 72 buttons.

The scanning also becomes easy if you have Latch ICs I/Os Consumed also will be minimised.

But Please Confirm is your architecture is same as I said .If its so then I will tell you the algorithm for the program

Bye
Gopi.
 

this is a very strange keypad
is this a matrix for a touch screen?
 

thank you c-man again, i get the idea of your concept but i think your keypad architecture is abit different from mine. please view the attach file.

The inner button should be something as should in the attach diagram. i hope with this swapgo can give me his algorithm too.

in reply to zelec's question, yes this is a matrix keypad, i think its more a keyboard then a keypad.
 

OK I see. Thought that you are going to construct this keyboard.

If it is an already manufactered unit then you will to live with that ...

Sorry but I can not help you with this, never seen a unit like this and I think this is a very complicated way to do this.

But again this is just my opinion.

best regards
 

anyone else cares to lend a helping hand. ideas? firmware coding? flow chart? state machine?

swapgo, i hope to see your algorithm. it would be very helpful.
 

can anyone give a sample coding of keypad matrix detection complete with key detection, N-key rollover, decoding and encoding key, data sending to host?
coding in assembly language only pls.
 

Hi Clay of Junk,

I hope this is simple just like scaning of 4*4 matrix the difference here is

Scan first all the buttons which are connecting two colums and two rows
(ie buttons in the upper section) by Giving input in two wires (colums) and check the out put in coresponding two wires (Rows).

Then scan for the button connecting single colum and row.

Hop U understood

Let me know if you have doubts

Regards
Gopi
 

Hi

Guidelines for programming

// Scan for the buttons connecting two rows and two colums

1. Make two inputs high (ie Colum1 and Colum2)

Check for the out put available in Rows Combination of the following

Row1 and Row2

Row2 and Row3

Row3 and Row4

and soo on

2. Now change the combination in colums ( colum 2 and colum 3)

Check for the out put available in Rows Combination of the following

Row1 and Row2

Row2 and Row3

Row3 and Row4

and soo on

Repeate the process as required


// Now You have completed scaning for buttons connecting two rows and colums

// Then now scan for buttons connecting single row and colum

3. Give high in Colum1 and check for the high in the rows



Regards
Gopi
 

u can use keyboard 102 key for computer
apply for your project
infomation 're in EPE megazine
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top