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.

OP5110-5120 APWM Out




The OP5110-5120 APWM Out block is a continuous pulse train generation block for the OP511x-OP512x family of boards, formerly named OPHSDIOboards.

The underlying software associated by this block makes use of the event Generation feature of the OP5110-5120 cards and makes it possible to adjust the outputs signals at each time step in order to reflect changes in frequency and duty values.

OnOP5110 and OP5120 boards, DIO lines are grouped in ports of 8 DIO lines. For example, the OPHSDIO64 card features 7 ports of 8 lines. The OP5110-5120 APWMOut block can monitor any number of the lines of one port simultaneously, each line being connected to its own digital signal. The frequency and duty of the pulse train of each line is controlled by the inports of the block.

Control of the output connectorThe OP512x boards have two sets of connectors: 4 on-board 40pinconnectors, and 2 external 80-pin connectors. The selection of the connectors is done by the choice of the Connector parameter of the OP5110-5120 OpSync block.
Complementary waveforms

Complementary waveforms can be obtained by using two OP5110-5120 APWM Out blocks with the same frequency and duty inputs and setting the output signal polarity in one block to'Active High' and in the other block to 'Active Low'.

Note: There is no dead-time protection to these waveforms.

Synchronization with the model calculation step

In order to ensure proper synchronization with the model clock, the OP5110-5120 APWM Out block must be used in conjunction with an OP5110-5120OpSync block. The OP5110-5120 OpSync block is a hardware synchronization block. It ensures the stability of the calculation time-step and serves as a time reference for other OP5110-5120 blocks (such as OP5110-5120 Event Detector, OP5110-5120 Event Generator). For more information, please refer to the documentation of the OP5110-5120OpSync block.


Target environmentSelect between RT-LAB and xPC Target.
Bus TypeThis parameter is no longer used.

Select the board type in this list. Each entry of the list specifies a board number, a device ID, and when applicable, the former name of the board. The device ID of the board selected must match a board installed on the target computer otherwise an error is returned.

On a Red Hat system, the device ID of a board is specified in the name of the bitstream programmed in this board.

On a xPC system, the device ID is obtained with the command getxpcpci all.

PCI slot (-1:autosearch)

This option is only available for xPC Target environment.

If only one OP5110 board is present in the xPC target PC, enter


to automatically locate the board.

If two or more boards of this type are in the target PC, enter the bus number and the PCI slot number of the board associated with this driver block.Use the format [BusNumber, SlotNumber]. To determine the bus number and thePCI slot number, in the MATLAB command window, type:

getxpcpci all

Board indexEnter the board index of the card [see board index limitations in the characteristics section below]

This popup allows the user to specify which I/O port of the OP5110 or OP5120board is used. A port is a group of 8 lines. The port are always named from A to M, although some OP5110-5120 boards may have only a subset of these ports available for the APWM Output feature.

The popup only displays the list of ports available on the selected board. Some ports support several features that cannot be used simultaneously; please refer to the documentation of your system for more details. A different OP5110-5120 APWM Out block must be used for each I/O port.

Selection of output lines used [0..7]Enter the vector of channel numbers to be monitored by this block. The channel numbers, in the range [0-7], can be entered in any order and must appear only once in the list.
Output signal polarityThis popup enables the user to specify the polarity, High or low, of the input signals of the lines selected in the Input line numbers parameter. If some lines have a different polarity than others, two different OP5110-5120APWM Out blocks must be used, one of them will specify the line numbers having High polarity, and the other one will specify the line numbers having Low polarity.
Frequency limits [Fmin,Fmax], in HertzEnter the minimum and maximum desired output frequency of the output signals here.
Force 0v output during load, Pause, ResetCheck this option to force the pins selected to output 0 Volt during Load, Pause and Reset. In order to get this 0 volt output, if the pin polarity is set to 'Low', these pins will output a high level during Load, Pause and Reset.


FreqThis inport is used to specify the vector of frequency values, in Hz, for each of the output signals.
DutyThis inport is used to specify the vector of duty values for each of the output signals. The duty of a signal is the fraction of the period during which the signal is active. It is expressed as a ratio of the active time over the period. Ex: duty=0.25 means that the signal is active one-fourth of the period.


The outport returns the number of transitions prepared in the OP5110-5120APWM Out driver and transferred to the OP5110 card for the generation of the waveform.

In case the preparation of the transition table fails, the output returns -1.

If several instances of OP5110-5120 APWM Out, OP5110-5120Event Generator, or OP5110-5120 Quad Generator blocks are used to control the same port of the card, only the last block executed during the calculation step transfers transitions to the card. In that case, OP5110-5120 APWM Out blocks that do not transfer transitions to the card return 0 at their output.

Characteristics and Limitations

Board Index Limitations

On the OP5120 boards (PC-104 format), the board index is user-selectable in the range [0-15] via a connector on the board. However, boardsOPHSDIO64 labeled v0.01 do not implement this feature, and the board index of these boards is set to the default value 15.

On the PCI boards (OP511x family), the board index is user-selectable in the range [12-15], via the jumpers JP8 on the board:

Connector Pin Assignments

OP5110-5120 boards usually ship with custom-made cables adapted to the signal conditioning required by the system they are to be connected to. Please refer to the documentation of your system for your specific connector pin assignment. If you need to prepare your own custom cable, please refer to the connector pin assignment table.

Direct FeedthroughNo
Discrete sample timeNo
XHP supportYes
Work offlineNo

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