20
PROGRAMMING IN WINDOWS
USING THE CLCI2000 INDEXER WITH WINDOWS
To communicate with the CLCI2000 Indexer, the programming language needs to have access to the computer bus.
While running under windows, this bus can be controlled through a Dynamic Link Library, commonly called a DLL. A DLL
will allow procedures to be performed that are not part of the standard Windows Instruction Set. This DLL has been
extensively tested on Visual Basic for Windows, and can also be used for other Software Languages that can use a
Dynamic Link Library.
USING THE DLL WITH VISUAL BASIC FOR WINDOWS
The process of loading the DLL into the main application is very simple. This process will be described in this section.
The first step is to choose a new project. This can be done by choosing FILE, New Project.
The next step is to add the declaration file WIN2000.BAS. To do this, choose, FILE, Add File. The correct directory
should be put in for the position of WIN2000.BAS. It is recommended to copy the WIN2000.BAS file into the directory
C:\VB (the file WIN2000.DLL should also be in this directory). Once the file is selected, click OK and the file will be
added to the Project. The project window (Window, Project) can be chosen to verify that this file has been added. This
is all that needs to be done with the WIN2000.BAS file. No modifications to this file are necessary from this point on.
The file should never be modified for any reason.
The final step is to write the code. An example of this would be to create a Command Button. the code in the form would
be:
Object: Command1 Procedure: Click.
Sub Command1_Click ()
Dim a As Integer
a = INITIALIZE(&H300, 1)
a = INDEX(&H300, 1, 400)
a = GO_CW (&H300, 1)
End Sub
When the Command Button is Clicked, the Motor will index 400 steps. All the other commands can be used in this same
manner.
.