Main Content

Digital IO Interface

Simulate digital input and output pins on processor

Since R2021b

  • Block icon of Digital IO Interface

Libraries:
SoC Blockset / Peripherals

Description

The Digital IO Interface block simulates the behavior of a GPIO processor pin on a hardware board. You can configure the block as either an input digital block or an output digital block.

When you configure this block as an input, the block captures the crossing event of an input signal on the pin. When the crossing event occurs, the block emits the logical state of the pin as a signal and sends an event to a Task Manager block. A task can then read the logical value using an IO Data Sink block.

When you configure this block as an output, the block emits the logical signal from a connected IO Data Source block.

Ports

Input

expand all

This port receives the logical signal from the msg port of a connected IO Data Source block.

Dependencies

To enable this port, set the IO direction parameter to Output.

Data Types: SoCData

This port specifies the input digital voltage signal to convert into a digital logical measurement.

Dependencies

To enable this port, set the IO direction parameter to Input.

Data Types: single | double

Output

expand all

This port outputs the logical signal value provided from the msg input port.

Dependencies

To enable this port, set the IO direction parameter to Output.

Data Types: single | double

This port sends a message at each digital IO threshold event. This output connects to the input of the Task Manager block to execute the associated event-driven task after executing the IO event.

Dependencies

To enable this port, set the IO direction parameter to Input and select the Enable event parameter.

Data Types: rteEvent

This port sends the Digital IO Interface input signal data as a message to the msg input port of the IO Data Sink block.

Dependencies

To enable this port, set the IO direction parameter to Input.

Data Types: SoCData

Parameters

expand all

Select a value for the Digital IO Interface block to act as a digital input or a digital output.

Specify the lower threshold voltage of the input signal. When the signal value crosses below the threshold, the block registers this crossing as an input change, generating an event and new message with a digital value of 0.

Example: 0.3

Specify the upper threshold voltage of the input signal. When the signal value crosses above the threshold, the block registers this crossing as an input change, generating an event and new message with a digital value of 1.

Example: 0.3

Select this parameter for the Digital IO Interface block to generate an event following a digital transition event. Selecting this parameter also enables the event output port, which you can connect to a Task Manager to simulate asynchronous digital read operation.

Select the condition for when to generate the digital input event.

  • Rising edge — Generate an event when the input signal on the in input port is greater than the High input voltage parameter value.

  • Falling edge — Generate an event when the input signal on the in input port is less than the Low input voltage parameter value.

  • Both — Generate an event on both conditions of the Rising edge and Falling edge options.

Specify the sample time (in seconds) to define the rate at which to output the message containing the digital input data.

Version History

Introduced in R2021b