|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
User interface: keypad, alternative |
Posted: Fri Jan 29, 2010 5:37 pm |
|
|
Hi!
I have been working on menu system for a while. Atm. I've got well working system:
-Key press is registered as boolean 0 or 1.
-Press status is "polled" by timer overflow interrupt.
-By key press RB interrupt sets timer flow value to 0.
-Some repeat and repeat start delay code.
-Loop
-Result of above 4 ... boolean value 0 or 1 is if statement condition and in statement is set back to 0 and some functions are called.
Example : while() { if(key1 = 1) { key1 = 0; function(); } }
The device I'm using is 18F4550, so it got only 1 ... RB interrupt.
I'm using only 3 keys on port B with pull ups (UP, DOWN and OK)
---------------------------------------------------
How to add more more than 4 keys. (RB interrupt only 4 inputs)
Thank you in advance ! |
|
|
Ttelmah Guest
|
|
Posted: Sat Jan 30, 2010 3:06 am |
|
|
Multiple answers:
1) Use a matrix. Have four key 'cross lines' connected to the RB lines. Have any number of 'column' lines connected to other port pins. When you are not scanning the keyboard, leave these lines all low. Then when any key is pressed, you will receive an RB interrupt as the 'low' pulls the cross line down, and you then operate the column lines in sequence to find which one has triggered.
2) Do this without using the RB interrupt at all, in a timer event. You can then have any number of rows and columns, limited only be the number of available port pins.
3) Add an external keyboard decoder - something like a 74C922, or even a small PIC (probably cheaper.....).
Best Wishes |
|
|
Guest
|
|
Posted: Sat Jan 30, 2010 1:48 pm |
|
|
Ttelmah, Thank you !
You brought a lot of sense to the process of finding solution for my problem. I will thread your idea and technique with the highest priority. '
Again Thank You very much, you helped me out and saved big amount of my time. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|