Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC keypad (i'm newbie)

Status
Not open for further replies.

11max11

New Member
hello all...
is that any information of keypad using the mplab write one...
i'm a newbie and no use this software before.
can anyone show me some easy code for the keypad.
because i don't know is that correct or not when i reseach from the website...

thx for helping
 
how about using the IC74C922 ??
is that any problem when using the IC74C922 send data to the PIC16f877??
 
You can use the IC74C922 if you want. You don't need to because the PIC can do it all by itself as mentioned on the pages posted by Eric.
 
kchriste said:
You can use the IC74C922 if you want. You don't need to because the PIC can do it all by itself as mentioned on the pages posted by Eric.


ya i know.
but the thing i want is use the keypad combine with the PIC and get the output to control other thing.
is that i can use IC74C922 combine with the PIC then get the output from PIC?
 
11max11 said:
how about using the IC74C922 ??
is that any problem when using the IC74C922 send data to the PIC16f877??

hi,
A 74C922 can simplify your program.
Basically it scans a 4 * 4 keypad matrix, giving a output nibble 0 thru F [4bit]
also a another bit goes high to say a key has been pressed, use that for the Interrupt.

If you live in the UK, I'll send you one, FOC.:)
 
Last edited:
It's available here but this is one of my favourite PIC Tip & Tricks (there are many more on the Microchip site in the app notes section. There's a section on a 4x4 keypad in there.
 

Attachments

  • PIC Tips n Tricks Hardware Techniques.pdf
    488.5 KB · Views: 456
i have a quetion for the IC74C922....
is that i press the button '0' the output will become "PA=0,PB=0,PC=0,PD=0"
then i press the output '1' will become "PA=0,PB=0,PC=0,PD=1" and so on..>??

or is other else?
 
is this correct??

#include <p16f877.inc>
PortB equ 06h
out_put MACRO var
movwf PortB
bsf PortB, var
bsc PortB, var

movf h'0A', w
out_put 4
movf h'0B', w
out_put 3
movf h'0C', w
out_put 2
movf h'0D', w
out_put 1

ENDM
END
thx for helping
 
11max11 said:
i have a quetion for the IC74C922....
is that i press the button '0' the output will become "PA=0,PB=0,PC=0,PD=0"
then i press the output '1' will become "PA=0,PB=0,PC=0,PD=1" and so on..>??
"PA=1,B=0,PC=0,PD=0]"
or is other else?


hi,
If you look at the TRUTH table as part of the 74C922 diagram I posted a few days ago, it will answer your question.:p

Summary:
the answer to this question is, for the #1 key, A=1,B=0,C=0,D=0,[you have reversed the pattern!],
also a pin goes high on the 74C922, [Data Available], while a key is pressed, use this to interrupt the PIC program.

If you 'OR' the 'A B C D' line input pattern with 30hex, it will give you ASCII '0', '1'... '9', :,:,<,=,>,?
 
Last edited:
11max11 said:
is this correct??

#include <p16f877.inc>
PortB equ 06h
out_put MACRO var
movwf PortB
bsf PortB, var
bsc PortB, var

movf h'0A', w
out_put 4
movf h'0B', w
out_put 3
movf h'0C', w
out_put 2
movf h'0D', w
out_put 1

ENDM
END
thx for helping
hi,
Whats the Macro supposed to do, its good practice to comment the Macro header with a description of the Macro's function.

Also as you have 'included the PIC type' you don't need to EQU the PORT's
 
ericgibbs said:
hi,
If you look at the TRUTH table as part of the 74C922 diagram I posted a few days ago, it will answer your question.:p

Summary:
the answer to this question is, for the #1 key, A=1,B=0,C=0,D=0,[you have reversed the pattern!],
also a pin goes high on the 74C922, [Data Available], while a key is pressed, use this to interrupt the PIC program.

If you 'OR' the 'A B C D' line input pattern with 30hex, it will give you ASCII '0', '1'... '9', :,:,<,=,>,?


hihi..
thx i did't see clear for it...very thx...
 
ericgibbs said:
hi,
Whats the Macro supposed to do, its good practice to comment the Macro header with a description of the Macro's function.

Also as you have 'included the PIC type' you don't need to EQU the PORT's


hihi....
i want to do is use the IC74C922 output send data to PIC16F877.
from PIC16F877 send the number i key in to infrared.
from other side PIC16F877 to accept it and display it to LCD...
i want to do encryption and decryption because this is a keylock...:D
 
11max11 said:
hihi....
i want to do is use the IC74C922 output send data to PIC16F877.
from PIC16F877 send the number i key in to infrared.
from other side PIC16F877 to accept it and display it to LCD...
i want to do encryption and decryption because this is a keylock...:D
hi,
Are you planning to detect a keypress, encode and IR transmit each key as it pressed?
Or
detect a keypress, encode, save in a key buffer and transmit the key buffer string when the user presses a 'ENTER or ACCEPT' key and will the keypad have a 'CANCEL or CLEAR' key?

Hope this is clear.:rolleyes:
 
ericgibbs said:
hi,
Are you planning to detect a keypress, encode and IR transmit each key as it pressed?
Or
detect a keypress, encode, save in a key buffer and transmit the key buffer string when the user presses a 'ENTER or ACCEPT' key and will the keypad have a 'CANCEL or CLEAR' key?

Hope this is clear.:rolleyes:


hihi....
i want to do is the second one...but i need to add one more function for it. that is encryption and decryption it because the thing i want to do is key lock like i want to protect it...dun let it hack by someone...:p

thx for reply
 
Status
Not open for further replies.

Latest threads

Back
Top