??? 12/15/04 08:17 Read: times |
#83120 - Making embedded programs |
Hi,
j would like to know which kind of approach do you use for making your embedded programs on 8051 MCU's. J mean do you use some kind of operative system or what?? Personally j use a "cooperative scheduler system" approach. In practice the main loop of my programs look always something like that : void main() { // infinite loop while (1) { Task1 (); Task2 (); } } Function Task1 is executed first, it does his work then returns, then Task2 is executed it does his work then returns and the cycle repeats. Every function or Task is structured in "states" like that : switch (state) { case START: // inizialize ... statement; ... statement // go next state state = RUN; break; case RUN: // functioning... statement; ... statement break; } Every task/function is called every xx milliseconds with different timings, e.g. Task1 () is called before Task2 () and every 10 millisec, Task2 () is called after Task1 () and every 20 millisecs. J learned this approach reading the book "PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS" by Michael J. Pont (j found a description of this book on Keil website) and j founds it works, every project a developed use this type of approach. Have you tried some alternatives? Please let me know. My english is not good...hope you understand me. Thank you! Massimo. |
Topic | Author | Date |
Making embedded programs | 01/01/70 00:00 | |
State machine... | 01/01/70 00:00 | |
look here | 01/01/70 00:00 | |
Variations on a theme | 01/01/70 00:00 | |
HUH ? | 01/01/70 00:00 | |
Code inside Task ()![]() | 01/01/70 00:00 |