This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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

Description

The PWM Output block outputs the pulse width modulated (PWM) signal at the specified pin on the board. The block accepts duty cycle as the input. You can provide a value between 0100 as the block input. An input value of 0 produces a 0% duty cycle and an input value of 100 produces a 100% 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 numbers to the different blocks of your model.

Specify the initial frequency of the PWM waveform.

Specify the initial duty cycle between 0100.