Motion - Motion Tracker API

Serial stepper motor interface API

*Subject: API for controlling a serial stepper motor
*Version: 1.0
*Status: final
*Author: Jeroen Vreeken
*Date: 14-6-2001

Introduction

This is the API for a stepper motor controller connected to a standard serial port.
The protocol is designed to allow the control of multiple (up to 256) independand motors.
The motors must have a safety to prevent turning to far.
The user must be able to read the status of the motor.

API

The interface works at a fixed baudrate of 9600bps. Each command will consist of three bytes. After each command the interface will return a status byte. Where needed counting will start at zero.

Build-up of a command:

  • byte0 will contain the motor number. Usually zero.

  • byte1 will contain the command. A list of valid commands is given later on in this document.

  • byte2 will contain additional data for this command.


Build-up of the status byte:

  • bit0 will signal if the motor turns left.

  • bit1 will signal if the motor turns right.

  • bit2 indicates that the motor is against the left safety stop.

  • bit3 indicates that the motor is against the right safety stop.

  • bit4 - bit7 these bits are not used and shall be zero.


These are the valid commands:

  • 0 STATUS
    Nothing will happen, just the status byte will be returned. The data byte will be ignored.

  • 1 LEFT_N
    The motor will make N steps to the left unless it hits the left safety first.
    The data byte will contain N.

  • 2 RIGHT_N
    The motor will make N steps to the right unless it hits the right safety first.
    The data byte will contain N.

  • 3 LEFT
    The motor will continuously turn left until it hits the left safety stop.
    The data byte is ignored.

  • 4 RIGHT
    The motor will continuously turn right until it hits the right safety stop.
    The data byte is ignored.

  • 5 SWEEP
    The motor will start making a sweeping movement.
    The data byte is ignored.

  • 6 STOP
    The motor will stop moving.
    The data byte is ignored.

  • 7 SPEED
    This command controls the speed of the motor, 0 is the slowest, 255 the fastest.

Note that motion does not use all of these commands, implementing a subset of these commands will also work.
Topic revision: r1 - 11 Oct 2004, KennethLavrsen
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.