??? 12/06/09 18:48 Read: times |
#171492 - State machine Responding to: ???'s previous message |
I think a State Machine (aka Finite State Machine, FSM) could help here.
The State Machine is a very useful and powerful approach - it would be well worth your while to study it & become familiar. Michael Karas did a tutorial here: http://www.8052.com/forum/read/47505 You could consider that your system has 3 States, and it's the 'Mode' button that cycles through the states: Akhil Bose said:
if the [Mode] key is pressed one time, the operator uses the 'UP' or 'DOWN' keys to change one value A. That's your 1st state; if the key is pressed is 2 times then a different value B is changed by pressing 'UP' or 'DOWN' keys. That's your 2nd state; Similarly if the key is pressed is 3 times then another value C is changed by pressing 'UP' or 'DOWN' keys. That's your 3rd state. My preferred approach to designing State Machines is to use a State Transition Diagram aka "State Chart" - but other methods are available (eg, State-Event Table). can anyone tell my any sample code It's not code you need - it's techniques |
Topic | Author | Date |
one key, multiple jobs assigned to it | 01/01/70 00:00 | |
Step by step | 01/01/70 00:00 | |
What methods do you have for keeping track of time now? | 01/01/70 00:00 | |
Timing in Siemens ;)? | 01/01/70 00:00 | |
RC circuit | 01/01/70 00:00 | |
Yep, touché!... | 01/01/70 00:00 | |
Another idea... | 01/01/70 00:00 | |
State machine | 01/01/70 00:00 | |
State Transition Diagram | 01/01/70 00:00 | |
Timers can help!! | 01/01/70 00:00 | |
In theory, zero timers are needed | 01/01/70 00:00 | |
"I do not have any timer interrupts left." | 01/01/70 00:00 | |
Software timers | 01/01/70 00:00 | |
To check debounce | 01/01/70 00:00 | |
what happens when![]() | 01/01/70 00:00 |