When to use:
When to use:
When NOT to use:
The Tasks State block drives GPIO pins to indicate when tasks are executing. Each task in the model can be assigned a dedicated pin that reflects its execution state, enabling external observation of task scheduling behavior.

| Parameter | Variable | Description |
|---|---|---|
| Running tasks pin list output | TasksPin | List of GPIO pins to assign to tasks, one pin per task. Use space-separated pin names (e.g., “A0 A1 A2”), range notation (e.g., “A[1:5]”), or mixed notation. |
The TasksPin parameter accepts flexible GPIO pin specifications:
A0 A1 A2 assigns pins A0, A1, A2 to the first three tasksA[1:5] assigns pins A1 through A5 to the first five tasksA0 B[2:4] C1 assigns A0, B2, B3, B4, C1 to tasks sequentiallySpecial value: -1 skips pin assignment for the corresponding task (no pin is affected for that task).
For each task, the corresponding pin is set:
The first pin in the list corresponds to the highest rate/priority task (fastest sample time). Press Ctrl+J in the model to show the task list.
When you open the block dialog, it displays the current task list with assigned pins. Example from mask description:
Task List updated with last model build
D1 => 1 (ms) -> pin A1
D2 => 2 (ms) -> pin A2
D3 => 4 (ms) -> pin A3
D4 => 4 {+1} (ms) -> pin A4
D5 => 20 (ms) -> pin A5
The block also lists available pins by port:
Available pins:
A [0 1 2 3 4 5 6 7 9 10 14 15]
B [0 : 15]
C [1 2 3 4 12 13 14 15]
D [0 : 15]
E [0 : 9]
F [0 1 2 3 4 5 8 12 13]
G [0 1 2 3 6 7 8 9 12 13 14 15]
(Available pins depend on the selected device and peripheral configuration.)
MCHP_PORT mechanism{Task D<n> Running}{Task D<n>}15:1:<pin>-1 are filtered out and do not affect any GPIO pinRTWdata.TaskPinProfile for code generation| Problem | Cause | Solution |
|---|---|---|
| Pin conflicts with other blocks | Pin already assigned to peripheral | Choose different pins or disable conflicting peripheral |
| No signal on pin | Pin not available on device | Check block dialog for list of available pins |
| Unexpected pin behavior | Pin used by analog peripheral | Verify pin is configured as digital I/O |