Anaheim CLCI2000 Programming with Anaheim Automation Libraries, Index ADR, Axis GO.CW ADR, Axis

Page 13

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.

10

Image 13
Contents CLCI2000 Series Copyright Limited WarrantyDisclaimer TrademarksTable of Contents Description Main FeaturesGeneral Description Packing InformationOrdering Information CLCI2004DPI65201 DPI65202AA37MMC-6 AA37MFC-10AA37MMC-10 AA2M37Specifications Installing the Board InstallationWiring to the CLCI2000 Address SettingsQuickstart with Quickbasic Clock Signals Connector Descriptions+5VDC Soft Limit Direction SignalsHome Limit Hard LimitInputs Encoder InputsOutputs Programming with Quickbasic or Visualbasic for DOS Programming with Anaheim Automation LibrariesIndex ADR, Axis GO.CW ADR, Axis Speed ConsiderationsCLCISUB1.BAS Library ONE.AT.MAX.CW ADDRESS, AXIS# ONE.AT.MAX.CCW ADDRESS, AXIS#ORIGIN.INDEX.CCW ADDRESS, AXIS# RAMP.TO.BASE.CCW ADDRESS, AXIS# ORIGIN.INDEX.CW ADDRESS, AXIS#RAMP.TO.BASE.CW ADDRESS, AXIS# RAMP.TO.STOP.CCW ADDRESS, AXIS#SLEW.AT.BASE.CW ADDRESS, AXIS# SLEW.AT.BASE.CCW ADDRESS, AXIS#Initialize ADDR,AXIS Sample #1 Program SAMPLE1.BAS on the CLCI2000 DiskTOP.OF.LOOP If GET.INPUTADDR,1 = 1 then Index ADDR,AXIS,5000Initialize ADDR, Axis Sample #2 Program SAMPLE2.BAS on the CLCI2000 DiskHOME.TYPE.1 LIMIT.CONTROL ADDR, AXIS, 0, 0CLCISUBS.CPP Program Function Definitions Oneatmaxcw ADDRESS, Axis Oneatmaxccw ADDRESS, AxisOriginindexccw ADDRESS, Axis Originindexcw ADDRESS, AxisSlewatbasecw ADDRESS, Axis Slewatbaseccw ADDRESS, AxisSoftinputccw ADDRESS, Axis Softinputcw ADDRESS, AxisUsing the DLL with Visual Basic for Windows Using the CLCI2000 Indexer with WindowsObject Command1Procedure Click Programming in WindowsAnaheim Automation DLL Library Support WIN2000.BAS Program ListingRunning the Software CLCI2004 Program GeneratorFunction Window F3 Delete F1 InsertF4- Terminal F5 SaveF2 Single Step F1 Prog StopF3 Clear Program F4 Printing a ProgramCommand Window Command Summary CLCI2004 Program Generator Command DictionaryCommand Dictionary Direction + orEncoder Window any integer Encoder Resolution any numberFinish Move no value GO Index no valueJump to Line 1 to UNITS/SCALE any number Base Setting not in HZ Register # Bits Setting Range DescriptionMAX Setting not in HZ Ramp SettingCommand Buffer Register Description of Command Input and Output Control Commands Initial Setup CommandsList of Equations Acceleration = MAX Speed Base Speed / TUP Page