The overall philosophy of MC and Supervisor programs is similar, allowing "recycling" of many portions of the code. The programs are described step by step inside the code. In order to have a high level of commenting, a more readable code, and a multilingual description, at every significant point there is a number in brackets (e.g.: ) as a reference to an external file (e.g.: descrEng.txt) in the MPLAB project.
Both programs (dsPID & dsODO) are full interrupt driven. At the startup, after initialization of Supervisor and MCs, the programs enter in a very simple main-loop, acting as a state machine. In the main-loop, the program checks flags enabled by external events, and it enters in the relative state.
Since it's a kind of a very simple cooperative "Real Time Operating System," each routine has to be executed in the shortest possible time, freeing the system up to take care of the very frequent interrupts.
There are no “wait until” and no delays in the code. Whenever possible interrupts are used, in particular for slow operations like transmission or reception of strings of characters.