hsioEncoderEnable (Function) |
Top Previous Next |
hsioEncoderEnable configures and enables monitoring of an incremental encoder. If the Z input is provided, it can be used to improve the positioning.
The encoder must be using quadrature encoding, where each step consists of four phases: By examining the signals, it is possible to determine which direction the encoder is being moved and for how many steps, making it possible to determine the position.
When the Z-input is asserted while the encoder uses a mode that uses the Z-input, it will be registered and the position will be updated when the next step starts.
Note: Digital input 6-8 on the RTCU LX4 can not be used for encoders.
Input: a : PTR Address of the digital input signal to use as A (please see the example below).
b : PTR Address of the digital input signal to use as B (please see the example below).
z : PTR Address of the optional digital input signal to use as Z (please see the example below).
id : INT (1..2) default 1 Identifier of the encoder to configure.
mode : INT (0..3) default 0 The mode to use for handling the Z signal.
steps : INT default 0 The number of steps on a full rotation. Only needed in mode 3.
Returns: INT
Declaration: FUNCTION hsioEncoderEnable : INT;
Example: INCLUDE rtcu.inc |