          RMV ELECTRONICS INC "ST4-Series" Stepping Motor Control DLL

1.  Introduction

The Stepping Motor Control DLL is designed to facilitate the work of programming the ST4 Stepping Motor Control Board from Delphi, Visual Basic, and C++ in Windows 95 / NT.

The functions in this DLL can be divided into three major sections.  They are port functions with the prefix 'Port' for serial communication, ITC functions with the prefix 'ITC' for ITC-232A chip, and Motor functions with the prefix 'Motor' for step motor controlling. 

The demonstration program shows you how to use these functions, and also provides an easy way to manipulate them. All the functions are listed in the 'Functions' menu of this demo, and you can execute them one by one. The function declarations which can be copied and pasted to your program directly, are also listed in this menu.  The 'Control' menu provides a control panel to manipulate the step motors by clicking buttons.  From the 'Help' menu, you have a simple example of functions needed to make a motor turn, and this document.  

2.   How to control the step motors

a.  Establish the connection between your PC and the Stepper Motor Control Board

First, the serial port must be configured and opened. To configure the serial port, you call either the 'PortConfigure' or the  'PortConfigureForm' functions.  The difference in these two functions is that the latter provides a dialog form with the DLL to get the required parameters.  'PortConfigure' does not open a configuration form, instead, the COM port number and the Baud rate are passed as function parameters.  But the former requires parameters during programming.   These two functions are optional before you open the serial port by calling 'PortOpen' because 'PortOpen' will use default parameters if the configuration function is not called.  The default parameters are COM2, 9600 Baud Rate, 8 Data bits, 1 Stop bit, no parity bit.  After the serial port is opened, you can call the configuration functions to change the Baud Rate. 

b.  Initialize the board

After the serial communication is established, you can send commands to the board to manipulate the motors and other utilities provided by the board by calling Motor functions and ITC functions.  The first function that should be called is 'MotorInit', which will configure the I/O Ports on the ITC-232A,  reset each motor control chip, and set all the motors in pause status.

c.  Configuring the motors

Every motor control chip should be configured before making a motor turn. The configuration includes setting speed, direction, and number of steps. These can be done by calling the 'MotorSpeed', the 'MotorDirection' and the  'MotorNumberStep' functions.   The first parameter in these functions specifies which motor you are addressing. 

d.  Turning and stopping the motors

Either 'MotorGo' or  'MotorJog' will make a specified motor turn.  The difference is that 'MotorGo' will make the motor turn the number of steps specified by 'MotorNumberStep'.  Instead, 'MotorJog' will make the motor step until you abort its stepping by calling  'MotorStop' or the external home switch reaches the 'Home' position.    

There are several ways to stop motor stepping.   'MotorPause' will make a stepping motor pause, and 'MotorContinue' will resume the stepping.  These two functions are subsets of the function 'MotorTrigger' since they set one of the four parameters of this function. When one of the parameters is zero, the corresponding motor will pause.  Setting this parameter to one, causes the motor to continue stepping.  This is handy for starting two or more motors simultaneously.  When the board is initialized by 'MotorInit', all the motors are in pause mode. Either 'MotorContinue' or 'MotorTrigger' should be called to stop the pause. 

'MotorStop' will abort motor stepping, and set the motor position counter to an undefined state.  The position counter records the position of a motor when the motor finishes an action.  Aborting an action or using 'MotorJog' will destroy this information and set it to undefined. 

'MotorReset' or 'MotorInit' will also stop a motor by resetting the motor control chip.  But these are not recommended for this purpose.  Both functions will set the position count to zero.

e. Motor Homing

Usually, a homing technique is needed to know the physical position of a motor.  On the board, there are four 6-pin connectors for you to attach your 'Home' button for each motor.   When a motor touches its 'Home' button, it stops immediately.  Its position count is set to zero.  And it is locked in that position until you call the 'MotorGetHomeFlag' function to get the home flag and release the lock.

f.  Motor Command

The 'MotorCommand' function provides a way that you can send all motor commands supported by the motor controller IC.   Similarly, the 'ItcCommand' function lets you to send commands supported by the ITC232-A.  Using these commands, you can build your own functions.

3.  Where to get more information.

For more information, you need to refer to the following documents: the manual for the Stepping Motor Control Board (ST4), and the manual for the ITC-232A chip.

