Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

OP5142EX1 PWM Out




The OP5142EX1 PWM Out block is used to produce PWM signals on the digital output lines of an OP525x carrier connected to an OP5142 card.

Two inputs are used to generate PWM signal: the carrier frequency and the duty cycle. These values are transferred to the OP5142 bitstream from the RT-LAB model through one DataIn port of the bitstream, via the PCIe bus of the target computer.

The shape of PWM signals are defined by the polarity, the dead time between complementary signals, the initial phase. These parameters do not need to be sent at each step so the LoadIn port assigned to PWMO is used to transfer them to the OP5142 bitstream.

Each OP5142 bitstream using digital output channels in PWM Out mode comes with a configuration file which lists the LoadIn port, the DataIn port number and its corresponding OP525x location in the system. The configuration file name is the same as the bitstream file name entered in the OpCtrl OP5142EX1 block, with the extension .conf instead of .bin.

This configuration file uses three parameters to describe the selection of the OP525x channels:

  • the Slot number (in the range 1 to 4) is the slot of the backplane connected to the OP5142 in which the Digital Output module is installed,
  • the Section A or B is a subset of 32 lines of the OP525x carrier. For example, with the 32 In/32Out OP5251 carrier, section A refers to the 32 input lines and section B to the 32 output lines,
  • the Sub-Section, 1 to 4, is a subset of 8 data values connected to the port: subset 1 returns values for the 8 first channels of one section of the OP5251, subset 2 returns values for the 8 next channels, etc.

The user must refer to the configuration file for selecting the port number for the desired digital output channels. The OP5142EX1 PWM Out block then parses the configuration file and displays the Slot, Section and Sub-section values corresponding to the port number in the Slot info parameter. During the parsing of the configuration file, the block retrieves also the matching LoadIn port.

The maximum number of digital output channels controlled by one OP5142EX1 PWM Out is limited by the size of the subset of channels in one sub-section, which is fixed to 8 in the current implementation.


Controller NameBind this block to an OpCtrl OP5142EX1 block by entering the same Controller Name as specified in the OpCtrl OP5142EX1 block The OpCtrl OP5142EX1 block controls initialization of the settings of one specific OP5142 card in the system.
DataIn port numberEnter the index of the DataIn port to be controlled by this block, in the range [1:32].
Slot infoThis non-editable parameter displays the physical location of the digital output channels related to the selected DataIn port, as obtained from the parsing of the configuration file.
Maximum number of PWM signals controlled by this blockThis non-editable parameter displays the number of channels in one sub-section listed in the configuration file.
Number of PWM signalsEnter the number of independent PWM signals, or the number of pairs of complementary PWM signals, which will output from the specified digital module. The value of the number of signals must be less than or equal to the value of the Maximum number of PWM generators parameter. This number always equals to the length of the two vectors for the input of this block (Hz and Duty cycle, see the Inputs Section below for more details). The data supplied by the block will thus apply to the N first channels of the sub-section, where N is the value of the Number of PWMOut channels parameter. When 'Complementary mode was selected, the maximum number is divided by 2. In the Complementary Mode, the complementary signal is generated on the next PWM channel as shown on Figure 2: Complementary Waveform.
PolarityThis parameter is used to specify the PWM signal polarity. The polarity can be either Active-High (default) or Active-Low. Active-Low means that a Low output voltage is interpreted as a 1 and a High input voltage is interpreted as a 0. Active-High for this parameter means that the signal is active-high (default), which means that a Low input voltage is interpreted as a 0 and a High input voltage is interpreted as a 1. In Complementary Mode, when a Dead time value is set and Polarity is Active Low, the PWM signal is set to 1 during the delay specified by the Dead Time value parameter; when Polarity is Active High, the PWM signal is set to 0.
Carrier wave modeThis parameter sets the PWM generation pattern. If the generation mode is set to Symmetric, the PWM carrier is a triangular waveform. An Asymmetric generation mode corresponds to a saw-toothed carrier waveform. As a result, the symmetric PWM active phase is symmetric to the beginning of the PWM period while the asymmetric PWM active phase is asymmetric to the beginning of the PWM period.

Symmetric vs. Asymmetric PWM generation modes.

Output complementary channel: When selected, the PWM block generates the complementary signal and the number of PWM channels is divided per 2. The other channels are used to generate the complementary PWM signal according to Figure 2 below.

Complementary waveform

Dead time value (seconds): This parameter is available only if a complementary waveform is requested. It corresponds of the duration of this dead time, in seconds. Note that the inclusion of dead time will reduce the length of the active phase of the two complementary waveforms, thus reducing the duty cycle. This value is in seconds. When Polarity is Active Low, the PWM signal is set to 1 during the delay specified by the Dead Time value parameter and if Polarity is Active High, the PWM signal is set to 0. The dead time range is [0.01 10,23] µs.

Complementary waveform with dead time

Initial phase [0..1]: This parameter is used to specify the phase between each PWM signal and the carrier wave. Then, it is a vector (1 x n) where n is the number of PWM signals generated. The initial phase of the carrier is expressed as a cycle ratio, between 0 and 1. It is quantized to the nearest 1/1000.

Update Duty Cycle: This parameter is only available only if a symmetric mode is requested. There are two options available:

  • At each PWM period: One duty value should be provided for each channel being used. It applies for the full PWM period.

Symmetric Mode with duty cycle update at each PWM period

  • At half PWM period: This option allows using two different values for the duty, one for each half of the PWM period. When this option is selected, two values of Duty for each channel, Dx_1 (Channel x first PWM half period and Dx_2 second PWM half period), must be sent to the block. If all 8 channels are being used, then the size of the vector received by the Duty input should be 16 and its structure should be[D0_1, D0_2, D1_1, D1_2,...., D8_1, D8_2], where the first two values correspond to Channel 0, 1st and 2nd duty value, then Channel 1, 1st and second duty value, and so on.

Symmetric Mode with dutycycle update at half PWM period


HzThis input sets the PWM carrier frequency. The value should be provided in Hz; it should be between 0 and 180,000 Hz.
Duty cycleThis input is the duty cycle. It should be inside the [0,1] range. When the value is out of range, the duty cycle is saturated.


The Status output returns the following values:

0No error.

Block could not be matched with an OpCtrl OP5142EX1 block (check the 'controller Name' value), or OP5142 card initialization problem.

-2Internal memory initialization problem.

Characteristics and Limitations

Direct FeedthroughNo
Discrete sample timeInherited
XHP supportYes
Work offlineNo

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323