Main Content

PWM Write

Send pulse width modulation (PWM) signal configuration to PWM Interface block

  • Library:
  • SoC Blockset / Processor I/O

  • Block icon for PWM Write

Description

The PWM Write block sets the duty cycle for a PWM peripheral. In simulation, the block passes through the duty cycle input to drive the PWM Interface block that simulates the PWM switching signals produced by the hardware. When deployed to hardware, the PWM Write block writes to the appropriate PWM drivers on the hardware.

Ports

Input

expand all

Specify the comparator values that trigger the change in pulse-width modulation waveform. When a N is 1, the comparator value defines the duty cycle of the PWM waveform. Using 2 comparators and the settings provided in the PWM Interface block, more fine grained control of the output waveform can be achieved.

Data Types: single | double

Specify the total period of the PWM waveform.

Dependencies

This parameter is only available when the Show period as input parameter is enabled.

Data Types: single | double

Specify the phase of the PWM waveform relative period of waveform. The phase is represented as a scalar between 0 and 1 equivalent to a range of 0 to 360 degrees.

Dependencies

This parameter is only available when the Show phase as input parameter is enabled.

Data Types: single | double

Output

expand all

This message port sends duty cycle values as messages to a connected PWM Interface block. For more information on messages, see Messages.

Note

This output is used only during simulation and is ignored in code generation and external mode simulation.

Data Types: SoCData

Parameters

expand all

Show a Period input port on the block. This port accepts a dynamic period value for the PWM waveform, allowing the period of waveform to be modified during execution.

Show a Phase input port on the block. This port accepts a dynamic phase value for the PWM waveform, allowing the phase offset of the waveform to be modified during execution.

Extended Capabilities

Introduced in R2020b