User Manual

PD42-1241 TMCL
Firmware Manual Firmware Version V1.44 | Document Revision V1.01 2019-MAY-23
88 / 107
6.3 External Encoders
External encoders with ABN interface can also be attached to the PD42-1241 module. Please see the
Hardware Manual on how to connect an external encoder. Consider the following things when using an
external ABN encoder:
The encoder counter can be read by software and can be used to monitor the current position of the
motor.
To read out or to change the position value of the encoder use axis parameter #216. To read out the
position of the external encoder use GAP 216, 0. The encoder position register can also be changed
using command SAP 216, 0, <n>, with n = -2147483648 . . . 2147483647.
Set axis parameter #217 to the resolution (counts per revolution) of the encoder. This value is used to
automatically calculate an internal pre-scaler which is used to match motor resolution and encoder
resolution. So the unit of parameter #216 will always be the same as the unit of parameter #1.
The motor can be stopped automatically if motor position and encoder position dier too much
(deviation error). This can be set using axis parameter #218 (maximum deviation). Setting this
parameter to 0 turns o this feature.
The encoder counter increments / decrements will be aligned to the position (microstep) counter when the
encoder resolution (axis parameter #216) is set to the appropriate value (counts per revolution). This is
essential when using the deviation error supervision (axis parameter #218) and simplies encoder counter
versus position/microstep counter comparisons (1:1).
Encoder resolutions are often (but not always) given in lines per rotation (lpr) by the manufaturer of the
encoder. Convert this value to counts per rotation (cpr) by multiplying it by four (because of the quadrature
interface).
6.4 Step/Direction Mode
The PD42-1241 is also equipped with a step/direction interface. In order to use this interface it is necessary
to select step/direction mode by setting axis parameter #254 to 1 (using the command SAP 254, 0, 1). This
will activate step/direction mode. In this mode, motion commands like ROL, ROR, MST and MVP will not
work (as motion will only be controlled by the step/direction signals then), but most motor parameters
like standby current, run current, microstep resolution and chopper settings can still be used. Automatic
switching between run current and standby current also works in step/direction mode.
In order to permanently switch the module to step/direction mode, write a short initialization program in
TMCL that contains the necessary SAP commands, download this program to the PD42-1241 and activate
autostart mode in order to make the program start automatically on power-up. An initialization program
for step/direction mode can simply look like this (replace the motor current settings by the values that you
need):
1
SAP 6, 0, 200 //Set run current
SAP 7, 0, 8 // Set standby current
3
SAP 254, 0, 1 // Activate step/direction mode
STOP //End of this program
Note
Always leave input IN2 unconnected when using step/direction mode.
©2019 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com