??? 05/29/06 01:58 Read: times |
#117207 - Keypad Responding to: ???'s previous message |
The usual way is to scan the keypad as you know. I usually have a timer tick interrupt for my system timing and I would usually have it do the keypad scanning also. The keypad scan normally doesn't have much overhead so it usually won't impact on the system unduly. To retrieve the keypresses I have a task that runs regularly that determines the key pressed and processes that key. Since I use a co-operative task switcher, I write my code so that it does what it needs to and exits - this usually means using a 'finite state machine' to create a menu system. Using these techniques I easily write code that can process serial communications, have a user interface, do various control logic and convert analog inputs - all without having to resort to a RTOS. |