10
PROGRAMMING WITH ANAHEIM AUTOMATION LIBRARIES
Anaheim Automation has written Libraries that can be used to control the CLCI2000 Series Indexer Board in many
different languages. These languages include QuickBASIC, VisualBasic, C, and any Windows programming language.
There are two different libraries written for the 'BASIC' languages, one library for the 'C' users, and one library for the
windows users (this Windows Library must be requested). The Libraries contain all the code necessary to control the
motion with the Indexer Board.
PROGRAMMING WITH QUICKBASIC OR VISUALBASIC FOR DOS
Programming the CLCI2000 Using Quick Basic is very easy. A Library with various Subroutines and Functions has been
written to make the process of controlling your Step Motor Driver as painless as possible. ANAHEIM AUTOMATION's
Subroutine and Function Library CLCISUB1.BAS is found on the CLCI2000 SERIES DISK. To use this library in
QuickBASIC, go to the Menu Selection File, and Choose Load File. To use this library in VISUAL BASIC go to the Menu
Selection File, and Choose Add File. Be sure to have the file in the appropriate location. When you use one of the
Subroutines or Functions, be sure to 'DECLARE' that Sub or Function. You may want to copy all of the DECLARE
statements from the top of the CLCISUB1.BAS programs to the top of your Program. Refer to your QuickBASIC
technical manual for further explanations.
The way to program a move in QuickBASIC is as simple as this.
Lets say you would like these (motion) parameters.
Base Speed: 400 steps/sec
Max Speed: 5,000 steps/sec
Ramp: 200,000 steps/sec^2
To move 1000 steps in the clockwise direction, the code for this in QuickBASIC would be:
MOTION ADR, AXIS, 400, 5000, 200000
INDEX ADR, AXIS, 1000
GO.CW ADR, AXIS
That is all there is to it. Using English-Like commands, you can easily control your step motors.
SPEED CONSIDERATIONS
The time that it takes to process a command is sometimes very critical to a design. The majority of the time involved
in communication to the CLCI2000 Series Indexer is due to the time the programming language takes to communicate
with the PC expansion bus. Some languages are faster than others. For example, code written in Microsoft QuickBASIC
will run slower than that same code written in Microsoft C.
To get a feel for the time that is involved in communicating from the board to the PC here is an example. The time it
took a 486 computer running at 33MHz to Read the Position from the CLCI2000 Series Indexer running with uncompiled
code under QuickBASIC was 285usec. The same code was run after it was compiled, and it took only 153usec. To Set
the Position under these same conditions, it took 341usec uncompiled, and 269usec compiled.