Main Content

PWM

Pulse width modulation of digital output pin

Add-On Required: This feature requires the Simulink Coder Support Package for Beaglebone Blue Hardware add-on.

  • PWM block

Libraries:
Simulink Coder Support Package for BeagleBone Blue Hardware / Basic

Description

The PWM block varies the power output of a digital output pin. The input value sets the percentage of time that the digital square-wave is on within a specific period. This time percentage is called duty cycle.

Ports

Input

expand all

The range of valid input is 0 - 100. The input controls the duty cycle of the square waveform. An input value of 0 sets the duty cycle to 0% or no power, while an input value of 100 sets the duty cycle to 100% or full power. An intermediate input value, such as 0.333, sets the duty cycle to 33.3%, or 1/3 power. An out-of-range input value, such as -0.2 or 1.2, outputs minimum or maximum power.

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

Parameters

expand all

Specify the digital output at which the block generates the PWM signal.

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

Each block must have a unique pin number within a model.

Set the frequency of the PWM signal. If there are two PWM blocks, set both the blocks to the same frequency.

Version History

Introduced in R2018b