Maker Pro
Maker Pro

4X4 matrix keypad-74c922- source code

B

bb

hi......
im trying to interface a 4x4 matrix keypad using a 74c922 decoder to a
Atmel micrcontroller ...in c- programm.......

i would appreciate some pointers in how to create d source code that wil
read from the output of the decoder...according to key pressed...


thxs
bb
 
C

Chris

bb said:
hi......
im trying to interface a 4x4 matrix keypad using a 74c922 decoder to an
Atmel micrcontroller ...in c- programm.......

i would appreciate some pointers in how to create d source code that will
read from the output of the decoder...according to key pressed...


thxs
bb

Hi, bb. Assuming you're using external caps for the oscillator and the
keybounce mask, all you have to do is set your keycheck loop so it
happens at least twice during the component-selected debounce period.

Check for Data Available. If it's high, read the keypress data, then
set a software flag. Don't read data while the flag is set. Wait for
Data Available to be low again before resetting the flag. Read data
again when flag is reset and Data Available is high.

If you don't need to tri-state the '922 data outputs, that's the
easiest way. If you have bussed the data, clear the bus and then
toggle output enable to read the data as above. It's all in the data
sheet, available at the Fairchild Semiconductor website.

http://www.fairchildsemi.com/pf/MM/MM74C922.html

If this isn't an exercise in programming, though, the 74C922 is an
expensive way to do this job. If your code is so bound up that you
need a dedicated part to do keypad debounce, it might be better to get
another small uC to do this job at less cost and fewer pins (data can
also be sent from one uC to the other in serial format). You can also
have n-key rollover instead of just 2-key quite easily.

There's no law that says you can't have more than one uC on a board.

Good luck
Chris
 
B

bb

thx chris....

adding uc was an option i thought about earlier but d cct handles lot
more function than just keypad reading...tis includes alarm,lc
interface,relays n stuff...n i hv only 6 IO lines to spare.... besides..
the cct is already made finalize

wht i still dont get is tis

a) how to make a source code that will enable uc read d 5 input take
from 74c922....74c922 takes in 16 values(from 4x4 matrix) and decode i
into a 4 bit binary code to the uc plus a DA line.....
do i hv to include d conversion table(from 16 to 5) in the program sourc
code?

b)how do i know
whts d approprite delay time for key bounce routine....if im using a
atmel89s8252..is there a mathematical calculation involved in estimatin
it?

c)and finally in c -language....
is library file-> reg52.h, reg51.h and declaration term'sbit'....ANS
standard...?

when i compile d program it gives me error..cannot define reg 52.h an
term sbit
im using turbo c++ 4.5


:)
 
C

Chris

bb said:
thx chris....

adding uc was an option i thought about earlier but d cct handles lots
more function than just keypad reading...tis includes alarm,lcd
interface,relays n stuff...n i hv only 6 IO lines to spare.... besides...
the cct is already made finalize

wht i still dont get is tis

a) how to make a source code that will enable uc read d 5 input taken
from 74c922....74c922 takes in 16 values(from 4x4 matrix) and decode it
into a 4 bit binary code to the uc plus a DA line.....
do i hv to include d conversion table(from 16 to 5) in the program source
code?

b)how do i know
whts d approprite delay time for key bounce routine....if im using an
atmel89s8252..is there a mathematical calculation involved in estimating
it?

c)and finally in c -language....
is library file-> reg52.h, reg51.h and declaration term'sbit'....ANSI
standard...?

when i compile d program it gives me error..cannot define reg 52.h and
term sbit
im using turbo c++ 4.5


:)

Hi, bb. In the data sheet, it shows how to calculate the debounce time
based on the caps selected. Read the data sheet.

You should be able to read the DA bit directly in C. Just jump on zero
or not zero. As far as the 4-bit pushbutton data, you can read the
byte, mask off the bits you don't need, rearrange if necessary (usually
the case -- somehow, it seems to be trivially easy to transpose bits on
a PC board), then shift as necessary to make it the low nybble. Then
just read the data. Or if it takes fewer instructions/time, read the
four bits individually, then multiply/shift as necessary and add to
form the data nybble. Your call.

I don't know the Atmel C compiler you're talking about. If you need
help with code, you might want to go to one of the Atmel groups.

I've found it usually helps a lot to read the manuals and data sheets.
Even if you spend some time looking, that's just a free opportunity to
learn something else along the way.

By the way, please take a chance to glance at this:

http://groups.google.com/support/bin/answer.py?answer=12348&topic=250

and also, please don't use TXT lingo unless you're posting from your
cell phone. Us older cripples find it somewhat obscure. I know -- our
problem, and we'll soon enough be dead. But if fossils can't
understand, fossils can't help, can they?

And it actually sounds more like the TXT lingo poster can't even take
the time or show the respect to express himself carefully. Whether
that's interpreted as panic, extreme hurry, or a lack of respect by the
person who's taking the time to help and craft a response, it probably
won't help the OP.

And a fossil might just answer:

havnt a clue wot U' spoutin', m8. hOp U git out of d car trunk s%n!

( http://www.transl8it.com/cgi-win/index.pl for us fossils out there
;-)

Good luck
Chris
 
B

bb

hehe....

thank you chris.....understanding the needs of fossil over here( can yo
see...all lengthy words-ohmygoditiskilling-but its ok )...

young blokes lik me always in a hurry.....*wink *wink *smile
 
Top