Micro C keypad question

Oct 26, 2004 3 Replies

Hello all. I am doing a project for my university where I have to take input from a keypad, and manipulate that data to calculate how far our robot needs to travel before it makes a turn. We're using an 8051 microcontroller and a 4X4 keypad.



Basically I need to figure out how the user can enter numbers w/ two or three digits (i.e. 24 or 241). With the sample program that I modified to display the keypad input on our LCD screen, only one number can be entered at a time. I would like to configure the keypad in such a way that the # key acts as an enter key. For example the keystrokes 45# would set an integer variable to 45.



Could any of you help point me in the right direction? I can post my source code if that would help. I know I need to use an array but I don't know how to implement it.



Thanks, Blake


What language ?

one way would be store the number in a temp variable (say X). if the next button is a number multiply X by 10 and add the new number. if you get a # then save it.

you may want to look at

formatting link
for more 8052 stuff

"Mr. Blake"

"Come here please"

"Here is a dime, go call your mother, and tell her there are serious doubts as to whether you will become an engineer".

You really are a grumpy old geek. n

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required