Main Content

PWM Output

Generate square wave on the specified output pin

  • Library:
  • Simulink Coder Support Package for BBC micro:bit/Basic

    Simulink Coder Support Package for STMicroelectronics Nucleo Boards/ Common

    Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F746G-Discovery

    Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F769I-Discovery

  • PWM Output block

Description

The PWM Output block generates square waveform on the specified output pin. The block input controls the duty cycle of the square waveform. You can provide a value between 0100 as the block input. An input value of 0 produces a 0 percent duty cycle and an input value of 100 produces a 100 percent duty cycle

Ports

Input

expand all

The range of valid input values is 0–100. The input controls the duty cycle (width of the square wave) of the square waveform.

An input value of 0 produces a 0% duty cycle and an input value of 100 produces a 100% duty cycle. Any out-of-range values, such as 500 or -500, at the block input port has the same effect as the maximum or minimum input values.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Parameters

expand all

To view the pin mapping on the board, click View pin map.

Make sure to assign different pin name to the different blocks of your model.

Apart from the pins names mentioned in the pin mapping table, there are other alternate pin names (Px_y_ALTz) that can be used to access other hardware peripherals connected to the same pin. To know more, refer to Usage of Alternate Pin Names.

The alternate pin names are only applicable for Simulink® Coder™ Support Package for STMicroelectronics® Nucleo Boards and Discovery boards.

Specify the initial frequency of the PWM waveform.

Specify the initial duty cycle between 0100.