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.

OP7160EX1 PWM In




The OP7160EX1 PWM In block is used to retrieve Duty cycle and Frequency values from Pulse Width Modulated signal connected to digital input lines of an OP525x carrier connected to an OP7160 card.

The period and the duty cycle values are transferred from the bitstream to the RT-LAB model through the DataOut port allocated to the OP7160EX1 PWM In, via the PCIe bus of the target computer; quick processing by the OP7160EX1 PWM In is made to supply the frequency and the duty cycle.

Each OP7160 bitstream using digital input channels comes with a configuration file; this file lists the Data port number and their corresponding OP525x location in the system. The configuration file name is the same as the bitstream file name entered in the OpCtrl OP7160EX1 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 OP7160 in which the OP525x 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 input channels. The OP7160EX1 PWM In 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.

The DataOut ports connected to Pulse Width Modulation input signals are identified by the acronym PWMI in the configuration file.

The maximum number of digital input channels controlled by one OP7160EX1 PWM In 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 OP7160EX1 block by entering the same 'Controller Name' as specified in the OpCtrl OP7160EX1 block The OpCtrl OP7160EX1 block controls initialization of the settings of one specific OP7160 card in the system.
DataOut port numberSet the number of the DataOut port to be controlled by this block, in the range [1:32].
Slot infoThis non-editable parameter displays the physical location of the digital input channels related to the selected DataOut port, as obtained from the parsing of the configuration file.
Available channelsThis non-editable parameter specifies the maximum number of PWM lines supported by the DataOut port as defined in the RT-XSG bitstream.
Number of PWM linesSet the number of PWM channels to be used by the block. The value must be less than or equal to the value of the 'Available channels' parameter. Only the first channels will be measured by the block.
Sample time (s)This parameter allows the user to specify the block sample time in seconds. The default value is 0, which specifies a continuous sample time (note that the sample time is borrowed from the separated subsystem) while -1 specifies an inherited sample time. A functionnality block and its associated controller block must execute at the same sample time.


This block has no inputs.


The block has three (3) outports.

HzThis outport returns the frequency of the PWM signal; it is specified Hz. A null value is returned when the line is unconnected. The minimal frequency measured is 100 Hz.
DutyThis outport is the duty cycle of the PWM signal. A null value is returned when the line is unconnected.
StatusThe Status output returns the following values:

0No error.

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

-2Data reception timeout. This error can be caused by model synchronization errors,

Data reception error: the block received fewer data from the OP7160 card than the value specified in the 'Data outport width' parameter. Missing data were replaced by 0.


Data reception error: the block received more data from the OP7160 card than the value specified in the 'Data outport width' parameter. Extra data were discarded.

Characteristics and Limitations

Unexpected behavior: When the duty cycle value returned from bitstream is non-null and the period is null, negative values are outputted. This behavior could be explained by a wrong bitstream file.

Block limitations: The frequency of the PWM signal should be between 100 Hz to 190 kHz to ensure the correct functionality.

Direct FeedthroughNo
Discrete sample timeYes
XHP supportYes
Work offlineNo

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