Low-Cost Stepper Motor Controller for Unipolar Stepper Motors

The stepper motor controller has the following features:

Assembly

RS232 Command Reference

All commands must be terminated with a carriage return character (hex 0d). Most commands expect a numerical argument which can be separated from the command by one or more spaces. A command line must not exceed 20 bytes. Commands that don't return information (all except ? and status) return the line "ok". On lines containing a syntax error the controller responds with "error".The controller always appends a carriage return character on its response. The communication baud rate is fixed: 9600 baud, no parity, 8 data bits, 1 stop bit.

?
Request the identification string. This is something like "DoubleFox Stepper Rev. 1.0".

status
Request the current motor position. This is especially useful when a motor movement has been interrupted. The motor position is returned as a 5 character decimal number, terminated with a carriage return.

ramptime nn
Set the ramp time to nn milliseconds. "ramptime 0" switches off ramping. The ramp time must be in the range of about 500 to 2000 milliseconds. Too small values may be rounded to zero during internal ramp calculation. A value of 65535 sets the controller to the maximum possible ramp time. On power up, ramptime is set to 1000 ms.

freq nn
Sets the motor's movement frequency to nn Hz. The frequency must be in the range from1 to 64935. At frequencies above about 3000 Hz internal rounding errors become large and ramping becomes inaccurate. On power up, freq is set to 1000 Hz.

minfreq nn
Sets the motor's minimum frequency during ramping to nn Hz. This number must be in the range of 1 to 255. On power up, minfreq is set to 50 Hz.

moveabs nn
Move to absolute position nn. This number must be in the range from 0 to 65535.

moverel nn
Relative move of nn positions forward or backward. If the first character of the command argument is a "-" character, the motor moves backward, otherwise it moves forward. nn must be in the range of 0 to 65535.

set nn
Sets the internal motor position to nn. The motor is not moved.

dutyon nn / dutyoff nn
These commands set the duty cycle when the motor is not moved. The numbers are given in clock ticks. The internal clock runs with 64935 Hz. The numbers must be in the range of 0 to 255. A value of 0 means 1 clock tick, a 255 means 256 clock ticks. Setting dutyoff to 2 and dutyon to 1 means, motor current is switched off 2 clock ticks and switched on 1 clock tick. On power up, duty cycle is set to 1:1.

halfstep n
Toggles between full- and half step mode. n must be zero or one. One means half step mode, zero means full step mode. When switching from half- to full step mode, the motor may move one half position forward or backward. When switching in the other direction, the motor's position is not changed. The internal counter and the move commands always refer to the actually selected mode. If switching the mode, the internal counter is not corrected (i.e. doubled or halved). On power up, the controller is in full step mode.

Back


Frank Hitzel, 2006