Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manuel d'utilisateur

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Équipement Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot. Rockwell Automation 2098-IPD-xxx Ultra5000 C Programming using the Motion Library User Manual Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 114
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs

Résumé du contenu

Page 1 - Ultra5000

Ultra5000™ C Programming using the Motion LibraryProgramming Manual

Page 2 - Important User Information

Publication 2098-PM001E-EN-P — July 2002P-2 PrefaceContents of this ManualThis manual contains the following sections:Related DocumentationThe followi

Page 3 - Table of Contents

Publication 2098-PM001E-EN-P — July 2002A-2 Updates to the Motion LIbraryUpdates to the Motion Library for Ultraware Release 1.2 New Library Functions

Page 4 - Chapter 2

Publication 2098-PM001E-EN-P — July 2002Updates to the Motion LIbrary A-3Modified library FunctionsLatchGetOutput(channel);In previous Ultraware versi

Page 5 - Table of Contents iii

Publication 2098-PM001E-EN-P — July 2002A-4 Updates to the Motion LIbrary

Page 6

Publication 2098-PM001E-EN-P — July 2002IndexAAllen-Bradley supportgeneral informationP-3IMC e-mail addresses, see back coverIMC fax numbers, see back

Page 7 - Table of Contents v

Publication 2098-PM001E-EN-P — July 2002 I-2 Indexdeclarations 1-19definition1-21, 1-21- (arithmetic operator)1-20-- (arithmetic operator) 1-2

Page 8 - Appendix A

Publication 2098-PM001E-EN-P — July 2002 Index I-3CamGetCycleCount 2-22CamGetCycleLimit 2-22CamGetFreeSegments 2-22CamHarmonic 2-27CamHarmonicCy

Page 9 - Who Should Use this

Publication 2098-PM001E-EN-P — July 2002 I-4 IndexProgramIsRunning 2-16ProgramKill 2-15ProgramRun 2-15ProgramStop 2-15RatchetGetVel 2-11Ratche

Page 10 - Conventions Used in this

Publication 2098-PM001E-EN-P — July 2002 Index I-5AxisGetPGain 2-5AxisGetPosError 2-5AxisGetUpperCurLimit 2-5AxisGetVelError 2-6AxisIsEnabled 2-

Page 11 - Allen-Bradley Support

Publication 2098-PM001E-EN-P — July 2002 I-6 IndexMoveAtSpeed 2-46MoveCloseBuffer 2-41MoveCorrect 2-41MoveCorrectAbs 2-42MoveCorrectInc 2-42Mo

Page 12 - P-4 Preface

Publication 2098-PM001E-EN-P — July 2002 Index I-7break 1-27build (command) 1-2conditional expressions 1-21constants 1-5continue 1-27control flo

Page 13 - Creating A Basic Motion

Publication 2098-PM001E-EN-P — July 2002Preface P-3Using Online HelpThe following types of online help are available:Allen-Bradley SupportAllen-Bradle

Page 14

Publication 2098-PM001E-EN-P — July 2002 I-8 IndexSerialPutChar 2-16SerialPutString 2-17SerialReceiverFull 2-17SerialTransmitterEmpty 2-17Slee

Page 15

1Notes

Page 18 - Example 2.1 Explained

Publication 2098-PM001E-EN-P — July 2002 0013-1085-005-01Supercedes Publication 2098-PM001D-EN-P – January 2002 © 2002 Rockwell Automation, Inc. All

Page 19

Publication 2098-PM001E-EN-P — July 2002P-4 Preface

Page 20 - Example 2.2 Explained

1 Publication 2098-PM001E-EN-P — July 2002Chapter 1Programming Motion Control in C IntroductionThe chapter introduces you to the C language and progra

Page 21 - #define name replacement_text

Publication 2098-PM001E-EN-P — July 20021-2 Programming Motion Control in CThe first short program you will write: • Moves the axis 1000 counts in the

Page 22 - Example 2.3 Explained

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-33. Open the source file and enter the following text with the text editor:#

Page 23 - User Defined Functions

Publication 2098-PM001E-EN-P — July 20021-4 Programming Motion Control in CExample 1 ExplainedAny C program, whatever its size, consists of functions

Page 24 - Example 3 Explained

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-5Variables, Loops, and Constants The next example is a motion program that m

Page 25 - Program Stop

Publication 2098-PM001E-EN-P — July 20021-6 Programming Motion Control in CExample 2.1 ExplainedThe program still consists of a single function main.

Page 26 - Example 4 - A Jog Program

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-7endpoint) the loop ends, and execution continues at the statement that foll

