Read from one or multiple incremental encoder input channels
Simulink Desktop Real-Time
Connect to and read from specific encoder input channels into your Simulink® model. After you have added an Encoder Input block to your model, you can enter the parameters for its I/O driver.
Encoder Data— Encoder data read from input channels
Data representing the state of an encoder. The data type and range of the output values depend upon the capabilities of the board.
Input channels— Select encoder input channels
1(default) | vector
Enter a channel vector that selects the encoder input channels that you are using on this board. The vector can be any valid MATLAB® vector form. For example, to select the first four encoder input channels, enter:
Quadrature mode— To detect optically the amplitude and direction of movement, select encoder stripe edges
Encoders use two sets of stripes, shifted in phase, to detect optically the amplitude and direction of movement. This parameter specifies which encoder stripe edges the encoder counts. From the list, select:
quadruple (default) —
Counts rising and falling edges from both stripe sets.
double — Counts
the rising edges from both stripe sets.
single — Counts
the rising edges from one stripe set.
Quadruple mode yields four times more pulses per revolution than the single mode. Therefore, quadruple is more accurate. Use quadruple mode unless other parameters dictate otherwise.
Reset input function— Select mode of reset pin
rising edge index|
falling edge index
The encoder interface chip has a reset pin in addition to encoder inputs. Usually, you connect this pin to the index output of the encoder. However, you can connect it to any signal or not at all. This parameter specifies the function of this pin. From the list, select:
reset (default) —
Level reset of the encoder count.
gate — Enables encoder
rising edge index —
Resets the encoder count on the rising edge.
falling edge index —
Resets the encoder count on the falling edge.
Input filter clock frequency— Cutoff frequency (Hz) of low-pass filter
Inf(default) | scalar
The encoder interface chip includes a low-pass filter that filters out high frequencies, which the chip interprets as noise. This parameter is the cutoff frequency (Hz) of this filter. The cutoff frequency that you specify is rounded to the nearest frequency supported by the chip.
If the encoder is moving slowly and high-frequency noise is
present, use the filter to eliminate the noise. With the filter in
operation, the chip does not count the noise as encoder pulses. If
the encoder is moving quickly, the filter can filter out the high-frequency
pulses, including pulses that you want to count. In this case, consider
disabling the filter by setting the cutoff frequency to