MPL PATI Incremental Encoder block
Simulink® Real-Time™ Library for MPL
This block has one input port and one output port.
Selects the counting mode. The block
port determines the counting mode. The incremental encoder function
has two counting modes, normal and fast. In fast mode, the count direction
is not controlled by the polarity of the two signals but continues
the same direction that was determined when the counter was last in
normal mode. The maximum counting rate is much higher in fast mode
than in normal mode.
If the block input
M is less than
the counter works in normal mode and counts on each edge. The edge
sense and polarity of each signal determines the count direction of
each signal. Each rising and falling edge of both inputs is counted.
You must set the counting mode to normal when the model is first started.
You can change it to fast mode afterward.
If the block input
M is greater than or equal
0.5, the counter works in fast mode. The counter
4 each time the primary channel has
a rising edge.
Returns the current position count as a double.
To keep the counting mode set to normal mode, just connect a
constant block with the value
0 to the
Note: To execute a model using this block, you must first write MPL boot code on the EEPROM using the MPL PATI EEPROM Write block.
To flash the EEPROM with the boot code, add the EEPROM Write block to an empty model, then build and execute that model before executing the actual model. See MPL PATI EEPROM Write block for further information.
From the list, choose a pair of sequential channels for the
incremental encoder. Both channels must be in the same group of 16.
If you want to use channels 16 or 32, their sequential partners are
1 and 17, for example,
From the list, select
High priority. This changes the order that
individual timers are serviced. See the MPC555 TPU documentation for
The initial count specifies the initial value for the encoder count register when the model starts executing.
From the list, choose one of the following. This block converts the output to doubles.
signed [-32768 +32767]
Interprets the 16-bit count as a signed quantity. This places the discontinuity far from the 0 origin. Counting up from 32767 goes to -32768 on the next count.
unsigned [0 65535]
Interprets the 16-bit count as an unsigned quantity. This places the discontinuity at the origin, where counting up from 65535 goes to 0 on the next count.
Enter the base sample time or a multiple of the base sample
-1 means sample time is inherited).
If only one board of this type is in the target computer, enter
locate the board.
If two or more boards of this type are in the target computer,
enter the bus number and the PCI slot number of the board associated
with this driver block. Use the format
To determine the bus number and the PCI slot number, type:
tg = slrt; getPCIInfo(tg, 'installed')