User manual

TMCM-1161 TMCL Firmware V1.19 Manual (Rev. 1.04 / 2012-NOV-19) 68
www.trinamic.com
6.2 Changing the Prescaler Value of an Encoder
The TMCM-1161 offers an integrated sensOstep encoder. The built-in encoder has 1024 steps/rotation.
For the operation with encoder please consider the following hints:
The encoder counter can be read by software and can be used to control the exact position of the
motor. This also makes closed loop operation possible.
To read out or to change the position value of the encoder, axis parameter #209 is used.
So, to read out the position of your encoder 0 use GAP 209, 0. The position values can also be
changed using command SAP 209, 0, <n>, with n = ± 0,1,2,…
To change the encoder settings, axis parameter #210 is used. For changing the prescaler of the
encoder 0 use SAP 210, 0, <p>.
Automatic motor stop on deviation error is also usable. This can be set using axis parameter 212
(maximum deviation). This function is turned off when the maximum deviation is set to 0.
To select a prescaler, the following values can be used for <p>:
Value for
<p>
Resulting prescaler
SAP command for motor 0
SAP 210, 0, <p>
Microstep solution of
axis parameter 140
25600
50 (default)
SAP 210, 0, 25600
8 (256 micro steps)
12800
25
SAP 210, 0, 12800
7 (128 micro steps)
6400
12.5
SAP 210, 0, 6400
6 (64 micro steps)
3200
6.25
SAP 210, 0, 3200
5 (32 micro steps)
1600
3.125
SAP 210, 0, 1600
4 (16 micro steps)
800
1.5625
SAP 210, 0, 800
3 (8 micro steps)
400
0.78125
SAP 210, 0, 400
2 (4 micro steps)
200
0.390625
SAP 210, 0, 200
1 (2 micro steps)
The table above just shows a subset of those prescalers that can be selected. Also other values between
those given in the table can be used. Only the values 1, 2, 4, and 16 must not be used for <p> (because
they are needed to select the special encoder function below or rather are reserved for intern usage).
Consider the following formula for your calculation:
Example: <p> = 6400
6400/512 = 12.5 (prescaler)
There is one special function that can also be configured using <p>. To select it just add the following
value to <p>:
Adder for
<p>
SAP command for motor 0
SAP 210, M0, <p>
4
Clear encoder with next null channel event
Add up both <p> values from these tables to get the required value for the SAP 210 command. The
resulting prescaler is Value/512.
6.3 Using the RS485 Interface
With most RS485 converters that can be attached to the COM port of a PC the data direction is controlled
by the RTS pin of the COM port. Please note that this will only work with Windows 2000, Windows XP or
Windows NT4, not with Windows 95, Windows 98 or Windows ME (due to a bug in these operating
systems). Another problem is that Windows 2000/XP/NT4 switches the direction back to receive too late. To
overcome this problem, set the telegram pause time (global parameter #75) of the module to 15 (or more
if needed) by issuing an SGP 75, 0, 15 command in direct mode. The parameter will automatically be
stored in the configuration EEPROM.

