Setting Register Timers for Stepper Control

The MCP-1200 architecture is based on a closed-loop system that updates the servo calculations at the Sample Timer frequency. When controlling stepper motors the filter parameters are bypassed so that the step and direction commands are sent directly to the actual position counters. The sample timer (in conjunction with the Prescalar) must be set carefully so that the range of velocities and acceleration are within the design parameters. The 8-bit or 24-bit velocity may be used to produce the proper dynamic range in most applications.

Sample Timer and Prescalar

The combination of the prescalar, timer and clock frequency will determine the Sample Time for the chip. Usually, the clock frequency is fixed and can not be adjusted; so for this exercise we will pick a clock frequency of 8 MHz. The Sample Time cycle can be set faster in Stepper mode than when in Servo mode but must not ever cause a Sample Timer Error (R07H Bit 3). Using the default settings for the Sample Timer Prescalar (R10H, R11H) of 3FH and Sample Timer (R0FH) of 40H the step rate range can then be calculated as follows:

Sample Time = (63 + 1) (64 + 1) / 8 MHz = 520 µSec

This rate is acceptable for a servo loop but much too fast for typical steppers. Let's modify the Prescalar and Sample Timer to:

Prescalar =49,999 (R10H =C3H, R11H = 4FH)

Sample Timer = 79 (R0FH = 4FH)

Sample Time = (49999 + 1) (79 + 1) / 8 MHz = 500 mSec

For an 8-bit velocity, the min/max range is:

2 Steps/Sec to 254 Steps/Sec

For an 24-bit velocity, the min/max range is:

1 Step / 128 Secs to 65,636 Steps/Sec

Stepper Motor Control Settings

The Step Width (R1BH) should also be set to a value that guarantees the stepper driver will have time to respond to a pulse. The default setting is 15H, but let's increase it to 79H (127D) and calculate the width using an 8 MHz clock.

Step Pulse Width = (127 + 1) / 8 MHz = 16 µSec

Just a few more things to configure before commanding your velocity or profile moves. The mode must be set to stepper and extended addressing in the Advanced Configuration Register. If you are using the Hi-Res Velocity you need to configure that in the Feature Control Register. The following script summerizes the settings for initializing a profile move. (Format: Write, Addr, Value, Comment)

W 05 01  Enter Idle Mode

W 01 20  Set to Hi-Res Velocity

W 02 20  Set to Stepper Mode and Extended Addressing

W 10 C3  Set Prescalar

W 11 4F

W 0F 4F  Set Sample Timer

W 1B 79  Set Stepper Pulse Width

W 13 00  Zero position counter

W 2B 00  Set Final Position

W 2A 05

W 29 00

W 27 04  Set Accel = 4

W 26 00

W 23 00  Set MSB Hi-Res Velocity

W 24 20  Set CSB Hi-Res Velocity

W 25 02  Set LSB Hi-Res Velocity (fraction)

W 05 03  Enter Control Mode

W 00 08  Start Profile