Send pulse width modulation (PWM) signal configuration to PWM Interface block
SoC Blockset / Processor I/O
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.
Compare — Comparator trigger value
positive scalar | N-length positive vector
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.
Period — Period of PWM waveform
Specify the total period of the PWM waveform.
This parameter is only available when the Show period as input parameter is enabled.
Phase — Phase offset of the waveform
0 to PWM period
Specify the phase of the PWM waveform relative period of waveform. The phase is
represented as a scalar between
0 and PWM period.
This parameter is only available when the Show phase as input parameter is enabled.
msg — PWM duty cycle values
Show period as input — Show period input port
off (default) |
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 phase as input — Show phase input port
off (default) |
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.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
When deployed to a supported hardware board, this generated code for this block writes to the PWM registers in the MCU for the specified PWM module. For more information on configuring the register settings, see Hardware Mapping and Hardware Mapping Peripherals for Texas Instruments C2000 Processors Properties.
Supported hardware boards include the
TI Delfino F2837xD and
TI Delfino F2837xD LaunchPad from the SoC Blockset™ Support Package for Texas Instruments®
Introduced in R2020b