主要内容

Digital Port Write

Set GPIO pin status

Since R2021b

  • Digital Port Write block

Libraries:
STM32 Microcontroller Blockset / STM32F1xx Based Boards
STM32 Microcontroller Blockset / STM32F2xx Based Boards
STM32 Microcontroller Blockset / STM32F3xx Based Boards
STM32 Microcontroller Blockset / STM32F4xx Based Boards
STM32 Microcontroller Blockset / STM32F7xx Based Boards
STM32 Microcontroller Blockset / STM32G0xx Based Boards
STM32 Microcontroller Blockset / STM32G4xx Based Boards
STM32 Microcontroller Blockset / STM32H5xx Based Boards
STM32 Microcontroller Blockset / STM32H7xx Based Boards
STM32 Microcontroller Blockset / STM32L4xx Based Boards
STM32 Microcontroller Blockset / STM32L5xx Based Boards
STM32 Microcontroller Blockset / STM32U5xx Based Boards
STM32 Microcontroller Blockset / STM32WBxx Based Boards

Description

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

Note

You can run a Simulink® model containing Digital Port Write block in Connected IO mode on STM32 Processor Based Boards. For more information, see Communicate with Hardware Using Connected IO.

Ports

Input

expand all

The input port to set the GPIO pin status in incremental order.

  • 0 - the respective pin is set to low value.

  • Non zero - the pin is active low or active high.

Dependencies

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

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point | enumerated | bus

Output

expand all

The simulation-only message output port, when connected to an Digital IO Interface (SoC Blockset) block, acts as pass-through with the output emitted on the output of the Digital IO Interface 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, select the Enable simulation port parameter.

Data Types: SoCData

Parameters

expand all

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

Programmatic Use

Block Parameter: PortName

Specify the GPIO digital pin to set the logical status.

Programmatic Use

Block Parameter: PinNumber

Select this parameter to read multiple port pin values.

Programmatic Use

Block Parameter: IOAsArray

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

Programmatic Use

Block Parameter: EnableSimPort

Extended Capabilities

expand all

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

Version History

Introduced in R2021b