Main Content

Digital Port Read

Read GPIO pin status

Since R2021b

Add-On Required: This feature requires the Embedded Coder Support Package for STMicroelectronics STM32 Processors add-on.

  • Digital Port Read block

Libraries:
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32F2xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32F3xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32F4xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32F7xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32G4xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32H7xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32L4xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32L5xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32U5xx Based Boards
Embedded Coder Support Package for STMicroelectronics STM32 Processors / STM32WBxx Based Boards

Description

Read the logical status of a GPIO port pins for STM32 processors.

Note

You can run a Simulink® model containing Digital Port Read block in Connected IO mode on STM32 Processor Based Boards.

Examples

Ports

Input

expand all

The simulation-only message input port, when connected to an Digital IO Interface (SoC Blockset) block, acts as pass-through with the input to the Digital IO Interface block emitted on the output of the Digital Port Read block during simulation. When the Access port pins as array parameter is not selected, a simulation port is generated for each pin in the Pin number parameter, otherwise the pin array must be treated as a scalar.

Dependencies

To enable this port, check the Enable simulation port parameter.

Data Types: SoCData

Output

expand all

The port outputs the logical state of the digital pin on the board that you specify in the Pin number parameter.

Dependencies

To output multiple port values, select Access port pins as array parameter.

Data Types: Boolean

Parameters

expand all

Select one of GPIOA to GPIOK ports to get a GPIO pin status of a specified GPIO port.

Specify a GPIO pin to read the logical status.

When you specify a GPIO pin number and Access port pins as array parameter is enabled, the output is always in the incremental order of pin number.

Select this parameter to output multiple port pin values.

Specify in seconds how often this block reads the pin value.

When you specify this parameter as -1, Simulink determines the best sample time for the block based on the block context within the model.

Select this parameter to add an SoC Blockset compatible simulation input port.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2021b