The Digital Output block is a composite subsystem block that provides digital output functionality with optional read-back capability. This block automatically manages internal sub-blocks:
The block handles all internal connections and parameter propagation automatically. When the block input is defined as one uint16, the value is used as-is without masks, which may affect other pins on the same port if they are also configured as digital outputs.
When to use:
When NOT to use:

| Port | Data Type | Description |
|---|---|---|
| Port signal | boolean or uint16 | Digital value to write to selected pin(s). If multiple pins are selected without PACK option, each pin requires its own boolean input. If PACK option is enabled, a single uint16 input sets multiple pins via bit positions. |
| Port | Data Type | Description |
|---|---|---|
| Port signal | boolean or uint16 | Current output state read from LAT register (1 sample delay). Only present when “Read previous value written (1/z delay)” is enabled. |
| Parameter | Variable | Type | Description |
|---|---|---|---|
| Port | PORT | popup | GPIO port selection (A, B, C, etc.). Dynamically populated based on target device pin map. Shows available pin indices for each port. |
| Pins | PIN | edit | Array of pin indices to control, e.g., [0] or [0 1 2]. Valid range is [0..15] for 16-bit ports or [0..31] for 32-bit ports. Out-of-range or unavailable pins are automatically filtered out with a warning. Defaults to [0] if left empty. |
| Initial Output | INIT_VALUE | edit | Chip-dependent. Initial pin state at startup. Accepts scalar (applies to all pins), vector (per-pin values), or bitmask (when PACK enabled). Use -1 or any negative value for “don’t care” (leaves pin at reset state). Visible on dsPIC30F, dsPIC33F, dsPIC33E, dsPIC33C, dsPIC33A, PIC32, PIC32A (Arch 1,2,3,4,8). Hidden on SAM devices. |
| set input as one uint16/uint32 | PACK | checkbox | When enabled, accepts a single uint16 (16-bit ports) or uint32 (32-bit ports) input where bit positions correspond to pin numbers. Enables atomic multi-pin updates. |
| Request exact simultaneous write | SIMULTANEOUS | checkbox | Conditional. When enabled, all pins are written to LAT register in a single instruction for atomic simultaneous update. Only visible when multiple pins are selected AND PACK is disabled. |
| Output mode | OUTPUT_PIN_MODE | popup | Chip-dependent. Electrical configuration: Push-Pull (default) for standard CMOS output, or Open Drain for open-collector applications. Only visible on dsPIC33E, dsPIC33C, dsPIC33A, PIC32, PIC32A (Arch 3,4,8). Hidden on older dsPIC30F/33F and SAM devices. |
| Read previous value written (1/z delay) | READPREVIOUS | checkbox | Adds Digital Output Read sub-block and output port to read LAT register state with 1 sample delay. |
| Block execution ordering | ORDERING | popup | Controls block scheduling: None, Input, Output, or Input & Output. When READPREVIOUS is enabled, ordering is automatically managed across sub-blocks. |
| Sample Time | SampleTime | edit | Sampling interval in seconds. Use -1 for inherited sample time. |
Initial Output Parameter Visibility:
Output Mode Parameter Visibility:
Sub-block Management:
READPREVIOUS=off: Only Digital Output Write sub-block is presentREADPREVIOUS=on: Both Digital Output Write and Digital Output Read sub-blocks are present, with internal ordering connectionPORT, PIN, PACK, SIMULTANEOUS, OUTPUT_PIN_MODE, INIT_VALUE, SampleTime) are automatically propagated to sub-blocksPort Availability:
Problem: Output pin doesn’t toggle
Problem: Multiple pins don’t update simultaneously
Problem: Read-back value doesn’t match expected output