Page 27 - Example 5 - A Gear Program

Important User InformationBecause of the variety of uses for the products described in this publication, those responsible for the application and us

Page 28 - Non-Volatile Storage

Publication 2098-PM001E-EN-P — July 20021-8 Programming Motion Control in CExample 2.2 - Varying the Program using VariablesThere are many different w

Page 29 - Notice that in the line

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-9is executed, and the condition is re-evaluated. The loop terminates when th

Page 30 - Expressions

Publication 2098-PM001E-EN-P — July 20021-10 Programming Motion Control in CExample 2.3 - Another Variance of the Program using VariablesA third way t

Page 31 - Arithmetic Operators

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-11User Defined FunctionsA function provides a convenient way to encapsulate

Page 32 - (binary form)

Publication 2098-PM001E-EN-P — July 20021-12 Programming Motion Control in C{MoveSetAcc(accdec); /* Initialize index move*/MoveSetVel(velocity);MoveSe

Page 33 - Conditional Expressions

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-13The declarationlong insert(long distance, long velocity, long accdec);just

Page 34 - Operator Precedence

Publication 2098-PM001E-EN-P — July 20021-14 Programming Motion Control in CExample 4 - A Jog Program#include <motion.h>#define JOGREVERSE 7 /*

Page 35 - Control Flow

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-15Example 5 - A Gear Program#include <motion.h>#define ADCCHANNEL 1 /*

Page 36

Publication 2098-PM001E-EN-P — July 20021-16 Programming Motion Control in CHoming with Latch FunctionsLatch functions are used to capture axis positi

Page 37

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-17controller’s non-volatile memory but only one of each type may be accessed

Page 38 - While, For and Do-While Loops

i Publication 2098-PM001E-EN-P — July 2002Table of ContentsPrefaceIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 39 - Break and Continue

Publication 2098-PM001E-EN-P — July 20021-18 Programming Motion Control in CTypes, Operators, and ExpressionsThe C language allows you a great deal of

Page 40

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-19Two limitations that apply to variable names are: • Underscores (“_”) coun

Page 41 - #include <motion.h>

Publication 2098-PM001E-EN-P — July 20021-20 Programming Motion Control in Clists the precedence and describes the functions and any limitations place

Page 42 - Control Setting Functions

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-21Relational and Logical OperatorsThe relational operators (<, <=, >

Page 43

Publication 2098-PM001E-EN-P — July 20021-22 Programming Motion Control in CFor example, the following code yields the absolute value of a number. if

Page 44 - Axis Attributes

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-23Control FlowIn this section you will learn about the functions that contro

Page 45

Publication 2098-PM001E-EN-P — July 20021-24 Programming Motion Control in CIn grouping example A, the assignment statement is included in the while l

Page 46

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-25The last statement (else) performs the default or “none of the above” case

Page 47

Publication 2098-PM001E-EN-P — July 20021-26 Programming Motion Control in CSwitchThe switch statement performs a multiple path decision. It tests whe

Page 48 - Axis Services

Publication 2098-PM001E-EN-P — July 2002Programming Motion Control in C 1-27the update (expression3) is evaluated. The loop is repeated until test (ex

Page 49 - Axis Status

Publication 2098-PM001E-EN-P — July 2002 ii Table of ContentsStatements and Blocks . . . . . . . . . . . . . . . . . . . . . . . . . 1-23Example

Page 50 - Control Attributes

Publication 2098-PM001E-EN-P — July 20021-28 Programming Motion Control in C

Page 51

1 Publication 2098-PM001E-EN-P — July 2002Chapter 2Referencing the Motion LibraryThis chapter provides information on the functions available in the U

Page 52 - Control Services

Publication 2098-PM001E-EN-P — July 20022-2 Referencing the Motion LibraryControl Setting FunctionsControl Setting functions directly control aspects

Page 53

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-3Control Attributes• ControlGetFault• EncoderGetFaultState• EncoderGetOutput•

Page 54

Publication 2098-PM001E-EN-P — July 20022-4 Referencing the Motion LibraryAxis Attributeslong AxisDefinePos(long position);Sets the axis command posit

Page 55 - Program Services

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-5float AxisGetFeedbackVel(void);Returns the feedback velocity of the axis in

Page 56 - Serial Services

Publication 2098-PM001E-EN-P — July 20022-6 Referencing the Motion Libraryfloat AxisGetVelError(void);Returns the velocity error in counts/second. Not

Page 57 - Timer Services

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-7long AxisSetUpperCurLimit(float limit);Sets the upper current limit in Amps.

Page 58 - Timer Status

Publication 2098-PM001E-EN-P — July 20022-8 Referencing the Motion LibraryAxis Serviceslong AxisDisable(void);Disables the axis (amplifier). Returns 0

Page 59 - Motion Functions

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-9Axis Statuslong AxisIsEnabled(void);Determines if Axis is enabled. Note: Pri

Page 60

Publication 2098-PM001E-EN-P — July 2002Table of Contents iiiControl Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10lo

Page 61

Publication 2098-PM001E-EN-P — July 20022-10 Referencing the Motion LibraryControl Attributeslong ControlGetFault(void);Returns controller fault. Vali

Page 62 - Cam Attributes

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-11long EncoderGetFaultState(long channel);Returns state of fault checking for

Page 63 - Cam Services

Publication 2098-PM001E-EN-P — July 20022-12 Referencing the Motion LibraryControl Serviceslong ControlClearFault(void);Clears a controller fault. Ret

Page 64 - Cycloidal Curve

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-13long EncoderSetPolarity(long channel, long polarity);Sets the polarity of t

Page 65 - Cycloidal Harmonic Curve

Publication 2098-PM001E-EN-P — July 20022-14 Referencing the Motion Librarylong SequencerAddNode(long frame, void* fptr, void* dptr);Inserts a user fu

Page 66

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-15Program Serviceslong InitMotionLibrary(void);Initializes the motion library

Page 67 - Harmonic Curve

Publication 2098-PM001E-EN-P — July 20022-16 Referencing the Motion LibraryProgram Statuslong ProgramIsRunning(char* name);Determines if the specified

Page 68 - Harmonic Cycloidal Curve

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-17long SerialPutString(const char *string);Puts a character string into the A

Page 69

Publication 2098-PM001E-EN-P — July 20022-18 Referencing the Motion LibraryTimer Statuslong TimerDone(long channel);Returns non-zero if specified time

Page 70 - Modified Sinusoidal Curve

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-19Motion FunctionsMotion functions include all functions that cause or direct

Page 71 - Modified Trapezoidal Curve

Publication 2098-PM001E-EN-P — July 2002 iv Table of Contentslong CamCloseTable(void); . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23l

Page 72

Publication 2098-PM001E-EN-P — July 20022-20 Referencing the Motion LibraryGear Attributes• GearGetVel• GearSetRatio• GearSlewSetAcc• GearSlewSetDecGe

Page 73

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-21Move Attributes• MoveSetAcc• MoveSetDec• MoveSetPos• MoveSetVelGet and set

Page 74

Publication 2098-PM001E-EN-P — July 20022-22 Referencing the Motion LibraryCam Attributeslong CamGetCycleCount(void);Returns the cam cycle count.The c

Page 75 - Cam Status

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-23long CamSetCycleLimit(long limit);Sets the cam cycle limit. The cycle limit

Page 76 - Gear Services

Publication 2098-PM001E-EN-P — July 20022-24 Referencing the Motion Librarylong CamCycloidal(long master_position, long follower_position);Adds a cycl

Page 77 - Jog Attributes

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-25long CamCycloidalHarmonic(long master_position, long follower_position);Add

Page 78 - Jog Services

Publication 2098-PM001E-EN-P — July 20022-26 Referencing the Motion Librarylong CamDisable(void);Disables electronic cam. Returns 0 if successful, or

Page 79 - Jog Status

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-27long CamHarmonic(long master_position,long follower_position);Adds a harmon

Page 80 - Move Attributes

Publication 2098-PM001E-EN-P — July 20022-28 Referencing the Motion Librarylong CamHarmonicCycloidal(long master_position, long follower_position);Add

Page 81 - Move Services

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-29long CamLoad(char* name);Loads cam table number one. • The name argument sp

Page 82

Publication 2098-PM001E-EN-P — July 2002Table of Contents vlong GearInProgress(void); . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37

Page 83

Publication 2098-PM001E-EN-P — July 20022-30 Referencing the Motion Librarylong CamModifiedSinusoidal(long master_position,long follower_position);Add

Page 84

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-31long CamModifiedTrapezoidal(long master_position,long follower_position);Ad

Page 85

Publication 2098-PM001E-EN-P — July 20022-32 Referencing the Motion Librarylong CamOpenTable(long table_number,long size,long order);Opens the cam tab

Page 86 - Move Status

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-33long CamQueueReset(void);Resets the queue.Returns 0 if successful, or -1 if

Page 87 - Digital and Analog I/O

Publication 2098-PM001E-EN-P — July 20022-34 Referencing the Motion Librarylong CamSaveTable(long table_number,char *name);Saves a cam table.• The tab

Page 88 - Digital Input Status

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-35Cam Statuslong CamIsEnabled(void);Determines if electronic cam is enabled.

Page 89 - Digital Output Attributes

Publication 2098-PM001E-EN-P — July 20022-36 Referencing the Motion LibraryGear Attributesfloat GearGetVel(void);Returns the gear velocity in counts/s

Page 90 - Digital Output Services

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-37long GearSlewDisable(void);Disables gearing slew. Returns 0 if successful,

Page 91 - Digital Output Status

Publication 2098-PM001E-EN-P — July 20022-38 Referencing the Motion Librarylong JogSetDec(float dec);Sets the default deceleration for the jog. Decele

Page 92 - Latch Functions

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-39long JogStop(void);Stops the jog motion using the programmed deceleration v

Page 93

Publication 2098-PM001E-EN-P — July 2002 vi Table of ContentsAnalog Output Attributes . . . . . . . . . . . . . . . . . . . . . . . 2-48long Ana

Page 94 - Latch Services

Publication 2098-PM001E-EN-P — July 20022-40 Referencing the Motion Librarylong JogInProgress(void);Determines if a jog is in progress.Returns non-zer

Page 95

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-41Move Serviceslong MoveAbort(void);Halts motion immediately, ignoring decele

Page 96 - Latch Status

Publication 2098-PM001E-EN-P — July 20022-42 Referencing the Motion Librarylong MoveCorrectAbs(long position);Corrects a move to stop at a new target

Page 97 - Non-Volatile Array

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-43long MoveDV(long distance, float vel);The distance argument is the delta di

Page 98 - Non-Volatile Array Services

Publication 2098-PM001E-EN-P — July 20022-44 Referencing the Motion Librarylong MoveDwell(float time);The time argument specifies the time duration fo

Page 99 - New Library Functions

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-45long MovePosition(long position);Starts an absolute move to the specified p

Page 100 - Release 1.2

Publication 2098-PM001E-EN-P — July 20022-46 Referencing the Motion LibraryMove Statuslong MoveAtSpeed(void);Determines if a move is currently at the

Page 101 - Modified library Functions

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-47Digital and Analog I/O FunctionsDigital and Analog I/O functions control di

Page 102

Publication 2098-PM001E-EN-P — July 20022-48 Referencing the Motion LibraryAnalog Output Attributeslong AnalogOutputSetVoltage(long channel, float vol

Page 103

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-49long InputGetState(long channel);Returns the state of the digital input spe

Page 104 - I-2 Index

1 Publication 2098-PM001E-EN-P — July 2002PrefaceIntroductionRead this preface to familiarize yourself with this manual. This preface covers the follo

Page 105 - Index I-3

Publication 2098-PM001E-EN-P — July 20022-50 Referencing the Motion LibraryDigital Output Serviceslong OutputSetAllOff(void);Turns all digital outputs

Page 106 - I-4 Index

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-51Digital Output Statuslong OutputGetAll(void);Returns the state of all digit

Page 107 - Index I-5

Publication 2098-PM001E-EN-P — July 20022-52 Referencing the Motion LibraryLatch FunctionsLatch functions control registration events. The table prese

Page 108 - I-6 Index

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-53long LatchGetCount(long channel);Returns the value of the latch counter. Th

Page 109 - Index I-7

Publication 2098-PM001E-EN-P — July 20022-54 Referencing the Motion LibraryLatch Serviceslong LatchOnIndex(long channel, long encoder, long rising);Ar

Page 110 - I-8 Index

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-55long LatchOnInput(long channel, long input, long rising);Arms a latch to tr

Page 111

Publication 2098-PM001E-EN-P — July 20022-56 Referencing the Motion Librarylong LatchSetAutoMode(long channel, long mode);Sets the auto mode of a latc

Page 112

Publication 2098-PM001E-EN-P — July 2002Referencing the Motion Library 2-57Non-Volatile Array FunctionsNon-volatile array functions store numeric valu

Page 113

Publication 2098-PM001E-EN-P — July 20022-58 Referencing the Motion Librarylong LongArraySetElement(long element, long data);Stores data into a previo

Page 114

1 Publication 2098-PM001E-EN-P — July 2002Appendix AThis appendix summarizes the library functions added in various releases of the Ultraware software

Commentaires sur ces manuels

Pas de commentaire