> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-i-o-library/encoder-out.md).

# Encoder Out

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-287a8fcf6a8f1d28dcacea0564910671c54af7f6%2F1e55c853-00e6-45bb-836d-575407fd7825.png?alt=media" alt=""><figcaption></figcaption></figure>

The **Encoder Out** block, located in the **RT-LAB I/O/Opal-RT/Common** library, produces quadrature encoder output signals (A, B, and index Z) on a Digital Output or OP5969 module installed in the simulator or expansion unit. In this mode, the physical modules generate **A, B, and Z** signals based on the angular rate provided by the simulation. The availability of this mode depends entirely on the bitstream supplied with the system. A single Encoder Out block can control **up to two encoders**. Refer to the **System Description Document** provided with your order for connector pin assignments.

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-14190ba07221d671a5e05e46c65d3fdd84622c24%2Fccec758b-6458-4e2a-bada-1962447222d0.jpg?alt=media" alt="" width="460"><figcaption></figcaption></figure>

<table><thead><tr><th width="211">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Controller Name</strong></td><td>Specifies the <strong>OpCtrl</strong> block this block is bound to. Enter the same <strong>Controller Name</strong> as defined in the corresponding <strong>OpCtrl</strong> block.</td></tr><tr><td><strong>DataIn port number</strong></td><td>Specifies the Digital Output or OP5969 module and subsection to which this block transmits signals. Subsection 1 corresponds to channels 0–7, subsection 2 corresponds to channels 8–15, and so on.<br>Configure the <strong>DataIn port number</strong> according to your <strong>System Description Document</strong> or <code>.conf</code> file.</td></tr><tr><td><strong>Slot infos</strong></td><td>Read‑only field displaying the expected physical location (Slot, Section, Subsection) of the Digital Output or OP5969 module derived from the selected <strong>DataIn port number</strong>. If the port number is invalid, <em>Slot 0 Module X Subsection 0</em> is displayed.</td></tr><tr><td><strong>Maximum number of Encoder signals controlled by this block</strong></td><td>Read‑only field displaying the maximum number of encoders available in the selected subsection.</td></tr><tr><td><strong>Number of Encoder Signals</strong></td><td>Specifies how many encoders in the subsection are controlled (maximum of <strong>two</strong> per subsection).</td></tr><tr><td><strong>Frequency unit</strong></td><td>Specifies the unit used to interpret the angular rate from the model: <strong>Hertz (Hz)</strong> or <strong>revolutions per minute (RPM)</strong>. The supported angular rate range is <strong>±166 Hz</strong> or <strong>±10,000 RPM</strong>.</td></tr><tr><td><strong>Mode</strong></td><td><em>This parameter is not functional and has no impact on the simulation. Changing its value does not affect model behavior or simulation results.</em></td></tr><tr><td><strong>Resolution</strong></td><td>Also known as <strong>PPR</strong> (pulses per revolution) or <strong>CPR</strong> (counts per revolution). Defines the number of A/B cycles per mechanical revolution. The maximum supported resolution is <strong>32 767 PPR</strong>. This parameter must be set correctly to ensure an accurate rate measurement.</td></tr><tr><td><strong>Clockwise Rotation</strong></td><td>Specifies whether clockwise rotation corresponds to signal <strong>A leading B</strong> or <strong>B leading A</strong>.</td></tr><tr><td><strong>Polarity</strong></td><td>Specifies the electrical polarity of the encoder <strong>A, B, and Z</strong> signals. <strong>Active High</strong>: Indicates that the signal is asserted at a high‑voltage level during the active portion of its duty cycle.<br><strong>Active Low</strong>: Indicates that the signal is asserted at a low‑voltage level during the active portion of its duty cycle.</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="116">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>Hz or rpm</strong></td><td>Inputs the encoder rotational speed in hertz (Hz) or revolutions per minute (rpm), depending on the <strong>Frequency unit</strong> parameter. The input vector size is determined by the <strong>Number of Encoder signals</strong> parameter. Use a <strong>Mux</strong> block to combine individual signals into a single input vector. The sign of the value indicates the rotation direction. The valid range is [-10000, +10000] rpm, and out‑of‑range values are saturated to the nearest bound.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="102">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Status</strong></td><td><p>Outputs the block status:</p><ul><li><code>0</code>: No error.</li><li><code>-1</code>: Block not associated with an <strong>OpCtrl</strong> block (check the <strong>Controller Name</strong> parameter), or FPGA initialization failure.</li><li><code>-2</code>: Data reception timeout, typically caused by model synchronization issues.</li></ul></td></tr></tbody></table>

## Characteristics and limitations

<table><thead><tr><th width="247.75">Characteristic</th><th>Value</th></tr></thead><tbody><tr><td><strong>Connector pin assignments</strong></td><td>Refer to the <strong>System Description Document</strong> provided with your order, or refer to the pin assignment of the <a href="https://opal-rt-technologies.gitbook.io/opal-rt-technologies-docs/op53xx/"><strong>OP53xx series I/O module</strong></a> or <a href="https://www.opal-rt.com/docs/pcie-cards-and-connector-kits/connector-kits/op5969-1-rs-422-i-o-module.md"><strong>OP5969</strong></a> module associated with each subsection.</td></tr><tr><td><strong>Direct feedthrough</strong></td><td>No</td></tr><tr><td><strong>Discrete sample time</strong></td><td>Inherited</td></tr><tr><td><strong>XHP support</strong></td><td>Yes</td></tr><tr><td><strong>Work offline</strong></td><td>No</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-i-o-library/encoder-out.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
