Tasks State Block Icon
The Tasks State block outputs the current execution state of all scheduled tasks, providing real-time visibility into the multitasking scheduler behavior. Essential for debugging timing issues and verifying task preemption.

Output Signals

OutputData TypeDescriptionValues
TaskIDuint8Currently executing task identifier0 = Idle
TaskStateuint8 vectorState of each task (length = number of tasks)0 = Idle
OverloadbooleanOverload condition detected0 = Normal

Example Usage

% Monitor task execution and detect preemption

% Connect outputs:
TaskID     → Display or scope
TaskState  → Vector scope (multi-line)
Overload   → Alert/LED

% Interpretation:
TaskID = 1  → Base rate task executing
TaskID = 2  → First subrate task executing
TaskID = 0  → Idle task (no scheduled work)

% TaskState example for 3-task system:
[2 1 0]  → Task 1 running, Task 2 ready, Task 3 idle
[1 2 0]  → Task 1 ready, Task 2 running (preempted Task 1)

Debugging Scenarios

ObservationDiagnosisAction
TaskID always 1Base rate never completesReduce base rate execution time
TaskID never changesSingle task consuming all CPUCheck for infinite loops
Overload = 1 frequentlyTasks missing deadlinesLower sample rates or optimize code
TaskState shows [2 2 2]Multiple tasks trying to run simultaneously (impossible)Check scheduler configuration

See Also

  • [MCHP_Scheduler_Options] - Scheduler configuration
  • [MCHP_MCU_LOAD] - CPU load measurement
  • [MCHP_MCU_OVERLOAD] - Overload detection