??? 12/07/09 07:43 Read: times |
#171500 - State Transition Diagram Responding to: ???'s previous message |
Here is a State Transition Diagram (STD) showing the behaviour you described:
![]() I used Enterprise Architect - it's a (relatively) low-cost UML tool. Many others are available; search this forum for some suggestions - including some free ones. You can, of course, do it entirely with pencil and paper. MS Visio also has a template for State Diagrams. You could implement it with a switch statement, where each case handles one state; eg, CASE state_1: IF event IS mode_pressed THEN state := state_2 ELSE IF event IS up_pressed THEN INCREMENT a ELSE IF event IS down_pressed THEN DECREMENT a Again, there has been plenty of discussion of this here before - try a search. It is a very common technique, so there's also plenty of information available on the web, in textbooks, etc. One thing to beware of in general texts, though, is that it is quite common to implement state machines in 'C' using tables of function pointers - that can be problematic on an 8051, and is probably best avoided (at least until you have thoroughly checked-out the issues with your particular compiler) |
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 |