$ # K INTRODUCTION
VB_Stepper is an example program  for the K113, K158 and K179 kits from www.kitsrus.com. 

This program has been written for Windows NT,2000 and XP. It uses a dynamic link library (.dll) called io.dll which allows access to the printer ports and it is freeware. Please read the readme.txt file that accompanies the dll. It provides an explanation of the product and its routines. 
It also uses the RSTimer activeX component. You will have to install this component first

The program has 3 forms
	MonitorIntro
	MainFrm
	PrinterAddr

The MonitorIntro form first establishes the speed of the PC. This is necessary in order to output the DIR signal before the STEP signal for the K158 and K179 kits.

The PrinterAddr form allows you to select the number and address of the printer port which is connected to the inputs of the kits. This form should be run as soon as the main form opens.
If the Stepper Motor Driver Module is connected to Parallel Port 1 or Parallel Port 2 click the corresponding button. If the Data Acquisition Module is connected to a parallel port not having either address 378H or 278H click the other address button and enter the address as a hexadecimal value.
The user then clicks the FIND PORT button. The computer will then check the address for a parallel printer port and then display the type of port and the mode it is currently operating in. If it is an ECP port then the mode has to be changed to SPP(standard parallel port) before it can be used with the data acquisition module. This is done by clicking the INITIALISE button.

Note if the type of port is ECP, the computer may have to be rebooted before a printer can be used on this port.

The MainFrm is the main form and it displays the controls for operating the stepper motors 
The command box is where you enter the command
 Commands are of the form
   AMOV xxxx Absolute Move to location xxxx. Xxxx can be negative or positive in value
   RMOV xxxx Relative Move to current location + xxxx. Xxxx can be negative or positive in value
   POSN xxxx It is position xxxx. Xxxx can be negative or positive in value
   STOP
   STAT      Status bit 0=stepper 1 direction, 0=stepper 1 moving etc
   RATE xxxx  Period between steps in msec
   ACCN xxxx   Acceleration Starts off with this interval and decrements the interval by  the  ACCEL_INCREMENT
   ACCI xxxx   Is the Acceleration Increment  decrements the interval

The position box is the current position of the stepper motor. The user can enter a value into this box to set the position of the stepper motor. Entering a position into the box is the same as carrying out a POSN command

The Step interval box is the time in milliseconds between steps (not during acceleration or deceleration). Entering a Step Interval is the same as the RATE command

The Start Period box is the time in milliseconds between the first two steps of a move instruction. The period will then decrease each step by the value ACCEL_INCREMENT until the normal step interval is reached. Entering a Start Period value is the same as the ACCN command

The Accel Increment box is how many milliseconds the step will decrease and increase by during acceleration and decceleration

The Run buttons cause the command to be carried out. If the command is carried out the command box  will go blank
 
The Stop buttons cause the stepper motor to stop running

PARALLEL PORT CONNECTIONS TO K113 KITS
The K113 plugs directly into the Parallel Port

PARALLEL PORT CONNECTIONS TO K179 KITS
These are  the connections for connecting the K179 signals to the parallel port
	Pin 2 – STEP SIGNAL MOTOR 1
	Pin 3 – DIR SIGNAL MOTOR 1
	Pin 4 – STEP SIGNAL MOTOR 1
	Pin 5 – DIR SIGNAL MOTOR 1
	Pin 6 – STEP SIGNAL MOTOR 1
	Pin 7 – DIR SIGNAL MOTOR 1
	Pin 8 – STEP SIGNAL MOTOR 1
	Pin 9 – DIR SIGNAL MOTOR 1
	Pin 22 – COMMON SIGNAL MOTOR 1
	Pin 23 – COMMON SIGNAL MOTOR 2
	Pin 24 – COMMON SIGNAL MOTOR 3
	Pin 25 – COMMON SIGNAL MOTOR 4

PARALLEL PORT CONNECTIONS TO K158 KITS
For the K158 the user will need to place an open collector driver between each parallel port pin (pins 2 to 9) and the K158 DIR and STEP signals. Our Parallel Interface Board uses a ULN2803 to provide the open collector interfacing.  See our circuit diagram
	Pin 2 – OPEN COLLECTOR - STEP SIGNAL MOTOR 1
	Pin 3 – OPEN COLLECTOR - DIR SIGNAL MOTOR 1
	Pin 4 – OPEN COLLECTOR - STEP SIGNAL MOTOR 2
	Pin 5 – OPEN COLLECTOR - DIR SIGNAL MOTOR 2
	Pin 6 – OPEN COLLECTOR - STEP SIGNAL MOTOR 3
	Pin 7 – OPEN COLLECTOR - DIR SIGNAL MOTOR 3
	Pin 8 – OPEN COLLECTOR - STEP SIGNAL MOTOR 4
	Pin 9 – OPEN COLLECTOR - DIR SIGNAL MOTOR 4
	Pin 22 – COMMON SIGNAL MOTOR 1
	Pin 23 – COMMON SIGNAL MOTOR 2
	Pin 24 – COMMON SIGNAL MOTOR 3
	Pin 25 – COMMON SIGNAL MOTOR 4

Problems with Running Program
You may find when the program runs under Visual Basic the io functions don’t allow access to the printer port I/O. Read the instructions on how to install the IO.dll file. You may first have to produce an exe file and then run the exe. 

Legal Requirements
Because we are unaware of what people will do with this code  and how they will change it  the legal stuff regarding use indicated in readme.txt  extends to this visual basic program. 

----------------------------------------------------------------------------
                              LEGAL STUFF             
----------------------------------------------------------------------------
The following terms apply to all files associated with the software
unless explicitly disclaimed in individual files.

The author hereby grants permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.

IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHOR HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

We endeavour to make our software functional, reliable, value for money and simple to use. If you have any suggestions on how we can improve our product or you have identified a fault in its operation we would be most appreciative if you could contact us at
Ocean Controls
4 Ferguson Dr
Balnarring
Victoria, Australia
www.oceancontrols.com.au
Ph 61  3  5983 1163
Fax 61  3  5983 1120
Email - ocontrol@alphalink.com.au