We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I'm trying to learn the MULTI-TASKING concept using RTX51 Tiny. I noticed that you no longer use the main. You always start with TASK 0. But If I need to INIT my MCU, how do I proceed ? Because if I put my init() in the TASK0, my MCU will be initialized several time, no ? Help a newbie ;-) Thx
I usually have several different sorts of initialization. - pre-kernel initialization. Relatively rare except for the C runtime and board support type stuff. But sometimes you need to do low-level initialization before anything else happens. This corresponds to Keil's STARTUP.A51, INIT.A51, and perhaps some other code. - pre-start initialization main() calls a bunch of init functions for various modules before any task starts running. These functions often create tasks, among other things.
void main (void) { ModAInit(); ModBInit(); ModCInit(); // start system running StartOs(); }
void TaskBody (void) { // startup init TaskInit(); // never-ending task body for (;;) { // task activity e = WaitForEvent(); HandleEvent (e); } } // TaskBody