351
Ref: MN00112-009/LH,MC,BC/05-98 MN00112-009 MML Programmers Manual.doc NextMove MINT™ Motion Library Programmer’s Manual Issue: 3.2

NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Ref: MN00112-009/LH,MC,BC/05-98MN00112-009 MML Programmers Manual.doc

NextMoveMINT™ Motion Library

Programmer’s Manual

Issue: 3.2

Page 2: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Motion Library Programmers Manual: Issue 3.2 Page 2

This page left intentionally blank.

Page 3: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Motion Library Programmers Manual: Issue 3.2 Page 3

Copyright Baldor Optimised Control Ltd1997.

All rights reserved.

This manual is copyrighted and all rights are reserved. This document may not, in whole orin part, be copied or reproduced in any form without the prior written consent of BaldorOptimised Control.

Baldor Optimised Control makes no representations or warranties with respect to thecontents hereof and specifically disclaims any implied warranties of fitness for anyparticular purpose. The information in this document is subject to change without notice.Baldor Optimised Control assumes no responsibility for any errors that may appear in thisdocument.

MINT™ is a registered trademark of Baldor Optimised Control Ltd.

Baldor Optimised Control Ltd.178-180 Hotwell RoadBristolBS8 4RPU.K.Tel: (+44) (117) 987 3100FAX: (+44) (117) 987 3101BBS: (+44) (117) 987 3102

Technical SupportTel: (+44) (117) 907 3470E-mail: [email protected]

Page 4: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Motion Library Programmers Manual: Issue 3.2 Page 4

This page left intentionally blank.

Page 5: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Motion Library Programmers Manual: Issue 3.2 Page 5

Manual Revision History

Issue Date Reference Comments

2.3 June 96 MN00112-006 New functions added:AAABuild, ActiveLevel, ActiveZLevel,Backlash, BacklashInterval, BacklashMode,CANSTATUS, DaughterBoardFeatures,Debounce, Fastpos, FastposHandler,Feedrate, FeedrateMode, FeedrateOverride,HoldToAnalogue, HTAChannel, HTADamping,HTADeadband, HTAFilter, HTAGain,LocalBitRate, MoveBufferId, MoveBufferStatus,nodeLive, RemoteBitRate, RemoteIn,RemoteInx, RemoteNodeID,RemoteNodeError, RemoteOut, RemoteOutx,STATUSNODE, Suspend, ZLatch.Following functions removed:AverageVEL, LongStop

3.0 Apr 97 MN00112-007 The following functions have been added:AuxEncoder, AuxEncoderScale,AuxEncoderVel, AuxEncoderWrap,Boost, CANBaud, DACMode, DACMonitorAxis,DACMonitorGain, DACMonitorMode,DriveType,Encoder, EncoderScale, EncoderVel,EncoderWrap, FastAuxEncoder, FastEncoder,Gearing, GearingMode,INCA, INCR, LastMoveBufferID,MasterChannel, MasterSource,MaximumSpeed, NodeType, NumberOf,PreHomePosition, Pulse, PWMOnTime,PWMPeriod, RemoteBaud,RemoteDebounce, RemoteEStop,RemoteInputActiveLevel, RemoteNode,RemoteOutputError, RemoteReset,RemoteStatus, StepDirection

Page 6: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Motion Library Programmers Manual: Issue 3.2 Page 6

Issue Date Reference Comments

3.0 Apr 97 MN00112-007 The following functions have been removed:ActiveLevel, BOOSTOFF, BOOSTON,DaughterBoardFeatures, Debounce,FOLLOWAXIS, IndexSwitchInput, LocalBitRate,MasterEnc, MasterEncVelocity,MasterEncWrapHi, MasterEncWrapLo,NumberOfADCs, NumberOfDACs,NumberOfInputs, NumberOfOutputs,NumberOfServos, NumberOfSteppers,Platform, PosWrapHi, PosWrapLo,RemoteBitRate, RemoteNodeID,RemoteNodeError, selectBoardNumber

3.1 Nov 97 MN00112-008 The following functions have been added:CamAmplitude, CamPhase, CANHandler,Comms, CommsMode, FastAuxEncoderX,FastEncoderX, FastPosX, FastposHandlerX,Float, MasterDistance, OffsetDistance,OffsetMode, OffsetStatus, RemoteSetup,SerialBaud, SerialNode, SplineSuspendTime,tCls, tLocateCursor, tPrintf, tPutChar,tPutString, Uint, Word

The following functions have been removed:MASTERINC

3.2 Mar 97 MN00112-009 The following functions have been added:CamPhaseStatus, Kaccel, PreScale, RtsCts,SplineSegment

The following functions have been removed: PathMode, SERVOC, SERVOFF, SERVON

Page 7: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Contents

Motion Library Programmers Manual: Issue 3.2 Page 7

1. Introduction ................................................................... 91.1 Immediate Command Mode.......................................................9

2. Creating an Embedded Application......................... 112.1 Tools...............................................................................................11

2.2 An Example Application .............................................................11

2.2.1 v4.x Compiler ............................................................................12

2.2.2 v5.x Compiler ............................................................................13

2.3 Notes .............................................................................................13

3. The MINT Motion Library.............................................. 193.1 MML Data Types ..........................................................................19

3.2 Accessing dual port RAM ...........................................................20

3.3 Terminal Input/Ouput and Comms Support .............................21

3.4 Interrupt Handlers ........................................................................22

3.5 Error Handling...............................................................................23

3.5.1 System Errors ..............................................................................23

3.5.1.1 System Error Codes ................................................................25

3.5.2 Asynchronous Errors ..................................................................27

3.5.3 The Error Handler.......................................................................29

3.5.4 Miscellaneous Errors..................................................................32

3.5.5 Motion Errors ..............................................................................32

3.5.6 Example User Error Handler ......................................................34

3.6 Embedded Emulation .................................................................36

4. MML Function Reference............................................ 43

Page 8: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Contents

Motion Library Programmers Manual: Issue 3.2 Page 8

This page left intentionally blank.

Page 9: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Introduction

Motion Library Programmers Manual: Issue 3.2 Page 9

1. Introduction _________________________________NextMove is normally programmed using the MINT™ language, which is described in the‘MINT for NextMove Programmers Manual’. The MINT language consists of two basiccomponents. The interpreter level that gives the MINT language its functionality and theunderlying MINT Motion Library (known as MML) which provides the motion controlfunctionality. There may be applications in which MINT does not provide sufficiently highlevels of control or speed of operation. For these applications, it is possible to access theMINT Motion Library directly.

The MML is a library of functions that provides access to all the features of NextMoveusually accessible through MINT. There are two methods of accessing the MML.

• Embedded. An application is written in the C programming language which uses theMML. This is then compiled and linked using the Texas C31 cross compiler to producean embedded application that replaces MINT on the controller.

• Host (NextMove PC only). The MINT interface Library provides access to the MMLon the host. An application is written in C/C++, Visual Basic or Borland Delphi usingeither the source code provided or DLL calls. This host application then interfacesautomatically through MINT on the controller to the MML.

This manual serves two purposes.

• How to create an embedded application for NextMove.• Details on the MINT Motion Library for embedded or host use.This manual makes no reference to the general subject of ‘C’ programming and assumes abasic level of competence.

1.1 Immediate Command ModeThe process of using the MML from the host is known as Immediate Command Mode, orICM. It is used in applications where a user defined, custom front end is required that playsa large part in the motion application. For example, an application that requires a largenumber of interpolated moves to be calculated from a CAD package would calculate therequired moves and then use the MML calls to NextMove, as opposed to having todownload the data to MINT which then performed the moves.

Page 10: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Introduction

Motion Library Programmers Manual: Issue 3.2 Page 10

MML calls can be made using the ‘C’ or ‘C++’ source or via DLL calls, allowing hostprograms to be constructed in Visual Basic or Borland Delphi etc. The flow of informationis as below:

The MML function accessed on the host communicates with NextMove via dual port RAMwhere the actual function is performed. The handshaking through dual port RAM istransparent to the user.

The ‘MINT interface Library Users Guide’ describes how to create a host application usingthe MML in various languages.

Host Application DualPortRAMMINT Motion Library

(Host)

MINT.OUT

Host NextMove

MINT Motion Library

Page 11: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 11

2. Creating an Embedded Application __________Programming NextMove using ‘C’ requires a considerably higher level of expertise andcommitment of resources than using MINT. The tools required to program in this way mustbe sourced from third parties, some of which are very expensive.

Source code files are generated on a host using any development environment. Object codeand executables are generated using ‘C31 software development tools. These tools are notsupplied by Baldor Optimised Control. By linking with the supplied libraries, an executableapplication is created which is downloaded to NextMove replacing the normal MINT.OUTapplication.

2.1 ToolsNextMove PC and NextMove BX use the Texas TMS320C31 processor. To create anembedded application, you must have the Texas Instruments TMS320C31 compiler (codeTMDS3243855-02). Currently only v4.5, v4.7 and v5.0 of the compiler are supported.

The debugger and emulator package is useful for debugging but not essential (codeTMDR3260130).

The TI web site has details on all the products. HTTP://www.ti.com/sc/docs/dsps/tool.htm

Distributors include Avnet, Arrow, SEI and Macro.

2.2 An Example ApplicationUnder the NMPC and NMBX subdirectories installed, there is an EMBEDDED directory.This contains the MINT Motion Library files:

APPSTART.OBJ - contains the program entry point c_int00.MG.LIB and MG0.LIB - the MML.NMRTS3_0.LIB - the run-time library.NMRTS3_0.SRC - the run-time library source.

The EXAMPLE subdirectory contains two further subdirectories:

V4X - example application using v4.5 or v4.7 of the compiler.V5X - example application using v5.0 of the compiler.

It is important to use the examples in the correct directory for your compiler or theapplication will not build correctly.

Page 12: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 12

The example application C31APP.C is simply clicks the relay on and off.void main (void){ /*---------------------------------------------------------------------*/ /* Initialise NextMove */ /*---------------------------------------------------------------------*/ initialiseNextMove();

while(1) { ENABLE(1); /* Turn the relay on */ WAIT(500); /* Wait for 500 ms */ ENABLE(0); /* Turn the relay off */ WAIT(500); /* Wait for 500 ms */ }}

The call to initialiseNextMove() sets up NextMove and must be called at the start of theapplication. The ENABLE() function controls the state of the relay and the WAIT()function instructs NextMove to wait for a specified time period.

The NextMove PC version also has the line /*---------------------------------------------------------------------*/ /* Write an application code */ /*---------------------------------------------------------------------*/ putWord(roAPPLICATION_CODE, 100);

This writes an application number to an address in dual port RAM. This lets the NextMoveWorkBench or the updateFirmware() MIL function know that the application is running onNextMove.

2.2.1 v4.x CompilerThe V4X directory is for v4.5 and v4.7 compilers. To build the application, at the DOSprompt type:

COMPLINK C31APP

The COMPLINK.BAT file calls the COMPILE.BAT file, which compiles the source filespecified at the command line. It then calls the C31 linker LNK30 which links the objectfile to the libraries to produce C31APP.OUT in the OBJ directory.

For NextMove BX, the .OUT file is then converted into a .HEX file for download.

When writing your own application, it is important to use the compile and linker settingsfrom the example in order to produce an application that runs correctly. See the ‘CompilerUsers Guide’ for details of the switches and options used.

Page 13: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 13

2.2.2 v5.x CompilerThe V5X directory is for v5.0 of the compiler. To build the application, at the DOS prompttype:

BUILD

The BUILD.BAT file uses the compiler shell CL30 in order to compile the files specified inthe COMPILE.CMD command file. The linker LNK30 is then called with the LINK.CMDcommand file to produce an EMBEDDED.OUT for NextMove PC or EMBEDDED.HEXfor NextMove BX.

When writing your own application, it is important to use the compile and linker settingsfrom the example in order to produce an application that runs correctly. See the ‘CompilerUsers Guide’ for details of the switches and options used.

You may easily build up your own application by specifying the files to use at the bottom ofCOMPILE.CMD and at the top of LINK.CMD.

There is currently no support for extended precision 40 bit floating point data types.

2.3 NotesFor full details on the Texas Instruments tools, refer to the documentation supplied withthem. Below are a number of points of interest.

initialiseNextMove()All embedded applications must call the function initialiseNextMove() before ANY otherMML functions.

Compiling CodeThe Texas Instruments (TI) compiler is an ANSI ‘C’ cross compiler with associated tools(assembler, linker, hex converter, etc.) that run on a PC. The tools are command line drivenutilities. There is no ‘integrated environment’ of the kind provided by other vendors. Thereis no built in editor so you are free to use your favourite editor to generate ‘C’ source files.The tools include:

• AC30 - compiler (parser)• ASM30 - assembler• CG30 - code generator• OPT30 - optimiser• LNK30 - COFF linker• CL30 - compiler shell, combines above 5 tools

Page 14: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 14

• HEX30 - hex converter• CLIST - interlist utility• AR30 - archiverAlthough the ‘C’ compiler conforms to the ANSI ‘C’ standard there are a few specialconsiderations that must be taken into account due to the processor architecture and designof the NextMove controller.

The quickest way to compile code is to use the compiler shell CL30.EXE. This is a utilitythat allows you to compile, assemble and optionally link code in a single step.

.c

filesParser

AC30

Optimiser

OPT30

Code

Generator

CG30

Assembler

ASM30

Linker

LNK30

.IF files

.OPT

files

.ASM

files

.OBJ

files

.OUT

file

Syntax, semantics error check

Produce more efficient code

Generate assembler code from

(optimised) internal representation

Generate native code

Combine all object files to create

executable output file

Intermediate file

(internal code representation)

Intermediate file

COFF object file

COFF executable file

The shell runs one or multiple files through the following individual tools:

• compiler - includes:• parser (AC30).• optimiser (OPT30).• code generator (CG30).

• assembler - makes COFF object (ASM30).

Page 15: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 15

• linker - makes COFF executable (LNK30).• hex conversion - convert COFF executable to intel Hex format for NextMove BX

(HEX30).

Run Time LibrariesTI supply a run time library in the form of a .LIB file that contains object code for common‘C’ functions like strcpy(), malloc(), etc. They also supply a set of header files that containthe function prototypes, macro definitions and some global variables. The header files areprovided as ‘C’ source files. Source for the run time library is also provided as an archivefile.

The standard run time library RTS.SRC includes maths functions written in ‘C’. TI providealternative source code for these functions written in assembler. These are claimed to befaster than the ‘C’ code versions. The TI run time library built with the assembler routinesis supplied. The source is archived in the normal way. The source and archive files arecalled:

• NMRTS3_0.LIB• NMRTS3_0.SRC

COFF FilesCOFF is an abbreviation for Common Object Format File. This is a structured file that maycontain symbolic information required by source level debuggers, relocation information forsmart loaders, etc. as well as the code itself. v5.0 of the compiler introduces two newversions of the COFF format. NextMove only supports COFF 0 format.

C_DIR Environment VariableThis environment variable is used by the TI compiler. It describes search paths that thecompiler should use to locate include files. You can specify multiple paths separated by ‘;’.e.g.:

C_DIR=..\..\..\..\host;C:\MYAPPLICATION

C_MODE Environment VariableThere are two versions of each of the TI tools, a protected mode version and a real modeversion. The compiler shell CL30 will normally invoke the real mode versions of the tools.You may find that during some stages of the compilation process the process is aborted witha ‘not enough memory’ error. The protected mode versions of the tools allow more memoryto be used. The C_MODE environment variable is used by the shell to determine whichversion of the tools it should invoke. The examples use the protected mode versions of thetools:

C_MODE=PROTECTED

Page 16: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 16

Memory ModelsThe TI compiler can generate code for two memory models - big and small. The bigmemory model is not used and should therefore not be used by any code linking to thelibraries. This is because the big model produces larger / slower code and is not suitable forreal time control.

The small model places no restriction on the on the size of code, stack or heap. All externalvariables, static variables and compiler generated constants in the entire program (afterlinking) must fit into 64K. The .bss section cannot cross any 64K page boundaries.

Should you require to generate large data structures that push your program datarequirements beyond the 64k limit, dynamically allocate memory from the heap. Thismethod allows access to the entire address range with no real speed or size penalty save forthe allocation / de-allocation overhead.

Argument PassingThe TI compiler allows you to specify whether function arguments are passed on the stackor within ‘C31 registers. The library code is compiled for stack argument passing. Usercode that is to be linked with the libraries should be compiled in the same way. Code willnot run if you link modules that have been compiled with different options.

Two Pass Parsing / Out Of Memory ErrorsMost of the development tools allocate memory from the heap to build tables duringprocessing. The tools may fail with ‘Out Of Memory’ errors if there is insufficient memoryon your machine.

The parser normally runs a one pass process. When it does this it uses PC memory to storemacro definitions and symbol definitions. When run in two passes these functions can beseparated. The first pass performs pre-processing so that memory is only required for themacro definitions. In the second pass there are no macro definitions so the maximumamount of memory is available for the symbol table. If you experience ‘out of memory’errors when compiling a solution may be to parse in two passes. See ‘TMS320 FloatingPoint DSP Optimising C Compiler User Guide’.

APPSTART.OBJThis is an object file supplied with the libraries. You should link your ‘C’ code with thisfile. It contains the program entry point c_int00. When a program begins running,APPSTART.OBJ is executed first. APPSTART.OBJ contains code and data for initialisingthe runtime environment.

Page 17: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 17

SectionsThe compiler produces six relocatable blocks of code and data. These blocks are calledsections:

• .TEXT - executable code• .CINIT - tables for initialising variables• .CONST - string constants and switch tables• .BSS - global and static variables• .STACK - system stack• .SYSMEM - heapThe compiler treats memory as a linear block that is partitioned into smaller blocks of codeand data. Each block of code or data that a ‘C’ program generates will be placed in its owncontiguous space in memory. It is the linker that defines the memory map and allocatescode and data into target memory.

You specify where these sections (and any sections that you define yourself) should belocated in the NextMove memory map within a linker command file. The example linkercommand file XAMPLINK.CMD (v4.x) and LINK.CMD (v5.x) illustrate how this is done.

Data TypesAll ‘C31 data types are represented in 32 bits. The range of values that a type may take isthe range that can be represented in 32 bits. char, int, long and float are all the same size(1). Note that the sizeof operator will return 1 for all types.

DivisionThere are no divide instructions on the ‘C31 so all division is done within library functions.These functions may take some time to execute. If you need to perform division in timecritical portions of code you should store the inverse and multiply if possible.

Variable InitialisationNotice that variables are not zero initialised as standard so you must do this in your code.You should not assume the value of any variable or pointer unless you have initialised ityourself.

Page 18: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

Creating an Embedded Application

Motion Library Programmers Manual: Issue 3.2 Page 18

This page left intentionally blank.

Page 19: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 19

3. The MINT Motion LibraryThe MINT Motion Library is a collection of functions that allow motion applications to bewritten. The format of the function calls and the way motion applications are constructed isvery similar to MINT.

Example:In MINT, to set the scale factor for axis 0 you would use:

SCALE.0 = 4096

The equivalent MML call in C is:setSCALE (0, 4096);

To read the position of axis 3 into a variable in MINT you would use:myVar = POS.3

The equivalent MML call in C is:float myVar;getPOS (3, &myVar);

There are some differences in naming between MINT and the MML.

Example:In MINT, to set the forward limit switch input for axis 0 to input 2 you would use:

FWLIMITIN.0 = 2

The equivalent MML call in C is:setForwardLimitSwitchInput (0, 2);

Apart from these sort of minor differences, the principles used for a MINT application areequally applicable to a MML based application. Therefore initial development time can besaved by using MINT to tune axes and learn the various features of NextMove. The motionapplication can often be proved using MINT and then converted to use the MML.

The basics of the move types and input / output handling are described in the ‘MINT forNextMove Programmers Manual’ and are not repeated here.

3.1 MML Data TypesAlthough all data types on NextMove are 32bit, it is still useful to use a data type that ismeaningful to the data being held.

Page 20: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 20

The MML defines a number of data types:__int8 - signed 8 bit__uint8 - unsigned 8 bit__int16 - signed 16 bit__uint16 - unsigned 16 bit__int32 - signed 32 bit__uint32 - unsigned 32 bitfloat - 32 bit float

The MML functions use data types appropriate to the size of the data being passed asarguements.

Example:The prototype for setSPEED() is

__int16 setSPEED (unsigned __int8 axisNo, float speed);

The return error code is defined as a signed 16 bit value, the axis number as an unsigned 8bit value and the speed to set as a floating point value.

All MML functions are prototyped in the file MG.H. The prototypes are of the form:NOMANGLE __int16 CCONV disableDrive (hMUL_CON_MP unsigned __int8 axisNo);

NOMANGLE, CCONV and hMUL_CON_MP are for when the file is compiled on the host.For embedded code, the prototype reduces to:

__int16 disableDrive (unsigned __int8 axisNo);

3.2 Accessing dual port RAMOn NextMove PC, there are a number of functions to read and write data to dual port RAMfrom an embedded application. DPR is 16 bits wide and is addressable in the range 0x001to 0x3FF. See the ‘MINT interface Library User Guide’ for details on the contents of DPR.

Read / write a float__int16 getFloat (__int16 nAddress, float *fValue);__int16 putFloat (__int16 nAddress, float fValue );

Read / write a signed 32 bit value__int16 getLong (__int16 nAddress, __int32 *lValue);__int16 putLong (__int16 nAddress, __int32 lLong );

Read / write a signed 16 bit value__int16 getWord (__int16 nAddress, __int16 *nValue);__int16 putWord (__int16 nAddress, __int16 nWord );

Page 21: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 21

Read / write an unsigned 16 value__int16 getUint (__int16 nAddress, __uint16 *unValue);__int16 putUint (__int16 nAddress, __uint16 unValue);

3.3 Terminal Input/Ouput and Comms SupportAll terminal input / output channels are now supported in the MML. The functions toaccess these are:

tCls Clear the terminal channel displaytGetChar Read a character from the terminal channeltLocateCursor Locate the cursor on the terminal channeltPrintf Print a string with formatting to the terminal channeltPutChar Write a character to the terminal channeltPutString Write a string to the terminal channelgetReadKey Read the currently pressed key on a KeypadNode

These functions accept the terminal channel as a parameter. It is not possible to globallyselect a number of channels as in MINT with the TERMINAL keyword. There is also noequivalent to the ECHO keyword.

Example:Write a the text ‘Hello’ to the RS232 channel.

tPrintf (tmRS232, 0, “\n\r Hello”);

Read a character from the KeypadNode 1.getReadKey (tmLCD1, &char);

The Comms protocol is also supported in the MML.

getComms Read a comms elementsetComms Write a comms elementgetCommsMode Read the current comms modesetCommsMode Set the comms mode

Page 22: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 22

3.4 Interrupt HandlersThere are a number of installable interrupt handlers in the MML which differ from those inMINT.

MINT MML install function

#ONERROR setErrorHandler#FASTPOS setFastposHandler#FASTPOS1..3 setFastposHandlerX#STOP setStopSwitchHandler#CAN setCANHandler#TIMER setUserInterruptHandler#IN[input] No equivalent

Example:Install a CAN Handler to handle the CAN event queue.

void myCANHandler (void); /* prototype the handler */

void main (void){ initialiseNextMove(); /* initialiseNextMove must be called */

setCANHandler (myCANHandler); /* Install the handler */ ...}

void myCANHandler (void){ /* This routine will be called asynchronously by CAN events */}

The auxiliary fast interrupts on NextMove BX are handled differently to MINT. In theMML there is only one handler that services all three of the auxiliary interrupts. A sourcenumber is passed to the handler to indicate the calling interrupt. This source can then beused to read the appropriate latch functions to retrieve the latched data.

Example:Install an auxiliary fast interrupt handler.

void myAuxFastHandler (__uint8 source); /* prototype the handler */

void main (void){ initialiseNextMove(); /* initialiseNextMove must be called */

setFastposHandlerX (myAuxFastHandler); /* Install the handler */ ...}

Page 23: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 23

void myAuxFastHandler (__uint8 source){ /* Routine called asynchronously by auxiliary fast interrupts */ float pos;

/* Read latched position of axis 0 from source latch */ getFastPosX (source, 0, &pos);}

The #TIMER periodic handler is known as the user interrupt handler in the MML. The callperiod is set with the setUserInterruptPeriod() function.

It is not possible to attach handlers to any of the digital inputs as in MINT.

3.5 Error HandlingNextMove is only concerned with run-time errors. These run-time errors are split into twodistinct groups, system errors and asynchronous errors.

3.5.1 System ErrorsSystem errors (synchronous errors) are essentially programming errors; caused by twoprimary reasons:

• sequencing problems - attempting to perform a function without prior configuration orattempting to perform an action when that action is illegal.

• range checking - passing values to functions that are not appropriate for the functioncall.

System errors do not stop program execution but may result in further system errors orasynchronous errors if not handled by the user. These errors are most likely to occur duringprogram development and debugging.

Most MML functions return a PASS / FAIL value as a result of the call. If the functionreturns FAIL then a system error has occurred. The yellow status LED will also blink toindicate the presence of a system error.

When a system error occurs, the information about that error is written to an internalstructure called the system error structure. The structure is defined as:

typedef struct { volatile unsigned __int32 code; /* code of last error detected */ volatile __int32 data; /* axis or board number if applicable */ volatile unsigned __int32 id; /* code for function where error found */} TSystemError;

• code describes the cause of the error. Possible values are shown in section 3.5.1.1.

Page 24: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 24

• data provides information about the cause of the error. Generally, if the axis or channelis out of range then -1 is returned as the data. Otherwise it is the axis or channel numberthat is returned.

• id is an enumeration of the function that caused the error to occur. All MML functionshave an enumeration which describes that function. These are detailed in the header fileMG.H which is installed as part of the installation process. Enumerations start from0x130 because of the way that interrupt codes are used in the interrupt register in DualPort Ram. The symbolic name is the function name prefixed with an _. E.g. The valueof the ABORT function is 0x130. The symbolic name _ABORT should be used insteadof the explicit value.

The system error structure is read by making a user copy of it with the getSystemError()function. This local structure can be read and cleared and then copied back to the internalstructure to clear the system error.

Example:/*----------------------------------------------------------------------*//* Call setACCEL and check that the call executed correctly. *//*----------------------------------------------------------------------*/TSystemError localSystemError;__uint8 failed;

failed = setACCEL ( 2, -100 ); /* Deliberately make function fail */if (failed) { /*--------------------------------------------------------------------*/ /* Call failed. Read the system error structure */ /*--------------------------------------------------------------------*/ getSystemError (&localSystemError);

/*--------------------------------------------------------------------*/ /* Check if the error is setACCEL. If yes, set accel to low value */ /*--------------------------------------------------------------------*/ if (localSystemError.id == _setACCEL) setACCEL(0, 1);

/*--------------------------------------------------------------------*/ /* Clear the structure and write it back */ /*--------------------------------------------------------------------*/ localSystemError.code = 0; localSystemError.data = 0; localSystemError.id = 0; setSystemError (&localSystemError);}

Only the first system error to occur is recorded in the structure. Subsequent errors will notbe detailed until the error structure is cleared. This is because later system errors may be aresult of some initial system error.

Page 25: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 25

System errors do not invoke the user installed error handler and so the structure needs to bechecked manually. This can either be done after every function call by checking the returnvalue for PASS / FAIL or done periodically after a number of functions by copying the errorstructure and checking the value of the error ‘code’.

3.5.1.1 System Error CodesSystem error codes returned in the code field of the system error structure are as follows:

Code Error Constant Meaning

0 erSUCCESS No system error.1 erMML_ERROR Can be used to check if a function fails2 erINVALID_AXIS Call to a function with an axis number

outside the permitted range.3 erVALUE_OUT_OF_RANGE Call to a function with a parameter

outside the permitted range.4 erINVALID_CHANNEL Call to a function with an I/O channel or

remote node number outside the permittedrange.

5 erNO_INPUT_SPECIFIED Call to a function which requires that aninput channel has previously beenassociated with a special function. eg: tobe an axis limit.

6 erNO_OUTPUT_SPECIFIED Call to a function which requires that anoutput channel has previously beenassociated with a special function. eg: tobe an axis enable.

7 erINVALID_INPUT Call to a function with an input channelnumber outside the permitted range.

8 erINVALID_OUTPUT Call to a function with an output channelnumber outside the permitted range.

9 erOUT_OF_MEMORY Call to a function which attempts toallocate memory from the heap and theallocation fails. eg: changing the size ofmove buffers.

10 erMOTION_IN_PROGRESS Call to a function that requires that aparticular axis or group of axes are idleand at least one is not. eg: CallingsetMOVEA when the axis is jogging.

Page 26: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 26

Code Error Constant Meaning

11 erAXIS_NOT_RIGHT_TYPE Call to a function that requires an axis orgroup of axes to be configured in aparticular way.

12 erMOTION_ERROR Call to a function that attempts to set up amove but the axis already has anasynchronous error present.

13 erTABLE_ERROR Error with a cam, spline or precision tabledefinition.

14 erCAN_ERROR Failed to initialise the CAN bus orunknown synchronous CAN error.

15 erCHANNEL_NOT_RIGHT Call to a function that requires a channelto be configured in a particular way.

16 erDPR_TIMEOUT Dual Port RAM data transfer timeout17 erWRONG_PLATFORM Call to a function not supported on this

variant of NextMove. E.g: Trying toaccess Dual Port RAM on NextMove/BX.

18 erDB_ERROR Failed to initialise a NextMove Expansionboard correctly.

19 erSERIAL_ERROR No reply received to master/slave commsmessage or slave replied with NAK.

20 erWRONG_NODE_TYPE Call to a function not supported by thetype of CAN node specified.

21 erCAN_TIMEOUT A CAN node failed to reply within thetimeout period.

22 erNODE_NOT_LIVE The function requires the CAN node to belive.

23 erTYPE_NOT_SUPPORTED The CAN node type specified is notsupported

24 erINVALID_HARDWARE The hardware required for the function isnot present.

25 erCMS_DATABASE_FULL Reserved26 erINVALID_NODE_ID Call to a function with a CAN node

identifier outside the permitted range.27 erREMOTE_EE_FAIL Static configuration not stored correctly

to EEPROM on a CAN node.28 erINVALID_REMOTE_BAUD The CAN node does not support the

requested baud rate.29 erREMOTE_SYNC_ERROR The CAN node has replied with an error.

Page 27: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 27

Code Error Constant Meaning

30 erREMOTE_ESTOP_ACTIVE The CAN node is in an emergency stopstate and cannot perform this function.

31 erINVALID_BUS_NUMBER Reserved32 erNO_FREE_CAN_OBJECTS Reserved33 erCAN_NOT_OPERATIONAL Reserved34 erCAN_TX_BUFFER_FULL Reserved35 erTERMINAL_UNAVAILABLE The terminal channel specified is not

available on this NextMove type or is notready for use.

36 erTERMINAL_OUT_OF_RANGE Call to a function with a terminal channeloutside the permitted range.

37 erEEPROM_ERROR The controller EEPROM data iscorrupted.

38 erTERMINAL_BUFFER_EMPTY The are no characters in the terminalchannel receive buffer

39 erTERMINAL_BUFFER_FULL There is no space in the terminal channeltransmit buffer.

40 erDRIVE_DISABLED The axis must be enabled with its driveenable output or the relay before a movecan be loaded.

41 erNO_CONNECTION Reserved42 erCAN_PROTOCOL_ERROR Reserved43 erINVALID_LOCAL_NODE Reserved44 erNOT_NETWORK_MASTER The controller must be configured as a

network master in order to access othercontrollers in a RS485 multi-dropnetwork.

3.5.2 Asynchronous ErrorsAsynchronous errors are errors that can occur at any time and can not be attributed to anyone function call. Asynchronous errors are split into two groups.

• Miscellaneous Errors. These are general purpose errors such as output short circuitprotection.

• Motion Errors. These are errors that are directly linked to an axis such as exceeding themaximum following error or hitting a hardware limit.

Page 28: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 28

When an asynchronous error occurs, the details of that error are written into an internalstructure called the asynchronous error structure. This structure is able to report multipleerrors at once, any error remaining in the structure until it is cleared by the user. The redstatus LED will also blink to indicate the presence of an asynchronous error.

Asynchronous errors are held in a structure called TAsyncError which has the format:typedef struct { volatile unsigned __int32 present; /* indicates error present */ volatile unsigned __int32 misc; /* miscellaneous errors */ volatile unsigned __int32 axis[cnMAX_AXES]; /* motion errors */} TAsyncError;

• present indicates that there is an error present. 0 for no error, 1 for an error.• misc holds a bitmap of any miscellaneous errors.• axis[cnMAX_AXES] holds details of axis errors. There is an error register for each axis

which contains a bitmap of the error types.In order to read this structure, a copy of it is made using the getAsyncError() function.

/*---------------------------------------------------------------------*//* Define a structure of type TAsyncError to hold local copy *//*---------------------------------------------------------------------*/TAsyncError errorStructure;

/*---------------------------------------------------------------------*//* Make a copy of the structure *//*---------------------------------------------------------------------*/getAsyncError (&errorStructure);

This local copy can then be read and modified as needed. Errors can be cleared directly bywriting into the structure to remove errors. Errors can also be manually generated bycreating them in the structure. To inform NextMove of these changes, the structure needs tobe copied back to the internal one using the setAsyncError() function.

/*---------------------------------------------------------------------*//* Copy the local copy back to the internal one *//*---------------------------------------------------------------------*/setAsyncError (&errorStructure);

Possible miscellaneous errors are:

Bit Error Constant Meaning

0 me12V An output bank has an error1 meOUTPUTS The 12 volt rail has failed

Page 29: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 29

Possible motion errors are:

Bit MINT constant Meaning

0 erABORT The ABORT function has been called.1 erFWD_HARD_LIMIT The digital input assigned as the forward limit

switch has been activated.2 erREV_HARD_LIMIT The digital input assigned as the reverse limit

switch has been activated.3 erFWD_SOFT_LIMIT The axis position has exceeded the value set as the

forward software limit position.4 erREV_SOFT_LIMIT The axis position has exceeded the value set as the

reverse software limit position.5 erFOLLOWING_ERROR The error between an axis demand position and its

measured position has exceeded the limit set as themaximum following error.

6 Reserved7 erERROR_INPUT The digital input assigned as the error input switch

has been activated.8 Reserved9 Reserved10 erADC_ERROR An analog input channel associated to this axis has

exceeded the upper or lower limits set for thatchannel.

11 erSLAVE_SYNC_ERROR A cam move has lost synchronisation.

When an asynchronous error occurs, the user installed error handler will be called if it isdefined. Within the error handler, it is possible to determine the error type and to takeappropriate action. NextMove will take a ‘default action’ in response to asynchronousmotion errors. The default action depends on the error and motion type. Some motionerrors have a mode function which allows a choice of default action.

The getAxisStatus() function can be used to monitor the status of potential errors on an axis.

3.5.3 The Error HandlerError handling can be divided into two stages:

• User supplied action - performed by a user supplied error handler.• Default action - performed by NextMove.

Page 30: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 30

It is possible for the user to install an error handling function. When an asynchronous erroroccurs, this error handler will be called so that the error can be handled by the user. Defaultaction is what NextMove will do if, on return from the error handler, any errors are stillpresent.

Default action will also take place if no user error handler is defined or it is disabled. Insome situations, the default action that will be performed may be adequate and so there is noneed for the user to handle the error. The default action that takes place depends on theerror and also upon the configuration selected by the user. A number of error types havefunctions which allow the user to define the type of default action to take. These aredescribed later.

For example: If an axis exceeds its maximum following error limit, the default actionfunction for following error, FEMode(), is checked. If the mode is set to feIGNORE thenno further action is taken but the condition can still be read with the AxisStatus() function.If defined, the user error handler will be called, otherwise default action will be called. Ifthe error handler does not clear the error then default action will be called. For defaultaction, the FEMode() is checked again and the action it describes taken.

Default action only makes an axis safe however. For most error types, it will not clear theerror register and so the error will continue to be signalled even though the axis has stoppedand is idle. The user still needs to clear the error by writing to the asynchronous errorstructure or by calling CANCEL() or RESET().

Example:If a forward hardware limit occurs on axis 0, handle the error immediately.

void myErrorHandler (void){ TAsyncError asyncError; __uint8 active;

getAsyncError (&asyncError); if (asyncError.axis[0] & erFWD_HARD_LIMIT) { DISLIMIT (0); /* Disable limit detection */ CANCEL (0); /* Crash stop motion, clear error */ setJOG (0, -1); /* Jog off limit at -1 uu/sec */ do { getLIMITF (0, &active); /* Read limit switch */ } while (active); /* Until off limit */ ENLIMIT (0); /* Enable limit detection */

return; /* Return from handler. No default action will occur */ /* since the error has been cleared */ }}

Page 31: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 31

Example:If a forward hardware limit occurs on axis 0 then let default action take place beforehandling the error. Assuming default action has been set to ramp down with theHardwareLimitMode() function.

void myErrorHandler (void){ TAsyncError asyncError; __uint8 idle; __uint8 active;

getAsyncError (&asyncError); if (asyncError.axis[0] & erFWD_HARD_LIMIT) { getIDLE (0, &idle); /* See if axis is idle */ if (!idle) return; /* If not then return to allow */ /* default action to occur */

/* If idle then axis has ramped to rest. Now clear */ /* the error */ DISLIMIT (0); /* Disable limit detection */ CANCEL (0); /* Crash stop motion, clear error */ setJOG (0, -1); /* Jog off limit at -1 uu/sec */ do { getLIMITF (0, &active); /* Read limit switch */ } while (active); /* Until off limit */ ENLIMIT (0); /* Enable limit detection */

return; /* Return from handler. No default action will occur */ /* since the error has been cleared */ }}

Each error condition acts slightly differently but most follow the principle described in theabove example. Each error is described in the following sections.

Using the error handler, it is also possible to stop default action from occurring. By writingto the asynchronous error structure and clearing a particular error, default action will nottake place since the error is no longer present. If the cause of the error has not been resolvedhowever, the error will be re-generated on the next sample interval (2ms for most errorconditions).

There are a number of functions associated with motion errors. These are:

• ADCError(). Read the current analog input channels that are causing an analog error onthe axis.

• AxisStatus(). Read the axis status register.• ERROR(). Read the axis error register. This is the same as the axis error in the

asynchronous error structure and is a quick way of reading motion errors.

Page 32: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 32

• ErrorMask(). Read or set the error mask for the axis. Setting a bit in the mask allowsthe error handler to be called if that error occurs. The default error mask for all axes isthat all defined bits are set.

The CANCEL() function will clear an error on an axis. If the source of the error is notremoved though, the error will be re-generated. Error detection may be disabled beforecalling CANCEL() which allows the axis to be brought to a safe position prior to errordetection being re-enabled. The RESET() function can be used to clear the error and enablethe axis but will clear axis position. CANCEL() also clears the miscellaneous errors.

‘crash stop’ means that any moves on an axis are immediately terminated withoutusing any deceleration ramp and the axis will servo at its current position.

3.5.4 Miscellaneous Errors• me12V - The 12 volt supply rail to NextMove has failed. This means that DAC voltage

will be lost. The user supplied error handler will be called if it is defined. Defaultaction just clears the error bit.

• meOUTPUTS - Digital output short circuit protection has been tripped on NextMoveBX. All outputs will be set inactive and the relay will be in its error state (normallyopen contact open). Default action just clears the error bit. It is suggested that theABORT function is called in response to this error since losing all outputs and the relaywill most likely result in the axis drives being disabled.

No ‘mode’ functions are associated with miscellaneous errors so these errors cannot bedisabled. The user supplied error handler will always be called.

3.5.5 Motion ErrorsMotion errors describe asynchronous errors that are attributed to a particular axis. An axiscan have more than one error at once. Each axis is referenced as an array element in theerror structure and errors for each axis are represented as a bitmap.

Each axis keeps a status register of error conditions that are current on that axis. Forexample, if an axis exceeds its maximum following error then the corresponding bit in theaxis status register will be set. The axis status register is then compared with the errordefault action function (where applicable). If the mode is to ignore the error then no errorwill be generated. If the mode is set to something other than ignore, the error register in theasynchronous error structure will be written to.

• erABORT - An abort error is generated by a call to the ABORT function. This callprovides an easy means of generating an axis error on all axes. The user supplied error

Page 33: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 33

handler will be called if it is defined. Default action is to crash stop all axes and removethe drive enable signal and drop the relay.

• erFWD_HARD_LIMIT, erREV_HARD_LIMIT - These errors are generated when thedigital input configured to be an axis forward or reverse limit switch input becomesactive. The default action mode is set with the HardwareLimitMode() function. Theseerrors can be disabled by setting the mode to hlIGNORE. A call to the functionDISLIMIT() is equivalent to setting the mode to ignore. Calling ENLIMIT() will restorethe mode to the last mode set. The user supplied error handler will be called if it isdefined. Default action will be taken according to the mode set. The limit inputs areassigned with the ForwardLimitSwitchInput() and ReverseLimitSwitchInput() functions.The state of the limit switches can be read with the LIMITF() and LIMITR() functions.A forward hardware limit error will only be generated if the forward limit input isactivated whilst the axis is moving in a forward direction. A reverse hardware limit errorwill only be generated if the reverse limit input is activated whilst the axis is moving ina reverse direction.

• erFWD_SOFT_LIMIT, erREV_SOFT_LIMIT - These errors are generated when theaxis position exceeds the bounds set by the ForwardSoftwareLimit() andReverseSoftwareLimit() functions. The default action mode is set with theSoftwareLimitMode() function. These errors can be disabled by setting the mode toslIGNORE. A call to the function DISLIMIT() is equivalent to setting the mode toignore. Calling ENLIMIT() will restore the mode to the last mode set. The usersupplied error handler will be called if it is defined. Default action will be takenaccording to the mode set. A forward software limit error will only be generated if theaxis is moving in a forward direction when the limit is exceeded. A reverse softwarelimit error will only be generated if the axis is moving in a reverse direction when thelimit is exceeded.

• erFOLLOWING_ERROR - This error is generated when the axis following error, thedifference between the axis demand position and the axis measured position, exceedsthe maximum permitted error as set by the MFOLERR() function. The default actionmode is set with the FEMode() function. The error can be disabled by setting the modeto feIGNORE. The user supplied error handler will be called if it is defined. Defaultaction will be taken according to the mode set.

• erERROR_INPUT - This error is generated when the axis error input is activated. Theerror input switch is defined with the ErrorInput() function. When this switch isactivated, the user supplied error handler will be called if it is defined. Default action isto crash stop the axis and remove the drive enable signal and drop the relay.

• erADC_ERROR - Analog input channels can have maximum and minimum limit valuesassigned to them with the MaxAnalogue() and MinAnalogue() functions. In order togenerate a motion error, the analog channel must be associated with an axis with the

Page 34: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 34

MonitorChannels() function. This error will be generated if any of the analog channelsassociated with the axis exceed the limit values set for those channels. The usersupplied error handler will be called if it is defined. Default action is to crash stop theaxis and remove the drive enable signal and drop the relay. The ADCError() function isused to see which analog channel and which limit caused the axis to have an analoglimit error.

• erSLAVE_SYNC_ERROR - An axis performing a cam profile, loaded with the Cam()function, can skip over very short slave segments if the master velocity is such that theslave segment is less than 2ms in length. If more than 5 slave segments are skipped in a2ms profile interval, a motion error will be generated on the axis and the user suppliederror handler will be called if it is defined, indicating that the master is travelling toofast for the length of the slave segments defined. Default action is to crash stop the axisand remove the drive enable signal and drop the relay.

3.5.6 Example User Error HandlerA generic example error handling routine is very difficult to produce since every applicationwill be different. An application may not be capable of generating certain errors, others maydeliberately use the error handler as a normal part of the program whereas others may use itonly to handle occasion off normal conditions or failures. The example shown below showshow the various errors may be checked for and singled out, the actions performed as a resultof any error being left to the user application.

/*-----------------------------------------------------------------------*//* Program to provide an example error handler. *//*-----------------------------------------------------------------------*/#include “mg.h”

/*-----------------------------------------------------------------------*//* Function definitions *//*-----------------------------------------------------------------------*/void errorRoutine (void);void miscError (uint errorCode);void axisError (__uint8 axis, __uint32* errorCode);

/*-----------------------------------------------------------------------*//* Main program. Define the user supplied error handler *//*-----------------------------------------------------------------------*/void main (void){ initialiseNextMove(); setErrorHandler (errorRoutine); /* Define the error handler */ .... /* Rest of application */}

/*-----------------------------------------------------------------------*//* Call handlers dependant on the error type. *//*-----------------------------------------------------------------------*/void errorRoutine (void){

Page 35: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 35

TAsyncError asyncError; /* Define a structure of type TAsyncError. */ /* This is used to store a copy of the */ /* asynchronous error structure */ __uint8 i;

/*---------------------------------------------------------------------*/ /* Copy the asynchronous error structure into a local copy */ /*---------------------------------------------------------------------*/ getAsyncError (&asyncError);

/*---------------------------------------------------------------------*/ /* Check for a miscellaneous error */ /*---------------------------------------------------------------------*/ if (asyncError.misc) miscError(asyncError.misc);

/*---------------------------------------------------------------------*/ /* Check for axis errors */ /*---------------------------------------------------------------------*/ for (i = 0; i < cnMAX_AXES; i++) { if (asyncError.axis[i]) axisError (i, &asyncError.axis[i]); }

/*---------------------------------------------------------------------*/ /* Write the local copy back to the asynchronous structure to */ /* clear any errors */ /*---------------------------------------------------------------------*/ setAsyncError (&asyncError);}

/*-----------------------------------------------------------------------*//* Handle miscellaneous errors *//*-----------------------------------------------------------------------*/void miscError (uint errorCode){ if (errorCode & me12V) { /*-------------------------------------------------------------------*/ /* The 12 volt supply to NextMove has been lost. Since the DAC */ /* voltage will be zero, stopping any moves in progress is the most */ /* likely action. Would then signal host and shutdown or wait for */ /* 12 volt rail to return. */ /* No need to clear the error as default action will do that. */ /*-------------------------------------------------------------------*/ } if (errorCode & meOUTPUTS) { /*-------------------------------------------------------------------*/ /* Short circuit protection on nmBX has been tripped. All outputs */ /* have been deactivated so most probable action is to shut down as */ /* outputs used for machine control don’t indicate true state of */ /* application. */ /* No need to clear the error as default action will do that. */ /*-------------------------------------------------------------------*/ }}

/*-----------------------------------------------------------------------*//* Handle axis errors *//*-----------------------------------------------------------------------*/void axisError (__uint8 axis, __uint32* errorCode)

Page 36: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 36

{ __uint32 mode;

/*---------------------------------------------------------------------*/ /* Check the axis error bit map against various errors. For example */ /*---------------------------------------------------------------------*/ if (*errorCode & erFWD_HARD_LIMIT) { /*-------------------------------------------------------------------*/ /* Forward hardware limit input has been activated. Main use to */ /* signal axis over travel but could be used for any purpose. */ /* For example, CANCEL all errors on that axis so default action */ /* does not take place. */ /*-------------------------------------------------------------------*/ CANCEL (axis); } if (*errorCode & erERROR_INPUT) { /*-------------------------------------------------------------------*/ /* Error input signal activated. For example, if other conditions */ /* ok then simply clear the error and continue. */ /*-------------------------------------------------------------------*/ *errorCode &= ~erERROR_INPUT; } if (*errorCode & erREV_SOFT_LIMIT) { /*-------------------------------------------------------------------*/ /* Reverse software limit. Just let default action take care of it */ /* initially according to the default action mode set with the */ /* SoftwareLimitMode function. Once move cleared then clear error. */ /*-------------------------------------------------------------------*/ getMODE ( axis, &mode ); if (!mode) *errorCode &= ~erREV_SOFT_LIMIT; } if (*errorCode & erFOLLOWING_ERROR) { /*-------------------------------------------------------------------*/ /* Maximum following error limit MFOLERR exceeded. Just disable the */ /* error and continue. Setting the mode to ignore also has the */ /* effect of clearing the error. */ /*-------------------------------------------------------------------*/ setFEMode ( axis, feIGNORE ); }}

3.6 Embedded EmulationAn embedded application can be difficult to debug without the C31 emulator. Embeddedemulation is where a C source file is written such that it can compiled as both an embeddedNextMove and a host application. This is useful for testing as it allows embedded code tobe run on the host where debugging is easier. This is a restricted version of full ImmediateCommand Mode.

Page 37: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 37

NextMove has a number of user installable interrupt handlers, such as the error handler.With Embedded Emulation, a generic host interrupt handler can be installed by the MINTinterface Library but MINT Motion Library functions cannot be called from within thishandler. Therefore, the application would need to be constructed differently to anembedded application. If the host Embedded Emulation is being run as a Windows Consoleapplication, then an interrupt handler could not be installed.

The following example is contained in the HOST\EXAMPLES\C31_EMU directory belowthe MINT interface Library installation directory. The directory contains a Borlandenvironment project.

/*=======================================================================*//* *//* Module ................ c31_emu.c *//* *//* NOTES: *//* Example 'C' program illustrates the use of OCL headers, libraries *//* and proprietary compiler tools to produce executable code for *//* NextMove. *//* *//* Toggle relay at 1Hz. *//* *//* This code will compile under: *//* 1. Texas Instruments 'C' compiler to produce executable code for *//* NextMove/PC, *//* 2. Borland 'C' 5.0 to produce executable code to run on a PC. *//* *//* NOTES : To compile this code, SINGLE_CON must be passed to the *//* pre-processor ( usually as a compile option, otherwise as a #define. *//* *//*=======================================================================*/

/*=======================================================================*//* INCLUDES *//*=======================================================================*/#include "mg.h" /* MG.H contains macro definitions */ /* typedefs and function prototypes*/ /* for the MINT Motion Library. */ /* */ /* Always include this header. */ /*---------------------------------*/#if __TARGET__ == __PC__ /* If you are compiling code to run*/ /* on the PC you should include */ /* additional headers. */ /* */ #include "host_cif.h" /* HOST_CIF.H declares functions */ /* used to initiate NextMove */ /* applications from the host. */ /* */ /* Always include this header. */ /*---------------------------------*/ /* You may want to include other */ /* header files that are specific */ /* to the PC here. eg: <dos.h>,etc */ /* */

Page 38: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 38

#include <conio.h> /* Include CONIO.H in this example */ /* for 'kbhit()' prototype. */ /* */ #include <stdio.h> /* Include STDIO.H in this example */ /* for 'printf' prototype. */ /* *//*-----------------------------------------------------------------------*/#endif

/*=======================================================================*//* MACROS *//*=======================================================================*/#if __TARGET__ == __PC__ /*---------------------------------------------------------------------*/ /* Define macros for: */ /* The address of the NextMove on the PC IO bus (ADDRESS) */ /* These macros are only required if the code is to be run on the PC. */ /*---------------------------------------------------------------------*/ #define ADDRESS 0x33C#endif

/*=======================================================================*//* CONSTANTS *//*=======================================================================*/#if __TARGET__ == __PC__/*-----------------------------------------------------------------------*//* Declare a string constant to hold the path to and filename of the *//* application MINT.OUT *//* This is only required if the code is to be run on the PC. *//*-----------------------------------------------------------------------*/char* whereFrontIs = "mint.out";#endif

/*=======================================================================*//* GLOBALS *//*=======================================================================*/#if __TARGET__ == __PC__ /* NextMove will be referenced */OCHANDLE hNextMove; /* using this handle. */#endif /* */

/*=======================================================================*//* FUNCTION PROTOTYPES *//*=======================================================================*/static __int16 clickRelay (void);

/*=======================================================================*//* FUNCTION DEFINITIONS *//*=======================================================================*//*-----------------------------------------------------------------------*//* clickRelay *//* *//* Function: *//* Turns the NextMove error relay on and off at 1Hz. *//* If the code is running on NextMove the function will only return if *//* there is an error. *//* If the code is running on the PC the function will return if there *//* is an error or if a key has been pressed. *//* */

Page 39: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 39

/* Argument List: *//* None. *//* *//* Return Value: *//* 0 - If a key is pressed. *//* 1 - If there is an error. *//* *//*-----------------------------------------------------------------------*/static __int16 clickRelay (void){ /*---------------------------------------------------------------------*/ /* Loop forever. Break loop from within. */ /*---------------------------------------------------------------------*/ while (1) { #if __TARGET__ == __PC__ /* Provide a controlled get out if */ if (kbhit()) { /* the code is running on a PC. */ getch(); /* Break by hitting a key, read the*/ /* key to clear the keyboard buffer*/ freeHandle ( hNextMove ); /* Before quitting, release any */ /* allocated resources with */ /* freeHandle() */ return 0; /* */ } /* */ #endif /*---------------------------------*/

if (erSUCCESS!=ENABLE(1))return 1;/* Turn the error relay on */ if (erSUCCESS!=WAIT(500))return 1;/* Wait half a second */ if (erSUCCESS!=ENABLE(0))return 1;/* Turn the error relay off */ if (erSUCCESS!=WAIT(500))return 1;/* Wait half a second */ } /*---------------------------------*/}

/*-----------------------------------------------------------------------*//* main *//* *//* Function: *//* Initialises NextMove then calls function to click the error relay on *//* and off at 1Hz. *//* If the code is run on a PC additional steps to reset the board and *//* download MINT.OUT are performed. *//* *//* Argument List: *//* None. *//* *//* Return Value: *//* If run on NextMove function will not return. *//* If run on PC return values are: *//* -2: Unable to initialise NextMove, *//* -1: Unable to register NextMove, *//* 0: Normal program termination, *//* 1: systemError *//* *//*-----------------------------------------------------------------------*/__int16 main (void) /* */{ /* */ #if __TARGET__ == __PC__ /* Perform additional steps needed */ /* when compiling code for PC. */ __int16 nError; /* */

Page 40: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 40

__int8 szError[szMAX_ERROR]; /* */ /* */ /*---------------------------------*/ hNextMove = createNextMovePCHandle /* Create a handle to the NextMove */ ( 0, ADDRESS ); /* */ /* */ /* */ selectGlobalController( hNextMove );/* */ /* */ /*---------------------------------*/ setProgramPath ( whereFrontIs ); /* When application code is running*/ /* on the PC, 'MINT.OUT' must be */ /* running on NextMove. You must */ /* tell 'initialiseNextMove' where */ /* 'MINT.OUT' is located. */ /*---------------------------------------------------------------------*/ /* The PC code is now set up. We can start to call the interface */ /* functions. */ /*---------------------------------------------------------------------*/ #endif /* __TARGET__ == __PC__ */

/*---------------------------------------------------------------------*/ /* The first interface function called MUST be 'initialiseNextMove'. */ /* You can call other functions first but your code WILL NOT WORK and */ /* the results will be unpredictable. */ /* 'initialiseNextMove' works differently on NextMove compared to the */ /* PC. Although there is only one prototype the return values are */ /* different. */ /*---------------------------------------------------------------------*/ #if __TARGET__ == __PC__ /*---------------------------------------------------------------------*/ /* On the PC 'initialiseNextMove' downloads the firmware specified by */ /* setProgramPath, and sets ECHO to eoOVERWRITE, so that there are */ /* no problems with the pseudo-serial buffer. */ /*---------------------------------------------------------------------*/ if (erSUCCESS != ( nError = initialiseNextMove ())) { getErrorString ( szError, nError ); printf ("Unable to initialise NextMove,\n Error %d : %s\n", nError, szError); return -2; } #else /*---------------------------------------------------------------------*/ /* On NextMove 'initialiseNextMove' initialises internal variables, */ /* interrupt structure and axis default values, etc. */ /* The function returns PASS or FAIL. If it returns FAIL the error */ /* structure 'systemError' will contain the reason why. */ /* In this example the code simply loops if the function fails. */ /*---------------------------------------------------------------------*/ if (initialiseNextMove () == FAIL) { while (1); } #endif

/*---------------------------------------------------------------------*/ /* NextMove has been successfully set up. Execute application specific*/ /* code. */ /* Call the process function and return its error code. */

Page 41: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 41

/*---------------------------------------------------------------------*/ return clickRelay ();}/*=======================================================================*//* END OF FILE *//*=======================================================================*/

The pre-processor directive, __TARGET__ == __PC__ , is used mask the additional codeneeded to compile the code for the host.

The following files need to be included in the host project:

BASE.CPPHOST_CIF.CPPHOST_DEF.CPPMML_CIF.CPPNEXTMOVE.CPPNM_MML.CPPNMBASE.CPPNMSTD.CPP

The following definitions are also required. These can be placed in the source code directlyor in the compiler options.

SINGLE_CON_NM_PC_ONLY_

Page 42: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

The MINT Motion Library

Motion Library Programmers Manual: Issue 3.2 Page 42

This page left intentionally blank.

Page 43: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 43

4. MML Function Reference _____________________The following is a reference guide to all the MINT Motion Library functions. Functionsthat are not suitable for both embedded and host use are marked as such. The functionprototypes are given in ‘C’ as for embedded C31 use. For host based function prototypes,use the appropriate host header file.

C / C++ - MG.HDelphi - MIL32DEV.PAS and MIL16DEV.PASVisual Basic - MIL_DEV.BAS

The format of each description is shown below.

FUNCTION NAMEPC BX Scaled Default Range

The check box headings are as follows:

Heading Meaning

PC The function can be used with NextMove PC.BX The function can be used with NextMove BX.

Scaled The value is user units as defined by the axis scale factor using theSCALE() function.

Default The defualt value.Range The range of permissable values. Some functions will scale the value

by the scale factor before range checking.

If a box is checked with a ❏ symbol then function is associated with that heading. If the boxis blank then the function cannot be associated with that heading. If a box contains a -symbol then the box is not applicable. Where different combinations of check boxes arepossible, all possibilities will be shown.

Prototype:Shows the calling convention used for the function. In most situations where there is thereis the ability to read from and write to a function, there will be a pair of functions prefixedwith get and set.

Page 44: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 44

Description:This describes the function use.

Parameters:This describes any parameters passed to the function. A number of constants are used asfollows:

• MAX_AXES - The number of axes, 8 for NextMove PC, 4 for NextMove BX.• MAX_FLOAT, MIN_FLOAT - The maximum acceptable floating value, +/- 8388607.0• MAX_ADCS - The number of analog input channels, 8.• MAX_DACS - The number of analog output channels, 8 for NextMove PC, 4 for

NextMove BX.• MAX_OUTPUTS - The number of digital output channels, 12 for NextMove PC and 8

for NextMove BX.• MAX_INPUTS - The number of digital input channels, 24 for NextMove PC and 16 for

NextMove BX.

Return Value:Most MML functions return 0 for success and 1 for fail. If a function does not conform tothis then this section will detail the return value.

Restrictions:Details any restrictions on the use of the function.

Default:Shows the default value for a parameter if applicable.

Example:Shows an example of the functions use.

See Also:Lists any closely related functions that may be of use or interest.

Page 45: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 45

ABORTPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 ABORT (void)

Dscription:Causes the ‘software abort’ motion error to be generated. This function may be used togenerate an asynchronous error on all axes via software. All axes are crash stopped and allenable outputs are immediately removed. An axis error will be created in the asynchronouserror structure and the user supplied error handler will be called if it is defined and enabled(ErrorMask). The error may be acknowledged and cleared by writing to the asynchronouserror structure using AsyncError or by calling CANCEL or RESET.

ABORT is useful in the error handler as it immediately disables all drives.

Parameters:None.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* User supplied error handler. Simply crash stop all axes and remove *//* all outputs. Then flash an error beacon connected to output 11. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ ABORT (); /* crash stop all axes */ setOUT (0); /* remove all outputs */ while (1) { /* toggle error output at 1Hz */ setOUTx (11, True); WAIT (500); setOUTx (11, False); WAIT (500); }}

See Also:

AsyncError, AxisStatus, disableDrive, CANCEL, ERROR, ErrorHandler, RESET

Page 46: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 46

ACCELPC BX Scaled Default Range❏ ❏ ❏ 300000 - servo

3000 - stepper0 - 8388607.0

Prototype:__int16 getACCEL (__uint8 axisNo, float *acceleration)__int16 setACCEL (__uint8 axisNo, float acceleration)

Description:Sets or returns the desired acceleration rate for the axis. Moves may have differentacceleration and deceleration rates. The deceleration rate is set by calling DECEL. If theaxis is the master axis in an interpolated move, the acceleration rate will be along theresultant path. The acceleration rate will be used for the following move types:

mdJOGmdHOMINGmdLINEARmdCIRCULARmdOFFSETmdFOLLOW (velocity following only)mdHTAmdINCREMENT

Parameters:axisNo specifies the axis upon which the acceleration is to be set or read.

0 <= axisNo < MAX_AXES.

acceleration is the acceleration rate in user units / sec2.

0 < acceleration <= MAX_FLOAT

Restrictions:None. The acceleration rate may be changed or read at any time. Changing the accelerationrate has no effect upon the deceleration rate. DECEL must also be called if both rates arerequired to be the same.

Default:Servo axes: 300,000 encoder edges / sec2

Stepper axes: 3,000 steps / sec2

Page 47: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 47

Example:/*----------------------------------------------------------------------*//* Define a function that will set equal acceleration and deceleration *//* ramps on a specified axis. *//*----------------------------------------------------------------------*/void setEqualRamps (__uint8 axisNo, float ramp){ setACCEL (axisNo, ramp); /* set the acceleration rate */ setDECEL (axisNo, ramp); /* set the deceleration rate equal */}

See Also:

CIRCLEA, CIRCLER, DECEL, JOG, MaximumSpeed, MOVEA, MOVER, RAMP,SCALE, SPEED, VECTORA, VECTORR

ActiveInputLevelPC BX Scaled Default Range❏ ❏ - 16777215 PC

65535 BX0 - 16777215 PC

0 - 65535 BX

Prototype:__int16 getActiveInputLevel (__uint32 *activeHiInputs)__int16 setActiveInputLevel (__uint32 activeHiInputs)

Description:Sets or returns which of the user digital inputs, currently configured to be level triggered, areactive when read high. Any of the user digital inputs may be configured to be level or edgetriggered by calling InputActiveMode. An input is read high when current flows in theinput circuit. A PNP input is read high when the input pin is held above ground. An NPNinput is read high when the input pin is pulled to ground.

This function associates an active state with a physical configuration. The defaultconfiguration interprets current flowing in the input circuit as an active input: for example,the closing of a normally open switch. The ability to change the active state of an input isuseful, particularly during development, as hardware can be changed to differentconfigurations without have to change large amounts of software.

Parameters:activeHiInputs is a bitmap of those inputs which should be active when current flows in theinput. Each bit position represents a user input. If a bit is:

0 - input active when no current flows in the input circuit; active low.1 - input active when current is flowing in the input circuit; active high.

Page 48: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 48

Restrictions:None.

Default:By default all inputs are configured to be level triggered, active high.

Example:/*----------------------------------------------------------------------*//* Override the default input configuration. We require: *//* inputs | level / edge | trigger condition *//* ------------------------------------------------- *//* 0 - 1 | edge | positive edges *//* 2 - 3 | edge | negative edges *//* 4 - 7 | level | input low *//* 8 - 23 | level | input high *//*----------------------------------------------------------------------*/void configureInputs (void){ setInputActiveMode (0x0F); /* inputs 0-3 edge triggered */ setPositiveEdgeTriggeredInputs (0x03); /* 0 and 1 trigger on +ve edge */ setNegativeEdgeTriggeredInputs (0x0C); /* 2 and 3 trigger on -ve edge */ setActiveInputLevel (0xFFFF0F); /* 4 to 7 active low */}

See Also:

IN, INx, InputActiveMode, NegativeEdgeTriggeredInputs,PositiveEdgeTriggeredInputs

ActiveOutputLevelPC BX Scaled Default Range❏ ❏ - 4095 PC

255 BX0 - 4095 PC0 - 255 BX

Prototype:__int16 getActiveOutputLevel (__uint32 *activeHiOutputs)__int16 setActiveOutputLevel (__uint32 activeHiOutputs)

Description:Sets or returns which of the user digital outputs are active when turned on. When an outputis turned on current will flow in the output circuit. When on, a PNP output will hold theoutput pin above ground. An NPN output will pull the output pin to ground.

Page 49: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 49

This function associates an active state with a physical condition. The default configurationinterprets current flowing in the output circuit as an active output; for example, theillumination of a lamp. The ability to change the active state of an output is useful,particularly during development, as hardware can be changed to different configurationswithout have to change large amounts of software.

There are 12 digital output channels on NextMove PC and 8 digital output channels onNextMove BX.

Parameters:activeHiOutputs is a bitmap of those outputs which should be active high. Each bit positionrepresents a user output. If a bit is:

0 - when the output is active no current flows in the output circuit.0 - when the output is active current will be flowing in the output circuit.

Restrictions:None.

Default:By default all outputs are configured to be active on, current flowing in the output circuit.

Example:/*----------------------------------------------------------------------*//* override the default output configuration. We require: *//* *//* outputs 0 to 3 : active state is off. *//* outputs 4 to 11 : active state is on. *//* *//* initial state to be: all outputs inactive. *//*----------------------------------------------------------------------*/void configureOutputs (void){ setActiveOutputLevel (0xFF0);/* 0 to 3 are active off, rest active on */ setOUT (0); /* all outputs inactive, 0 to 3 are on */}

See Also:

OUT, OUTx

Page 50: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 50

ActiveZLevelPC BX Scaled Default Range❏ ❏ - 1 0 - 1

Prototype:__int16 getActiveZLevel (__uint8 *activeHigh)__int16 setActiveZLevel (__uint8 activeHigh)

Description:To set or return the active state of the encoder Z (index) pulse. An active high encoder Zpulse is one that is normally low, switching high for one quadrature period once perrevolution of the encoder. The ActiveZLevel function allows active low encoder Z pulsesto be used.

Parameters:activeHigh specifies whether the Z pulse is active high or low.

0 - the Z pulse is normally high and pulses low once per revolution.1 - the Z pulse is normally low and pulses high once per revolution.

Restrictions:The active Z pulse level applies to all encoders on NextMove. Encoders with differentactive levels cannot be mixed.

Default:By default the encoders are configured to use active high pulses.

Example:/*----------------------------------------------------------------------*//* Configure the encoder Z pulses to be active low. *//*----------------------------------------------------------------------*/setActiveZLevel (0);

See Also:

HOME, Zlatch

Page 51: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 51

ADCErrorPC BX Scaled Default Range❏ ❏ - 0 - 65535

Prototype:__int16 getADCError (__uint8 axisNo, __uint32 *errorChannels)

Description:It is possible to attach limit values to analog input channels such that if those limits areexceeded, an error is generated. Analog channels can be associated with one or more axessuch that when and analog error occurs, asynchronous errors will be generated on allassociated axes. Analog errors are axis errors, erADC_ERROR, and can be cleared bywriting to the asynchronous error structure or calling CANCEL or RESET.

This function returns a bit map indicating the currently active analog errors on the specifiedaxis. A record is kept of current state of analog errors. The bit mask returned shows anyanalog errors for those channels which have associated with the specified channel. The bitmask also indicates which analog limit, upper and/or lower, caused the analog error.

Upper and lower analog limits are set on an analog channel using the MaxAnalogue andMinAnalogue functions. Channels are associated with an axis using MonitorChannels.

Parameters:axisNo specifies the axis from which to read the current analog errors.

0 <= axisNo < MAX_AXES.

errorChannels shows the current analog errors as a bit mask as shown below.

Bit Meaning

0 Analog error on channel 0. Maximum limit exceeded.1 Analog error on channel 1. Maximum limit exceeded.2 Analog error on channel 2. Maximum limit exceeded.3 Analog error on channel 3. Maximum limit exceeded.4 Analog error on channel 4. Maximum limit exceeded.5 Analog error on channel 5. Maximum limit exceeded.6 Analog error on channel 6. Maximum limit exceeded.7 Analog error on channel 7. Maximum limit exceeded.8 Analog error on channel 0. Minimum limit exceeded.9 Analog error on channel 1. Minimum limit exceeded.

10 Analog error on channel 2. Minimum limit exceeded.

Page 52: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 52

Bit Meaning

11 Analog error on channel 3. Minimum limit exceeded.12 Analog error on channel 4. Minimum limit exceeded.13 Analog error on channel 5. Minimum limit exceeded.14 Analog error on channel 6. Minimum limit exceeded.15 Analog error on channel 7. Minimum limit exceeded.

Restrictions:None.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Within user error handler. Analog channel used as velocity monitor *//* Error if drops below certain speed. Increase torque to compensate *//*----------------------------------------------------------------------*/void myErrorHandler (void){ TAsyncError asyncErr; /* asyErr is users structure */ __uint32 channels; /* store the analog channels */

/*--------------------------------------------------------------------*/ /* Check for analog error on axis 0 */ /*--------------------------------------------------------------------*/ if (asyncErr.axis[0] & erADC_ERROR) {

/*------------------------------------------------------------------*/ /* Read the error channels. Only channel 3 associated with axis 0 */ /*------------------------------------------------------------------*/ getADCError (0, &channels); if (channel & 0x800) { /*----------------------------------------------------------------*/ /* Minimum limit exceeded, increase torque by 5% */ /*----------------------------------------------------------------*/ getTORQUE(0, &currentTorque); currentTorque = currentTorque + 5; setTORQUE(0, currentTorque); } else { /*----------------------------------------------------------------*/ /* Maximum limit exceeded, decrease torque by 5% */ /*----------------------------------------------------------------*/ getTORQUE(0, &currentTorque); currentTorque = currentTorque - 5; setTORQUE(0, currentTorque); } } ......}

Page 53: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 53

See Also:

AsyncError, AxisStatus, ERROR, ErrorHandler, MaxAnalogue, MinAnalogue,MonitorChannels

ADCModePC BX Scaled Default Range❏ ❏ - 0 0 - 4 PC

0 - 5 BX

Prototype:__int16 getADCMode (__uint8 channel, __uint8 *mode)__int16 setADCMode (__uint8 channel, __uint8 mode)

Description:Sets or reads the mode in which data is read from an analog input channel. There are eight12 bit analog input channels. The inputs may be connected as individual single ended inputsor differential pairs. As differential pairs, the input may be read true or inverted. Whethersingle ended or differential , the inputs may be read as either unipolar or bipolar.

On NextMove PC, the input range of the analog channels is jumper selectable. Choices are± 10V (jumper fitted), ± 2.5V or 0 - 5V (no jumper).

Range Jumper ± differential /single ended

-ve +ve

0 - 5 V no jumper unipolar ❏ 0 4095± 2.5 V no jumper bipolar ❏ -2047 2047± 10 V jumper bipolar ❏ -2047 2047

NextMove BX has a true differential mode, mode 5. This means that the differential valueis produced before going to the ADC. Reading the even channel gives the bipolardifferential result. The odd channel has the DAC feedback value. This is the value beingproduced from the DAC, regardless of the axis configuration.

The eight analog inputs are not jumper configurable. For modes 0 to 3, the analog channelsare read as ±2.5V or 0 - 5V depending on bipolar or unipolar. For true differential, thechannel is read as ±10V.

One analog input channel is read every 250µs. Consequently, a new value is available foreach input every 2ms if all channels are converted. The sampling period can be reduced byturning off any channel that is not being used. The sampling period for any channel is:

Page 54: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 54

250µs ✕ number of channels not turned off

If a pair of inputs are connected as a differential pair only one channel needs conversion, theother may be turned off.

Parameters:channel is the analog input channel.

0 <= channel < MAX_ADCS.

mode is the mode in which analog input channel is read by ANALOGUE:

mode Constant Meaning

0 The channel is single-ended, unipolar.1 acDIFFERENTIAL A differential, unipolar pair of channels. If

channel is even the result is true, if channelis odd the result is inverted.

2 acBIPOLAR The channel is single-ended, bipolar.3 acDIFFERENTIAL +

acBIPOLARA differential, bipolar pair of channels. Ifchannel is even the result is true, if channelis odd the result is inverted

4 acOFF No conversion is performed on the channel.5 acTRUE_DIFFERENTIAL True differential mode. NextMove BX

only.

Restrictions:None.

Default:By default all channels are converted as single ended unipolar.

Example:/*----------------------------------------------------------------------*//* Set up 4 potentiometers. *//* The pots are connected as: *//* pot | range | channel *//* --------------------------- *//* 0 | 0 - 10 | 0 *//* 1 | 0 - 10 | 2 & 3 *//* 2 | +/- 10 | 4 *//* 3 | +/- 10 | 6 & 7 *//*----------------------------------------------------------------------*/void setUpPotentiometers (void){ setADCMode ( 0 , 0 ); setADCMode ( 2 , acDIFFERENTIAL ); setADCMode ( 4 , acBIPOLAR );

Page 55: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 55

setADCMode ( 6 , acDIFFERENTIAL + acBIPOLAR );}

See Also:

ANALOGUE, DAC, IN, INx

ANALOGUEPC BX Scaled Default Range❏ ❏ - -2047 - 4095

Prototype:__int16 getANALOGUE (__uint8 channel, __int16 *binaryValue)

Description:Returns the value on analog input channel as raw data. There are eight 12-bit analog inputseach of which may be configured for ±10V, ± 2.5V or 0-5V operation by the placement ofjumper links. The inputs may be connected as single-ended or differential pairs and may beread as bipolar or unipolar. The normal sampling period of each analog channel is 2ms.This can be reduced by turning unused channels off. See ADCMode for more details. If achannel is turned off then the data read from that channel will be the last value convertedwhilst it was turned on.

Parameters:channel is the analog input from which data is required.

0 <= channel < MAX_ADCS.binaryValue returns the ADC value according to the mode set up by ADCMode and is inthe range:

0 <= binaryValue <= 4095 for unipolar acquisition-2047 <= binaryValue <= 2047 for bipolar acquisition

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Return a voltage read from one of 4 potentiometers connected as: *//* pot | range | channel *//* --------------------------- */

Page 56: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 56

/* 0 | 0 - 10 | 0 *//* 1 | 0 - 10 | 2 & 3 *//* 2 | +/- 10 | 4 *//* 3 | +/- 10 | 6 & 7 *//*----------------------------------------------------------------------*/float readPotentiometer (__uint16 whichPot){ binaryValue = 0; switch (whichPot) { case 0 : /* read channel 0, 0-10v, single ended */ getANALOGUE (0, &binaryValue) * 10.0 / 4095.0; return binaryValue; case 1 : /* read channels 2 and 3, 0-10v, differential */ getANALOGUE (2, &binaryValue) * 10.0 / 4095.0; return binaryValue; case 2 : /* read channel 4, +/-10v, single ended */ getANALOGUE (4, &binaryValue) * 10.0 / 2047.0; return binaryValue; case 3 : /* read channels 6 and 7, +/-10v, differential */ getANALOGUE (6, &binaryValue) * 10.0 / 2047.0; return binaryValue; }}

See Also:

ADCMode, DAC, IN, Inx

AsyncErrorPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 getAsyncError (TAsyncError* asyncError)__int16 setAsyncError (TAsyncError* asyncError)

Description:Asynchronous errors can occur at any time and are concerned with axis errors andmiscellaneous errors. When an asynchronous error occurs, the details are written into aninternal structure. The ‘get’ function copies that internal structure into a users copy so thatit can be examined.

The user defined error handler will be called if one has been defined, allowing the error tobe handled by the user. If there is no user error handler or it does not clear the error,‘default action’ will be taken to clear the error or make an axis safe.

Page 57: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 57

Errors can be cleared by the user by writing to the user copy of the error structure. This usercopy is then copied back to the internal structure using the ‘set’ function. It is also possibleto create errors by writing to the asynchronous error structure.

For axis errors, the error mask, set with ErrorMask, is also checked before the usersupplied error handler is called. Axis errors can also be cleared by calling CANCEL orRESET. Software limit errors, hardware limit errors and following errors can also becleared by setting the default action mode to ignore.

See chapter 3.5 for full details on errors and error handling.

Parameters:asyncError is a pointer to the user supplied structure of type TAsyncError into which orfrom which the data is to be moved.

TAsyncError is defined as:typedef struct { volatile unsigned __int32 present; /* indicates error present */ volatile unsigned __int32 misc; /* miscellaneous errors */ volatile unsigned __int32 axis[cnMAX_AXES]; /* motion errors */} TAsyncError;

Miscellaneous Errors

Bit Constant Meaning

0 me12V 12 volt supply rail failed1 meOUTPUTS Output short circuit protection tripped

Axis Errors

Bit Constant Meaning

0 erABORT Motion aborted1 erFWD_HARD_LIMIT Forward hardware limit hit2 erREV_HARD_LIMIT Reverse hardware limit hit3 erFWD_SOFT_LIMIT Forward software limit exceeded4 erREV_SOFT_LIMIT Reverse software limit exceeded5 erFOLLOWING_ERROR Following error limit exceeded7 erERROR_INPUT External error input active

10 erADC_ERROR Analog value limit exceeded11 erSLAVE_SYNC_ERROR Cam move has lost synchronisation

Restrictions:None.

Page 58: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 58

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* User error handler. Program execution will jump here for an *//* asynchronous error. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ TAsyncError asyErr; /* asyErr is users structure */ __uint16 i;

/*--------------------------------------------------------------------*/ /* Read error structure */ /*--------------------------------------------------------------------*/ getAsyncError (&asyErr);

if (asyErr.misc) { /*------------------------------------------------------------------*/ /* Miscellaneous error. Read bit map and take appropriate action. */ /*------------------------------------------------------------------*/ ...... }

for (i=0;i<cnMAX_AXES;i++) { if (asyErr.axis[i]) {

/*----------------------------------------------------------------*/ /* Axis i has an error. Read bit map and take appropriate action. */ /*----------------------------------------------------------------*/ ....... } }}void main (void){ setErrorHandler (myErrorHandler);}

See Also:

AxisStatus, CANSTATUS, ERROR, ErrorHandler, ErrorMask, STATUSNODE,SystemError

Page 59: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 59

AuxEncoderPC BX Scaled Default Range❏ ❏ - 0 -8388607.0 - 8388607.0

Prototype:__int16 getAuxEncoder (float *encoder)__int16 setAuxEncoder (float encoder)

Description:Sets or returns the position, in user units, of the auxiliary encoder input. NextMove BX hasone auxiliary encoder input and NextMove PC has one auxiliary encoder input when anExpansion board is fitted.

The auxiliary encoder can be scaled to user units with the AuxEncoderScale function. Theauxiliary encoder can also be used in master slave moves through the use of theMasterSource function. Position wrapping can be set up with the AuxEncoderWrapfunction which limits the position from 0 to the wrap limit.

The auxiliary encoder is read every 2ms.

Parameters:encoder is the absolute position of the auxiliary encoder in user units.

MIN_FLOAT <= encoder <= MAX_FLOAT.

Restrictions:None.

Default:After power up or board reset, the encoder value is set to zero.

Example:/*----------------------------------------------------------------------*//* Zero the auxiliary encoder after datum on axis 1 *//*----------------------------------------------------------------------*/__uint8 isidle;

setHOME (1, hmNEGATIVE_SWITCH_INDEX); /* start homing sequence */isidle = 0;while (!isidle){ getIDLE (1, &isidle); /* wait for sequence to finish */}setAuxEncoder (0.0); /* set new encoder position */

Page 60: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 60

See Also:

AuxEncoderScale, AuxEncoderVel, AuxEncoderWrap, Encoder,FastAuxEncoder.

AuxEncoderScalePC BX Scaled Default Range❏ ❏ - 1 -8388607.0 - 8388607.0

Prototype:__int16 getAuxEncoderScale (float *scale)__int16 setAuxEncoderScale (float scale)

Description:Sets or returns the scale factor for the auxiliary encoder input. The scale factor is used toconvert between the minimum resolvable unit, encoder edges, and user units.

NextMove BX has one auxiliary encoder input and NextMove PC has one auxiliary encoderinput when an Expansion board is fitted.

Parameters:scale specifies the number of encoder edges or steps per user unit.

MIN_FLOAT <= scale <= MAX_FLOAT.

Restrictions:None.

Default:The default scale factor is 1.

Example:/*----------------------------------------------------------------------*//* The auxiliary encoder has 1024 lines. This gives 4096 counts per *//* revolution with quadrature. The encoder is mounted on a conveyer *//* where 2.5 revolutions is 1 inch or travel *//*----------------------------------------------------------------------*/setAuxEncoderScale (10240.0); /* set user units to inches */

See Also:

AuxEncoder, AuxEncoderVel, AuxEncoderWrap, EncoderScale, SCALE

Page 61: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 61

AuxEncoderVelPC BX Scaled Default Range❏ ❏ - 0 -8388607.0 - 8388607.0

Prototype:__int16 getAuxEncoderVel (float *velocity)

Description:Returns the velocity in user units, of the auxiliary encoder input. NextMove BX has oneauxiliary encoder input and NextMove PC has one auxiliary encoder input when anExpansion board is fitted.

The auxiliary encoder can be scaled to user units with the AuxEncoderScale function.

Parameters:velocity is the velocity in user units.

MIN_FLOAT <= velocity <= MAX_FLOAT.

Restrictions:None. Due to quantisation errors typical of any sampled system the value returned byAuxEncoderVel is inaccurate at low speeds. The velocity is the change in positionmeasured every 2ms expressed in user units. The minimum value, other than zero, that canbe returned equates to an encoder edge frequency of 500Hz (the sampling frequency). eg: ifyou program in revs and there are 2,000 edges per rev. the minimum non-zero velocity willbe +/- 15 rpm.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Wait until the auxiliary encoder velocity exceeds 2000 rpm and then *//* turn output 5 on. *//*----------------------------------------------------------------------*/float vel;

do { getAuxEncoderVel (&vel);} while (vel < 33.3);setOUTx (5, 1);

See Also:

AuxEncoder, AuxEncoderScale, AuxEncoderWrap, EncoderVel, VEL

Page 62: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 62

AuxEncoderWrapPC BX Scaled Default Range❏ ❏ - 0 0 - 8388607.0

Prototype:__int16 getAuxEncoderWrap (float *wrap)__int16 setAuxEncoderWrap (float wrap)

Description:Sets or returns the auxiliary encoder position wrap limit in user units. The absolute positionof the auxiliary encoder will normally return a value within the full range of +/- 8388607.0user units. It is possible to set up a wrap value such that when the absolute position reachesthis limit, the position goes to zero. This is useful in cyclic systems where position withinone cycle needs to be known.

Setting a wrap value of zero turns off position wrapping and allows the position to be withinthe full possible range.

The auxiliary encoder can be scaled to user units with the AuxEncoderScale function.

Parameters:wrap is the absolute position of the auxiliary encoder in user units that the position willwrap at

0 <= wrap <= MAX_FLOAT.

Restrictions:None.

Default:After power up or board reset, the position wrapping is turned off.

Example:/*----------------------------------------------------------------------*//* The auxiliary encoder is attached to a flighted conveyer where there *//* is 10 inches between flights. Make the auxiliary encoder position *//* always return the position within the flight. *//*----------------------------------------------------------------------*/float position;

setAuxEncoderScale (10240.0); /* set user units to inches */setAuxEncoderWrap (10.0); /* Position wrap at 10.0 */

while (running) getAuxEncoder (&position); /* 0 <= encoder value < 10 */

Page 63: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 63

See Also:

AuxEncoder, AuxEncoderScale, AuxEncoderVel, EncoderWrap

AxisStatusPC BX Scaled Default Range❏ ❏ - 0 0 - 36095

Prototype:__int16 getAxisStatus (__uint8 axisNo, __uint32* status)

Description:Most of the asynchronous axis error conditions can be prevented from actually creating anerror through the use of mode functions and disabling functions associated with each of thedifferent axis error types. The axis status register is constantly maintained to show all errorconditions, regardless of the state of any mode switches or functions.

The axis error conditions are shown below. When any of these become active, thecorresponding bit will be set in the status register.

AxisStatus is useful in situations where an off-normal condition is polled rather thangenerating an error. See chapter 3.5 for full details on errors and error handling.

Parameters:axisNo specifies the axis on which the status is to be interrogated.

0 <= axisNo < MAX_AXES.

status is returned as a bit mask with bits set indicating that the condition exists. The bitmask is as follows:

Bit Error Condition Meaning

0 erABORT Motion aborted1 erFWD_HARD_LIMIT Forward hardware limit hit2 erREV_HARD_LIMIT Reverse hardware limit hit3 erFWD_SOFT_LIMIT Forward software limit exceeded4 erREV_SOFT_LIMIT Reverse software limit exceeded5 erFOLLOWING_ERROR Following error limit exceeded6 erSTOP_INPUT Stop switch input active7 erERROR_INPUT External error input active8 Reserved

Page 64: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 64

9 Reserved10 erADC_ERROR Analog value limit exceeded11 erSLAVE_SYNC_ERROR Cam move has lost synchronisation12 Reserved13 Reserved14 Reserved15 erMAX_SPEED Maximum axis speed exceeded

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* if axis 0 has hit its forward software limit, check the *//* interference of axis 1. If axis 1 clear expand the limit on axis 0. *//*----------------------------------------------------------------------*/void checkSoftwareLimits (void){ status = 0; getAxisStatus ( 0 , &status ); If ( status & erFWD_SOFT_LIMIT) { getPOS ( 1, &position ); if (position > 1564.3) setForwardSoftwareLimit (0, 1000); }}

See Also:

AsyncError, ERROR, ErrorHandler, ErrorMask, MaximumSpeed, SystemError

Page 65: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 65

BacklashPC BX Scaled Default Range❏ ❏ ❏ 0 -8388607.0 - 8388607.0

Prototype:__int16 getBacklash (__uint8 axisNo, float *backlash)__int16 setBacklash (__uint8 axisNo, float backlash)

Description:Sets or returns the of the size of the backlash for an axis. Backlash describes the amount offree movement in the gearbox or belts linking a motor and the physical axis. Backlashcompensation automatically compensates for this free movement whenever the axis changesdirection. The compensation method used is known as constant compensation and is turnedon with the BacklashMode function. The rate at which compensation is applied iscontrolled with the BacklashInterval function.

The sign of the backlash is used to indicate in which direction the backlash was taken upduring the homing cycle. If the initial home direction was positive, then the backlash sizeshould be specified as a positive value. If the initial home direction was negative then thebacklash size should be specified as a negative value. It is recommended that homing isonly performed on a switch and not the encoder index pulse when using backlashcompensation.

Parameters:axisNo specifies the axis upon which the backlash compensation size will be applied.

0 < = axisNo < MAX_AXES.

MIN_FLOAT <= backlash < MAX_FLOAT

Restrictions:The axis must be mdIDLE in order to change the backlash value.

Default:The default backlash is zero.

Example:/*----------------------------------------------------------------------*//* Set a backlash compensation size of 0.2mm on axes 0 and 1 *//*----------------------------------------------------------------------*/setBacklash (0, 0.2);setBacklash (1, 0.2);setBacklashMode (0, blCONSTANT);setBacklashMode (1, blCONSTANT);

Page 66: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 66

See Also:

BacklashInterval, BacklashMode

BacklashIntervalPC BX Scaled Default Range❏ ❏ - 50 1 - 8388607

Prototype:__int16 getBacklashInterval (__uint8 axisNo, __uint16 *numberServoCycles)__int16 setBacklashInterval (__uint8 axisNo, __uint16 numberServoCycles)

Description:Sets or returns the number of servo loop cycles over which the backlash compensation sizeis applied when an axis changes direction.

In order to smoothly take up backlash, the compensation is applied over a number of servoloop cycles. It is possible to change how quickly the compensation is applied by changingthe number of cycles. The time it takes to compensate also depends on the servo loopfrequency set with the LOOPTIME function. The default servo loop interval is 1millisecond so a backlash interval of 1000 would imply a 1000 servo cycles and therefore acompensation time of 1 second. If the servo loop interval was 500 micro-seconds, then thecompensation time would be 500 milliseconds.

Parameters:axisNo specifies the axis upon which the numberServoCycles value is to be set.

0 < = axisNo < MAX_AXES

1 <= numberServoCycles < MAX_FLOAT

Restrictions:The axis must be mdIDLE in order to change the backlash interval.

Default:The default backlash interval is 50 servo cycles.

Example:/*----------------------------------------------------------------------*//* Set a compensation size of 0.5 rev on axis 0 to be applied in 100 ms *//* when the servo loop interval is 500 micro seconds *//*----------------------------------------------------------------------*/setBacklash (0, 0.5);setBacklashInterval (0, 200);

Page 67: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 67

See Also:

Backlash, BacklashMode

BacklashModePC BX Scaled Default Range❏ ❏ - 0 0 - 1

Prototype:__int16 getBacklashMode (__uint8 axisNo, __uint8 *mode)__int16 setBacklashMode (__uint8 axisNo, __uint8 mode)

Description:Controls the use of backlash compensation. The mode parameter can except two values asfollows:

Value Constant Meaning

0 blOFF Backlash compensation is turned off. No compensationis applied.

1 blCONSTANT A constant compensation method is used.

When compensation is turned on, the sign of the backlash compensation size is used todetermine the direction in which backlash was taken up.

It is assumed that if a positive size is given, then the motor is at the negative extent of thebacklash area, as if the axis had been homed in an initial positive direction. This impliesthat for a negative movement, no compensation would need to be applied and for a positivemovement, the backlash size would have to compensated in order to move the physical axis.If the backlash size was negative then the opposite assumption applies.

When the axis changes direction, the compensation size is taken up over the number ofservo cycles specified with the BacklashInterval function. The compensation method isknown as constant since once a change in direction has occurred, the compensation value isapplied constantly.

Compensation is only applied whilst an axis is in motion. Therefore if a large number ofservo cycles are specified but the change in direction is achieved with a small movedistance, then it is possible that the whole compensation distance will not be taken up withthe move. When the next movement is given, the remaining compensation will be taken up.

Page 68: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 68

Reading the axis position will return the compensated position, i.e., the physical axisposition and not the motor encoder position. Axis velocity does show the effect of thecompensation distance being taken up.

Parameters:axisNo specifies the axis upon which the mode will be set.

0 < = axisNo < MAX_AXES.

0 <= mode <= 1

Restrictions:The axis must be mdIDLE in order to change the backlash mode.

Default:The default backlash mode is blOFF.

Example:/*----------------------------------------------------------------------*//* Set up backlash compensation on axis 3 of 3mm to be applied over 50 *//* cycles. Perform a small negative move to ensure that the backlash *//* has been taken up in a positive direction. (Equivalent to a *//* negative direction home sequence) *//*----------------------------------------------------------------------*/__uint8 idle;

setBacklash (3, -3);setBacklashInterval (3, 50);setMOVER(3, 5);GO(1, 3);

do { getIDLE (3, &idle);} while (!idle);

setBacklashMode (3, blCONSTANT);

See Also:

Backlash, BacklashInterval

BACKOFFPC BX Scaled Default Range❏ ❏ - 10 1 - 8388607.0

Prototype:__int16 getBACKOFF (__uint8 axisNo, float *backoff)__int16 setBACKOFF (__uint8 axisNo, float backoff)

Page 69: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 69

Description:Backoff is the fraction of the homing speed at which parts of the homing cycle areperformed at. Homing onto a switch takes place at HMSPEED. When coming off theswitch or homing onto an index pulse, the speed is described by HMSPEED / BACKOFF.

See the HOME function for full details on the homing cycle.

Parameters:axisNo specifies the axis upon which the backoff factor is to be set or read.

0 < = axisNo < MAX_AXES.

1 <= backoff < MAX_FLOAT

Restrictions:None.

Default:Backoff set to 10 for all axes.

Example:/*----------------------------------------------------------------------*//* Home axis #2. *//* Search for home switch in a negative direction at 50 mm/s. *//* Creep off the switch at 2 mm/s. *//*----------------------------------------------------------------------*/void homeAxis2 (void){ setHMSPEED (2, 50); /* set search speed to 50 mm/s */ setBACKOFF (2, 25); /* creep = 50 / 25 = 2 mm/s */ setHOME (2, hmNEGATIVE_SWITCH); /* start the home sequence */ do { getIDLE ( 2, &isidle ); /* wait for the sequence to finish */ } while (!isidle);}

See Also:

HMSPEED, HOME

BOOSTPC BX Scaled Default Range❏ - 0 0 - 1

Prototype:__int16 setBoost (__uint8 axisNo, __uint8 state)

Page 70: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 70

Description:Each stepper axis has a dedicated boost output assigned to it. Some stepper drives have aboost input to increase the power to the stepper motor. The boost output is only controlledby the user. The Boost function allows the boost output to be turned on and off. If theoutput is not being used to control a stepper drive it may be used as a general purposeoutput.

Parameters:axisNo is the axis whose boost output is to be controlled.

0 <= axisNo < MAX_AXES

state is the desired state of the boost output.

state = 0 Turn the boost offstate = 1 Turn the boost on

Restrictions:Only applicable to axes that have stepper hardware available, i.e. axes on NextMove PC.The NextMove Expansion board has no boost outputs for its stepper axes.

Default:After power up or reset the boost outputs are inactive.

Example:/*----------------------------------------------------------------------*//* A two axis gantry is driven by stepper motors. When a load is being *//* moved the boost is turned on, when empty the boost is turned off. *//*----------------------------------------------------------------------*/void pickAndPlace (void){ goToPickUpPoint (); /* call function to position gripper */ pickUpPart (); /* call function to activate gripper */ setBoost (4, 1); /* turn boost outputs on to provide more.. */ setBoost (5, 1); /* power when loaded. */ goToSetDownPoint (); /* call function to position gripper */ putPartDown (); /* call function to release gripper */ setBoost (4, 0); /* turn boost outputs off now that gantry has */ setBoost (5, 0); /* no load. */ goToParkPosition (); /* call function to position gripper */}

See Also:

OUT, OUTx, Pulse, StepDirection

Page 71: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 71

CamPC BX Scaled Default Range❏ ❏ - - 0 - 15

Prototype:__int16 getCam (__uint8 axisNo, __uint8 *mode)__int16 setCam (__uint8 axisNo, __uint8 mode)

Description:Cam profiling is where a slave axis is linked to a master axis so that a given move distanceon the master will produce a motion of a pre-defined distance on the slave.

A software cam is created by breaking the motion into a number of segments. Each segmentdefines the how far the slave axis will travel for a given move distance on the master axis.Once these segments have been defined, NextMove produces a path between them, theinterpolation method being set by the user. The user controls the size and accuracy of thesegments. The more critical the axis motion, the more segments that can be defined.Motion across each segment and across segment boundaries will go through all specifiedpoints.

The segment information for a cam profile is defined in an array called a table. A table ofpositions has to be defined together with an optional table of master increments. The tablesare defined with the CamTable function. Slave positions defined in the table can beinterpreted in one of three ways:

1. The values represent relative movements. Each value is the relative distance that theslave axis must move over that segment.

2. The values represent absolute positions within a cam cycle. During a continuous cam,each repetition of the table is known as a cycle. Each time the table starts, the currentslave axis position is considered as zero and the table values are taken as absolute to thatposition.

3. The values represent true absolute positions. The values are absolute with reference toactual axis position. The zero position is from when the axis was last reset or homed.

When the cam is executed, each segment is processed in turn until the end of the table isreached. The start and end positions of the table are set with the CamStart and CamEndfunctions. The currently executing cam segment number can be read with CamIndexfunction.

Page 72: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 72

The master axis for the cam to follow is specified with the MasterChannel andMasterSource functions. The master axis can be bi-directional, the slave axis will reversealong its path if the master changes direction. The master distance to move is defined withthe MasterDistance function or using a master distance table. The slave will move thedistance given by a cam segment in the cam table over each MasterDistance distance seenon the master axis.

A cam profile can be performed on a servo or stepper axis. The ACCEL, DECEL and slewspeed parameters are not used during a cam.

The Cam function sets up a cam move on the specified axis using the tables defined byCamTable. The functionality of the cam is controlled with the mode parameter.<expression> is a bit mask that controls the type of cam profile to be performed. The bitmask is as follows:

Bit Constant Meaning

0 cmABSOLUTE Use the positions specified in the position andmaster distance tables as being absolute withineach cam table cycle. If this bit is not set, theposition and master distance tables will be takenas relative movements.

1 cmT_ABSOLUTE Use the positions specified in the position table asbeing absolute to true motor positions. Bit 0 mustbe set for this to occur.

2 cmCONTINUOUS Continuously cycle through the cam table,beginnning from the start position when the tableend is reached.

3 cmNO_INTERPOLATION Controls the interpolation method. If this bit isset, then no interpolation is performed. If this bitis not set, then linear interpolation is performed.

Given a set of cam data; slave positions, S1, S2 and S3 and master positions, M1, M2 and M3,bit 3 controls motion as follows:

Page 73: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 73

Interpolated cam:

Master Position

SlavePosition

M1 M3M2

S3

S2

S1

Slave position is linearly interpolated between each point in the table.

Non-interpolated cam :

Master Position

SlavePosition

M1 M3M2

S3

S2

S1

Slave position is not interpolated so position is constant during a segment.

Page 74: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 74

Notes:• The first element in the cam table defines the number of cam segments. This allows for

greater flexibility in defining different tables.• Absolute cams have a starting position of 0 within the cam cycle.• Multiple cam tables can be defined using the CamStart and CamEnd parameters.• The master distance for a segment must be greater than zero. If a segment is found with

an invalid master distance then an asynchronous slave synchronisation error (bit 11) willbe generated and the cam will crash stop and the drive will be disabled.

• cams are profiled every 2ms. If a segment is shorter than 2ms, then that segment may beskipped and the next segment used. Up to five segments may be skipped in 2ms, givingan effective minimum segment duration of 400 microseconds. If more than 5 segmentsare skipped, an asynchronous slave synchronisation error (bit 11) will be generated andthe cam will crash stop and the drive will be disabled.

Parameters:axisNo specifies the axis to set the cam up on.

0 <= axisNo < MAX_AXES.

mode is a bit pattern that controls the type of cam profile performed as described above.

Restrictions:The cam tables must have been specified prior to the call to Cam and the axis must bemdIDLE and not in error.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Simple Cam profile of 10 segments that performs a specified path on *//* the slave axis *//* Define the Cam position table. 10 segments so array size 11 as first*//* element specifies number of segments *//*----------------------------------------------------------------------*/float positions[11] = {10, 1, 2, 4, 7, 15, 14, 12, 13, 4, 1};

setMasterSource (0, 0); /* Slave axis 0 to follow position .. */setMasterChannel (0, 4); /* of axis 4 */setMasterDistance (0, 5); /* Each slave segment lasts 5 master revs *//*----------------------------------------------------------------------*//* Use the array ‘positions’ as the position table. No master increment*//* table being used so pass a NULL pointer. *//* NULL defined in STDLIB.H Use 0 otherwise *//*----------------------------------------------------------------------*/

Page 75: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 75

setCamTable (0, &positions[0], NULL);setCamStart (0, 1); /* Start at position 1 in the table */setCamEnd (0, 10); /* End at position 10 in the table *//*----------------------------------------------------------------------*//* Set up the Cam to use the position table value as absolute within *//* a Cam cycle and define a continuous Cam *//*----------------------------------------------------------------------*/setCam (0, cmABSOLUTE + cmCONTINUOUS);GO (1, 0); /* Start the move on axis 0 */

See Also:

CamEnd, CamIndex, CamStart, CamTable, CamPhase, MasterChannel,MasterDistance, MasterSource, Spline, Stop

CamAmplitudePC BX Scaled Default Range❏ ❏ - 1 0.0 - 8388607.0

Prototype:__int16 CCONV getCamAmplitude (__uint8 axisNo, float *amplitude)__int16 CCONV setCamAmplitude (__uint8 axisNo, float amplitude)

DescriptionThe CamAmplitude function allows a cam profile to easily scaled to change to positionrange of the slave motion. The slave positions are simply multiplied by the amplitude value,based on the position within the current cam cycle.

The amplitude value has an immediate affect on the profile and can cause the slave to jumpin position.

ParametersaxisNo specifies the axis to perform the cam profile scaling on.

0 <= axisNo < MAX_AXES.

amplitude is a scalar value used to scale the Cam profile

Restrictions:The a cam move must be loaded.

Default:The default is 1.

Page 76: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 76

Example:If the cam profile was set up as

float positions[11] = {10, 1, 2, 4, 7, 15, 14, 12, 13, 4, 1};

and the cam amplitude was changed to 2setCamAmplitude( 0, 2 );

this would have the effect equivalent to changing the position values in the profile to: 2, 4,8, 14, 30, 28, 24, 26, 8, 2.

See also:

Cam, CamEnd, CamIndex, CamStart, CamTable

CamEndPC BX Scaled Default Range❏ ❏ - 1 - 65535

Prototype:__int16 getCamEnd (__uint8 axisNo, __uint16 *segmentNo)__int16 setCamEnd (__uint8 axisNo, __uint16 segmentNo)

Description:A cam profile will continue through a table until the segment set as the end segment isreached. This function sets or reads back the end segment number.

The end segment must be within number of segments in the currently specified cam table. Ifa new table is specified with the CamTable function that has fewer segments than thecurrent end segment value, the end segment will be automatically be set to the end segmentin the table when the cam is set up by a call to Cam.

Changes to the start or end segment values are buffered and do not take effect until thecurrent end of segment is reached. If new start or end values must be set at the start of acam profile, the must be set before the Cam function is called.

Parameters:axisNo specifies the axis for which the Cam table end segment is to be set or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

1 <= segmentNo <= Number of segments in table

Page 77: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 77

Restrictions:None.

Default:The default end segment number is 1.

Example:/*----------------------------------------------------------------------*//* Set the end segment on axis 0 table to 20. *//*----------------------------------------------------------------------*/setCamEnd (0, 20);

See Also:

Cam, CamIndex, CamStart, CamTable

CamIndexPC BX Scaled Default Range❏ ❏ - 1 - 65535

Prototype:__int16 getCamIndex (__uint8 axisNo, __uint16 *segmentNo)

Description:Returns the currently executing cam segment number. If no cam profile is in progress thenthe last segment number from the last cam profile is returned.

Parameters:axisNo specifies the axis to read the index value from. or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

0 <= segmentNo <= Number of segments in table

Restrictions:None.

Default:The initial index value is zero.

Page 78: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 78

Example:/*----------------------------------------------------------------------*//* Wait until the index has passed 10 before moving the start segment *//* of a continuous Cam from segment 1 to segment 10 *//*----------------------------------------------------------------------*/int16 index;

do { getCamIndex (4, &index);} while (index < 11);

setCamStart (4, 10);

See Also:

Cam, CamEnd, CamStart, CamTable

CamPhasePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 doCamPhase (__uint8 axisNo, __uint16 startIndex, __uint16 numSegment, float deltaMSD)

Description:The CamPhase function allows a cam profile to be phase shifted forwards or backwards.This phasing occurs over a fixed number of specified cam segments, specified by number ofsegments. If the cam is being executed in a positive direction the phasing will begin whenthe segment number specified by start segment is entered. Conversely, if the cam is beingexecuted in a negative direction the phasing will begin when the cam enters the segmentnumber specified by the sum of start segment and number of segments.

The phasing is achieved by modifying the master distance by a fixed amount specified bydelta master distance. This has the effect of stretching or squashing the cam profiledepending on the sign of the master distance modified.

It is possible to set-up a cam phase over a greater number of segments than are in the profile.

If a cam phase is in progress and the cam start or end points are modified using theCamStart or CamEnd functions, this change is buffered until the phasing is completed.

Only one CamPhase can be pending or in operation at any one time.

Parameters:axisNo specifies the axis to read the index value from. or read.

Page 79: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 79

0 <= axisNo < MAX_AXES.

startIndex is the end segment number.

0 <= startIndex <= Number of segments in table

numSegment is the number of segments over which the phasing will occur.

deltaMSD is the amount the master distance is modified by during the phasing operation.

Restrictions:Only one CamPhase operation can be set up, either pending or in progress, at any one time.If a second operation is attempted during while another is in progress the errorerMOTION_IN_PROGRESS is returned.

Example:doCamPhase(0, 2, 5, 1);

This will modify the current cam profile over 5 segments starting when the cam enterssegment 2 (if moving is a positive direction, the phasing will start at segment 7 if moving innegative direction). The phasing will modify the MasterDistance by 1 during the phasingoperation.

See Also:

Cam, CamEnd, CamStart, CamTable

CamPhaseStatusPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 getCamPhaseStatus (__uint8 axisNo, __uint8 phaseStatus)

Description:Gets the state of a CAMPHASE operation on a specified axes. Only one CAMPHASEoperation can be loaded at a time, in order to establish whether an axis is performing or hasa CAMPHASE pending the keyword CAMPHASESTATUS can be used.

When a CAMPHASE is in progress the CAMPHASESTATUS will return a non zero valueas defined in the table below.

Page 80: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 80

Parameters:axisNo specifies the axis to read the status from.

phaseStatus status of the current CAMPHASE operation

Value Meaning

0 No CAMPHASE in progress or pending, OK to load CAMPHASEoperation.

1 CAMPHASE operation pending.2 CAMPHASE operation in progress.

Restrictions:None

Example:__uint8 status;..getCamPhaseStatus(1, &status);

Gets the current status of CAMPHASE on axis 0.

See also:

CamPhase

CamSegmentPC BX Scaled Default Range❏ - - -

Prototype:__int16 setCamSegment (__uint8 axisNo, __uint8 table, __uint16 startSegment,

float FAR *segmentArray);

Description:When programming from the host using Immediate Command Mode, it is not possible tomodify cam profile by changing the array data since the data was passed across Dual PortRAM to NextMove. The CamSegment function allows multiple cam segments in the camarrays to be modified from the host, even whilst a cam is in progress.

The change will have an immediate effect although if the cam is currently executing thespecified segment, the change will not be seen until the next time that segment is processed.

Page 81: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 81

When writing an embedded application it is possible to modify the cam data my changingthe array elements in the arrays that were specified with the CamTable function.

Parameters:axisNo specifies the axis to read the index value from. or read.

0 <= axisNo < MAX_AXES.

table specifies which table to change:

Value Constant Meaning

0 csCAM_TABLE Modify the specified segment in the cam positionarray

1 csMASTER_TABLE Modify the specified segment in the masterdistance array

segmentNo is the first segment to be altered.

1 <= segmentNo <= Number of segments in table

segmentArray is an array containing the new data for the cam table.

The first element of this array contains the number of segment to be updated, the followingelements are the new cam table data.

For the position array:

MIN_FLOAT <= newData <= MAX_FLOAT

For the master distance array:

0 < newData <= MAX_FLOAT

Restrictions:CamSegment may used in both host and embedded code.

Example:/*----------------------------------------------------------------------*//* Define a cam position array *//*----------------------------------------------------------------------*/float pos[11] = {10, 1, 2, 3, 4, 3, 4, 3, 4, 2, 0};float newPosData[4] = {3, 4.5, 3.5, 4.5};

/*----------------------------------------------------------------------*//* Load the array for the cam to use *//*----------------------------------------------------------------------*/setCamTable (3, pos[0], NULL);

Page 82: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 82

/*----------------------------------------------------------------------*//* Use CamSegment to modify segments 6, 7, and 8 to 4.5, 3.5, 2.5 *//*----------------------------------------------------------------------*/setCamSegment (3, csCAM_TABLE, 6, newPosData[0]);

This will modify segment 6 of the cam array from 4 to 4.5, segment 7 of the cam array from3 to 3.5, segment 8 of the cam array from 4 to 2.5.

See Also:

Cam, CamPhase, CamTable

CamStartPC BX Scaled Default Range❏ ❏ - 1 1 - 65535

Prototype:__int16 getCamStart (__uint8 axisNo, __uint16 *segmentNo)__int16 getCamStart (__uint8 axisNo, __uint16 segmentNo)

Description:A Cam profile will start at the specified start segment number and continue through a tableuntil the end segment number is reached. If the Cam has been set up as continuous then theCam will return to the start segment number. This function sets or reads back the startsegment number.

The start segment must be within number of segments in the currently specified Cam table.If a new table is specified with the CamTable function that has fewer segments than thecurrent start segment value, the start segment will be automatically be set 1 when the Camis set up by a call to Cam.

Changes to the start or end segment values are buffered and do not take effect until thecurrent end of segment is reached. If new start or end values must be set at the start of acam profile, the must be set before the Cam function is called.

Parameters:axisNo specifies the axis for which the Cam table start segment is to be set or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

1 <= segmentNo <= Number of segments in table

Page 83: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 83

Restrictions:None.

Default:The default start segment number is 1.

Example:/*----------------------------------------------------------------------*//* Set the start segment on axis 7 table to the current index *//*----------------------------------------------------------------------*/__int16 index;

getCamIndex (7, &index);setCamStart (7, index);

See Also:

Cam, CamEnd, CamIndex, CamTable

CamTablePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setCamTable (__uint8 axisNo, float* PosArray, float* LengthArray)

Description:A Cam profile is split into a number segments which form the Cam table. Two tables can bedefined for a Cam profile, the position table and the master distance table.

Position Array:

Each segment of the position table specifies how far and in which direction the slave axiswill move for that segment. The table is defined using an array which defines the number ofsegments in the table and the table itself. The first element of the array specifies the numberof segments defined in the table and the subsequent values define the Cam segments. Thevalues are in user units, as set with the SCALE function.

The table can have any number of segments, (memory space permitting). When the Cam isexecuted, each segment is processed in turn until the end of the table is reached. A singleshot Cam will stop when the end of the table is reached, a continuous Cam will repeat thetable when it reaches the end.

The segment values in the cam table can be used in one of three ways:

Page 84: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 84

1. The values represent relative movements. Each value is the relative distance that theslave axis must move over that segment.

2. The values represent absolute positions within a Cam cycle. During a continuous Cam,each repetition of the table is known as a cycle. Each time the table starts, the currentslave axis position is considered as zero and the table values are taken as absolute to thatposition.

3. The values represent true absolute positions. The value are absolute with reference toactual axis position. The zero position is from when the axis was last reset or homed.

Master Distance Table:

This tells the Cam the distance the master axis must move to complete the segment beingexecuted. The master distance either be set identically for each segment or a separate valuecan be defined for each segment.

The ability to define the master distance for each segment allows for critical points on aprofile to be defined more easily. Where the slave motion is not critical, a large masterdistance can be set so the slave travels a large distance in only one or two segments. Thenwhere the motion is more important, smaller master distances are defined, allowing thesegment moves to be smaller and more detailed. A general master distance is defined withthe MasterDistance function.

The master distance table specifies each master distance in master axis user units. Thenumber of segments does not need to be placed as the first element of the array. All masterdistances are relative distances and must be positive.

The Cam tables can be set up in arrays of any name. This allows multiple tables to bedefined and the name of the table to use is passed to the Cam. This function tells the Camthe names of the arrays to use. The names are passed by reference, NULL being passed inplace of the master distance table name if the MasterDistance value is to be used instead.NULL is defined in the header file STDLIB.H and must be included in the project. 0 can beused instead of NULL.

Parameters:axisNo specifies the axis for which the Cam tables are being defined.

0 <= axisNo < MAX_AXES

posArray is the address of the position table.

MIN_FLOAT <= position element <= MAX_FLOAT

LengthArray is the address of the master distance table.

0 < length element <= MAX_FLOAT

Page 85: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 85

Restrictions:The axis cannot be performing a cam.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Define a position table to have 10 segments and a corresponding *//* master distance table. Set these up on axis 0 and 1. Use a *//* constant master distance of 20 revs on axis 1 *//*----------------------------------------------------------------------*/float points[11] = {10, 0.2, 0.3, -0.1, -0.1, 1.22, 3, 4.5, 0.3, 0, 0.1};float drive[10] = {20, 20, 20, 15, 10, 5, 10, 15, 20, 20};

/*----------------------------------------------------------------------*//* Use ‘points’ as position table and ‘drive’ as master distance table *//*----------------------------------------------------------------------*/setCamTable (0, points[0], drive[0]);

/*----------------------------------------------------------------------*//* Use a constant master distance of 20 *//*----------------------------------------------------------------------*/setCamTable (1, points[0], NULL);setMasterDistance (1, 20);

See Also:

Cam, CamEnd, CamIndex, CamStart

CANBaudPC BX Scaled Default Range❏ ❏ - 125 10, 20, 50, 125, 250, 500, 800,

1000

Prototype:__int16 getCANBaud (__uint16 *baud)__int16 setCANBaud (__uint16 baud)

Description:All CAN nodes on the CAN network must use the same baud rate. The CANBaud functionsets the can baud rate that NextMove is using.

The baud rate that a remote node is using is set with the RemoteBaud function whilst thenode is in configuration mode.

The length of CAN cabling determines the maximum suitable baud rate. See the ‘ioNodeReference Guide’ for details.

Page 86: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 86

On NextMove BX, the CAN baud rate is stored in EEPROM and is retained when controllerpower is removed.

Parameters:baud specifies the baud rate in kBit/s. The following are valid:

10 kBit/s, 20 kBit/s, 50 kBit/s, 125 kBit/s, 250 kBit/s, 500 kBit/s, 800 kBit/s and 1000kBit/s.

Restrictions:None.

Default:The default baud rate is 125 kBit/s.

Example:setCANBaud (1000); /* Set the CAN baud rate to 1000kBit/s */

See also:

RemoteBaud, RemoteNode, RemoteSetup

CANCELPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 CANCEL (__uint8 axisNo)

Description:CANCEL will clear any asynchronous motion errors and any asynchronous miscellaneouserrors on an axis. Motion on the axis is crash stopped and the state of the relay and driveenable outputs is unaffected.

Axis demand position is set the axis measured position, i.e. following is zeroed. The servoloop integrator is also zeroed.

If an error condition is cleared but the source of the error is still present, e.g. an active limitinput, then the error will be generated again.

Parameters:axisNo specifies the axis whose motion should be cancelled and axis error cleared.

0 <= axisNo < MAX_AXES.

Page 87: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 87

Restrictions:None. CANCEL may be called at any time.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Define an error handler. *//* Simply cancel the motion and any error on each of the axes used. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ CANCEL (0); CANCEL (1); CANCEL (4);}

See Also:

AsyncError, ERROR, ErrorHandler, ErrorMask, RESET, SystemError

CANHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setCANHandler (TCANHandler *handler)

Description:Installs a user handler that will be called in response to an asynchronous CAN error orevent. CAN bus events and errors are stored in an event queue. Whenever there is an entryin this queue, the user CAN handler will be called if it is defined. Within the handler it ispossible to read an clear the events, and to take recovery action if appropriate.

The CANSTATUS and STATUSNODE functions can be used to determine the source ofthe event.

Even if contents of the queue are not used, it is advisable to keep the queue empty to avoidthe overhead of repeated attempted calls to the handler.

Parameters:handler is the address of the user supplied CAN handler function. TCANHandler is definedin the file MG.H as:

typedef void TCANHandler (void);

Page 88: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 88

Restrictions:None.

Default:By default there is no user supplied handler.

Example:Define a user CAN handler that just keeps the queue empty.

void myCANHandler (void); /* Prototype the handler */

void main (void){ initialiseNextMove(); /* Initialise NextMove */

setCANHandler (myCANHandler) /* Install user handler */ ...}

void myCANHandler (void){ __uint16 canstatus; __int16 node;

repeat { CANSTATUS (&canstatus); /* Read the event/error */ STATUSNODE (&node); /* Read the node */ } until (canstatus == 0);}

Example:Define a user CAN handler to handle CAN events.

void myCANHandler (void); /* Prototype the handler */

void main (void){ initialiseNextMove(); /* Initialise NextMove */

setCANHandler (myCANHandler) /* Install user handler */ ...}

void myCANHandler (void){ __uint16 event; __uint8 remoteEvent; __int16 node; __uint8 type; __uint32 pattern; __uint8 live;

CANSTATUS (&event); /* Read the event/error */ STATUSNODE (&node); /* Read the node */

Page 89: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 89

if (event & btABERR) tPrintf (tmDPR, 0, "Abnormal bus error"); if (event & btBUSOFF) tPrintf (tmDPR, 0, "CAN in 'bus off' state"); if (event & btOVER) tPrintf (tmDPR, 0, "Receive/Transmit overrun"); if (event & btLIVE) tPrintf (tmDPR, 0, "Node %d has become live", node); if (event & btDEAD) tPrintf (tmDPR, 0, "Node %d has died", node); if (event & btRNERR) {

/* Event caused by a change of status on a remote node. Read */ /* the remoteStatus */ getRemoteStatus (node, &removeEvent);

if (remoteEvent == btLIVE) tPrintf(tmDPR, 0, "Node %d ok", node); if (remoteEvent & btRNERR) { getNodeType (node, &type);

if (type == ntIONODE24_24) { getRemoteOutputError (node, &pattern); tPrintf(tmDPR, 0, "Node %d has output errors: %ld”, node, pattern); } else { tPrintf(tmDPR, 0, "Node %d has an output error”, node); /* Output driver error cleared by writing to outputs */ } setRemoteOutputError (node, 0); } }

/* Check current status of a remote node */ if (node >= 1) { getNodeLive (node, &live); if (live) { getRemoteStatus (node, &removeEvent); if (remoteEvent != btLIVE) tPrintf (tmDPR, 0, "Node %d in error", node); getNodeType (node, &type); if (type == ntIONODE24_24) setRemoteStatus (node, 0); } }}

See Also:

CANSTATUS, DualPortHandler, ErrorHandler, FastposHandler, STATUSNODE,StopSwitchHandler, UserInterruptHandler

CANSTATUSPC BX Scaled Default Range❏ ❏ - 0 0 - 127

Prototype:__int16 CANSTATUS (__uint16* status)

Page 90: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 90

Description:Asynchronous CAN errors and event are stored in the CAN event queue. TheCANSTATUS function returns a bit pattern that indicates the cause of an asynchronousCAN error or event. The bit pattern is as follows, more than one of which can besimultaneously reported:

Bit Constant Description

0 btABERR Abnormal bus errors. NextMove is experiencing an abnormalrate of failed transmissions and receptions.

1 btBUSOFF Bus off. NextMove has gone into the ‘bus-off’ state because ofa high rate of failed transmissions and receptions.

2 btOVER Receive or transmit overrun. CAN messages are arriving morefrequently than they can be serviced or are not beingsuccessfully transmitted.

3 btDEAD A remote node has died. A remote node is no longer replyingto node guard messages from NextMove.

4 btLIVE A remote node has become live. A remote node is nowreplying to node guard messages from NextMove. This willhappen if the node has just been added to the bus or the nodehad previously died.

5 Reserved.6 btRNERR A remote node has experienced an error or a change of status.

The cause may be determined by calling the RemoteStatusfunction.

The CANSTATUS information returned relates to a CAN node. The identifier of the nodeis read with the STATUSNODE function. Only when both CANSTATUS andSTATUSNODE functions have been read will an entry be removed from the queue.Therefore, CANSTATUS and STATUSNODE are read as a pair.

The btABERR, btBUSOFF and btOVER bits may become set again immediately if theassociated error condition persists.

When an asynchronous CAN event/error occurs, the use CAN handler will be called if it isdefined.

Parameters:status is the status entry from the event/error queue.

Restrictions:None.

Page 91: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 91

Default:Not applicable.

Example:/*-----------------------------------------------------------------------*//* This example adds 4 nodes to the CAN network and then toggles the *//* outputs on and off. The CAN handler is designed to clear CAN *//* errors and continue as quickly as possible. *//*-----------------------------------------------------------------------*/#include "mg.h"

void CANHandler(void);

void main (void){ unsigned __int8 i; unsigned __int8 live; unsigned __int8 state;

/*---------------------------------------------------------------------*/ /* Start NextMove */ /*---------------------------------------------------------------------*/ initialiseNextMove();

/*---------------------------------------------------------------------*/ /* Specify the user CAN handler */ /*---------------------------------------------------------------------*/ setCANHandler (CANHandler);

/*---------------------------------------------------------------------*/ /* Clear any errors on all axes */ /*---------------------------------------------------------------------*/ for (i = 0 ; i < cnMAX_AXES; i++) CANCEL (i);

/*---------------------------------------------------------------------*/ /* Set NextMove to communicate over CAN at 125 kBit/s */ /*---------------------------------------------------------------------*/ setCANBaud (125);

/*---------------------------------------------------------------------*/ /* Four remote nodes on network. */ /* 1 - InputNode 8 */ /* 2 - OutputNode 8 */ /* 3 - RelayNode 8 */ /* 4 - IONode 24/24 */ /*---------------------------------------------------------------------*/ setNodeType (1, ntINPUT_NODE_8); setNodeType (2, ntOUTPUT_NODE_8); setNodeType (3, ntRELAY_NODE_8); setNodeType (4, ntIONODE24_24);

/*---------------------------------------------------------------------*/ /* Wait until all nodes become live */ /*---------------------------------------------------------------------*/ for (i = 1; i < 5; i++) {

Page 92: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 92

do { getNodeLive (i, &live); } while (!live); }

/*---------------------------------------------------------------------*/ /* A 24 I/O node needs to have its status cleared manually */ /*---------------------------------------------------------------------*/ getRemoteStatus (4, &state); if (state != btLIVE) setRemoteStatus (4, 0);

/*---------------------------------------------------------------------*/ /* A 24 I/O may be in its emergency stop state */ /*---------------------------------------------------------------------*/ getRemoteEStop (4, &state); if (state) setRemoteEStop (4, 0);

/*---------------------------------------------------------------------*/ /* All nodes are now ready for use. Simply turn outputs on and off. */ /*---------------------------------------------------------------------*/ while (1) { setRemoteOUT (2, 255); setRemoteOUT (3, 255); setRemoteOUT (4, 16777215L); WAIT (1000);

setRemoteOUT (2, 0); setRemoteOUT (3, 0); setRemoteOUT (4, 0); WAIT (1000); }}

/*-----------------------------------------------------------------------*//* User CAN handler *//*-----------------------------------------------------------------------*/void CANHandler (void){ __uint8 i; __uint8 nodeType; __uint8 live; __uint8 state; __uint16 canStatus; __int16 node;

/*---------------------------------------------------------------------*/ /* An asynchronous CAN error has occurred. Read the event queue */ /* and the related node */ /*---------------------------------------------------------------------*/ CANSTATUS (&canStatus); STATUSNODE (&node);

/*---------------------------------------------------------------------*/ /* A remote node has had an error or change of status */ /*---------------------------------------------------------------------*/ if (canStatus & btRNERR) {

Page 93: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 93

getRemoteStatus (node, &state);

if (state & btRNERR) { /*-----------------------------------------------------------------*/ /* A remote node is in error */ /*-----------------------------------------------------------------*/ getNodeType (node, &nodeType);

/*-----------------------------------------------------------------*/ /* If node is a IONode 24/24 or OutputNode 8 then must be an */ /* output error so clear it. */ /*-----------------------------------------------------------------*/ if (nodeType == ntIONODE24_24 || nodeType == ntOUTPUT_NODE_8) setRemoteOutputError (node, 0); } }

/*---------------------------------------------------------------------*/ /* Check the current status of the node */ /*---------------------------------------------------------------------*/ if (node >= 1) { getNodeLive (node, &live); if (live) { getRemoteStatus (node, &state); getNodeType (node, &nodeType); if ((nodeType == ntIONODE24_24) && state) setRemoteStatus (node, 0); } }}

See Also:

CANHandler, RemoteStatus, STATUSNODE

CapturePC BX Scaled Default Range

❏ - 0 0 - 2

Prototype:__int16 getCapture (__uint8 FAR *runMode);__int16 getCapture (__uint8 runMode);

Description:The capture keyword is used to start and stop the capture process. Capture takes a parameterthat controls the operation of capture as follows:

Page 94: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 94

Capture Action

0 Stop capturing data1 Start a single shot capture2 Start continuous capture

When capturing data in single shot mode, once the capture buffer is full capture willautomatically stop and set CAPTURE to zero.

When capturing data in continuous mode the data is stored in a circular buffer so the oldestvalues are overwritten once the buffer is filled.

The captured data can be uploaded using the Load Captured Data option from the Toolsmenu in cTERM for Windows.

Parameters:runMode controls the operation of triggering and the type of capture performed.

0 <= runMode <= 2

Restrictions:None.

Default:By default capture is turned off.

Example:setCaptureMode (0, 1); \* capture measured speed *\setCaptureAxis (0, 0); \* capture data from axis 0 *\setCaptureMode (1, 3); \* capture measured position *\setCaptureAxis (1, 0); \* capture data from axis 0 *\setCaptureMode (2, 1); \* capture measured speed *\setCaptureAxis (2, 1); \* capture data from axis 1 *\setCaptureMode (3, 3); \* capture measured position *\setCaptureAxis (3, 1); \* capture data from axis 1 *\

setMOVEA (0, 1); \* load move *\setMOVEA (1, 2); \* load move *\tPrintf (tmRS232, 0, “Capturing data … ”);setCapture (1) \* start capture *\GO(2, 0, 1); \* start motion *\do { \* wait for motion to stop *\ groupStatus = 0; getIDLE(0, &status); groupstatus |= status getIDLE(1, &status); groupstatus |= status} while (groupStatus !=0);setCapture (0); \* stop capture *\

Page 95: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 95

tPrintf (tmRS232, 0, “Finished”);

This example captures axis 0 and axis 1 measured speed and measured position duringmotion.

See also:

CaptureAxis, CaptureMode, CaptureInterval

CaptureAxisPC BX Scaled Default Range

❏ - 0 0 - 3

Prototype:__int16 getCaptureAxis (__uint8 channel, __uint8 FAR *pCaptureAxis);__int16 setCaptureAxis (__uint8 channel, __uint8 newCaptureAxis);

Description:There are four capture channels each of which can look at the same or a different axis. Thiskeyword selects the axis which a specific capture channel will use.

Parameters:channel is the capture channel which will store the data.

0 <= channel <= 3

captureAxis is the axis from which to capture data.

0 <= captureAxis < MAX_AXES

Restrictions:None.

Default:All capture channel are set-up to capture data from axis 0.

Example:setCaptureAxis (0, 3);

Sets capture channel zero to capture data from axis 3.

See also:

Capture, CaptureMode, CaptureInterval

Page 96: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 96

CaptureModePC BX Scaled Default Range

❏ - 0 0 - 10

Prototype:__int16 getCaptureMode (__uint8 channel, __uint8 FAR *pCaptureMode);__int16 setCaptureMode (__uint8 channel, __uint8 newCaptureMode);

Description:The various axis variables that are available to capture are:

Capture Mode Parameter

0 Nothing1 Measured Speed2 Following Error3 Measured Position4 DAC Demand (%)5 Demand Position6 Demand Speed7 Mode of Motion8 Digital Inputs9 Auxiliary Encoder Value

10 Auxiliary Encoder Velocity

Setting the a capture channel’s capture mode to zero will clear the current captureddata.

Parameters:channel is the capture channel which will store the data.

0 <= channel <= 3

captureMode is the axis from which to capture data.

0 <= captureMode <= 10

Restrictions:None.

Page 97: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 97

Default:All capture channel are configured to capture nothing.

Example:setCaptureMode (1, 2);

Sets capture channel one to capture the following error from the axis specified byCAPTUREAXIS.

See also:

Capture, CaptreAxis, CaptureInterval

CAPTUREINTERVALPC BX Scaled Default Range

❏ - 1 1 - 255

Prototype:__int16 getCaptureInterval (__uint8 FAR *pCaptureInterval);__int16 setCaptureInterval (__uint8 newCaptureInterval);

Description:Capture is capable of storing 1000 different measurements for each channel, the resolutionof the captured data is controlled by the CATUREINTERVAL. By default this is 1 profilerinterval (2ms) so a full capture buffer will hold 2 seconds of data.

Increasing CAPTUREINTERVAL will decrease the resolution but will increase the timeperiod over which the data is recorded.

Parameters:captureInterval is the capture sample period.

1 <= captureInterval <= 255

Restrictions:None.

Default:The default capture sample rate is 2ms.

Example:setCaptureInterval (5);

Page 98: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 98

Sets the capture interval to 5 profiler intervals. This means that capture will store up to 10seconds of data with a resolution of 10ms.

See also:

Capture, CaptureAxis, CaptureMode

CIRCLEAPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 setCIRCLEA (__uint8 xAxis, __uint8 yAxis, float xCentre, float yCentre, float angle)

Description:Sets up a circular move with centre at absolute co-ordinates xCentre, yCentre on axes xAxisand yAxis. The centre co-ordinates are given in user units, the angle in degrees. After asuccessful call to setCIRCLEA the first, xAxis (the master axis) will have a move pending.The move will commence when any current motion on xAxis and yAxis has completed andGO has been called. A move of type mdCIRCULAR will be present in the move buffer. Themove can be terminated by calling STOP, CANCEL or RESET.

It is possible to produce ellipses by changing the scale factor for one of the axes.

Parameters:xAxis and yAxis specify which two axes will take part in the motion.

0 <= xAxis, yAxis < MAX_AXES (xAxis # yAxis)

xCentre and yCentre specify the absolute position of the circle centre in user units.

MIN_FLOAT <= xCentre, yCentre <= MAX_FLOAT

angle specifies the angle in degrees through which motion should take place. angle positivespecifies anti-clockwise rotation, angle negative specifies clockwise rotation.

MIN_FLOAT <= angle <= MAX_FLOAT

Page 99: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 99

Restrictions:If the length of the resultant move is zero no move will be generated. The function will waituntil there is a free slot in axis1 and axis2 move buffers. To avoid the call hanging youshould test for a free slot prior to calling setCIRCLEA by calling okToLoadMove.Circular moves may be performed on any combination of axis types. Both axes must be ableto move, ie: not configured as cfOFF, and have no error present.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* An x-y plotter is used to draw a full circle whose centre is at *//* (20, 20). Assume that the pen is currently at (0, 0) which will *//* produce a radius of 28.284 mm. The drawing speed is 100 mm/s. *//*----------------------------------------------------------------------*/void main (void){ setSCALE (0, 2000); /* set scale to program in mm */ setSCALE (1, 4000); /* different gearing on axes */ setSPEED (0, 100); /* path speed is 100 mm/s */ setCIRCLEA (0, 1, 20, 20, 360); /* load the full circle */ GO (1, 0); /* start the move */}

See Also:

ACCEL, CIRCLER, CONTOFF, CONTON, DECEL, GO, IDLE, MoveBufferSize,okToLoadMove, RAMP, SCALE, SPEED, VECTORA, VECTORR

CIRCLERPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 setCIRCLER (__uint8 xAxis, __uint8 yAxis, float xCentre, float yCentre, float angle)

Description:Sets up a circular move with centre at relative co-ordinates xCentre, yCentre on axes xAxisand yAxis. The centre co-ordinates are given in user units, the angle in degrees. After asuccessful call to CIRCLER the first, xAxis (the master axis) will have a move pending.The move will commence when any current motion on xAxis and yAxis has completed andGO has been called. A move of type mdCIRCULAR will be present in the move buffer. Themove can be terminated by calling STOP, CANCEL or RESET.

Page 100: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 100

It is possible to produce ellipses by changing the scale factor for one of the axes.

Parameters:xAxis and yAxis specify which two axes will take part in the motion.

0 <= xAxis, yAxis < MAX_AXES (xAxis # yAxis)

xCentre and yCentre specify the relative position of the circle centre in user units.

MIN_FLOAT <= xCentre, yCentre <= MAX_FLOAT

angle specifies the angle in degrees through which motion should take place. angle positivespecifies anti-clockwise rotation, angle negative specifies clockwise rotation.

MIN_FLOAT <= angle <= MAX_FLOAT

Restrictions:If the length of the resultant move is zero no move will be generated. The function will waituntil there is a free slot in xAxis and axis2 move buffers. To avoid the call hanging youshould test for a free slot prior to calling CIRCLER by calling okToLoadMove. Circularmoves may be performed on any combination of axis types. Both axes must be able tomove, ie: not configured as cfOFF, and have no error present.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* An x-y plotter is used to draw a figure of eight with the two circle *//* centres lying on the x axis. Radius of each circle is 20 mm, path *//* speed is 100 mm/s. Starting position is (0, 0). *//*----------------------------------------------------------------------*/void figureOfEight (void){ CONTON (0); /* draw shape without stopping */ setSPEED (0, 100); /* path speed is 100 mm/s */ setCIRCLER (0, 1, 20, 0, 360); /* anti-clockwise in right hand plane*/ GO (1, 0); /* start the move */ setCIRCLER (0, 1, -20, 0, -360); /* clockwise in left hand plane */ GO (1, 0); /* start the move */}

See Also:

ACCEL, CIRCLEA, CONTOFF, CONTON, DECEL, GO, IDLE, MoveBufferSize,okToLoadMove, RAMP, SCALE, SPEED, VECTORA, VECTORR

Page 101: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 101

CommsPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 getComms (__int16 node, __uint16 index, float *value)__int16 setComms (__int16 node, __uint16 index, float value)

Description:comms is a reserved array of 99 elements which is automatically defined by the MML anduses an area of RAM to communicate these arrays values between NextMove and the host.The comms protocol provides a simple and convenient method of data transfer and programcontrol between a host and NextMove.

NextMove PC:The data is written from address 1D6 hex in dual port RAM and can be read by userapplications on the PC side. NextMove PC does not have any non-volatile memory so thevalues in the comms array are not preserved during power off.

NextMove BX:The comms array does not reside in normal array space and will not be saved using the savecommand. The contents of the array will be preserved during a power off in the samemanner as other data. The comms array is updated over the RS232 or RS485 serial port. Inorder to use a serial port for this purpose comms must be enabled using the CommsModefunction and the node number of the controller must be configured using the SerialNodefunction for RS485.

If the controller is configured as the network master then the node number specifies thecontroller whose comms array is to be accessed. If the controller is not configured as anetwork master then the node number, if specified, must be that of the controller issuing thecommand.

The node number is an optional variable. If not specified the local comms array will beaccessed. Otherwise, providing the controller is the network master, it will send out a commsmessage via the RS485 port requesting the appropriate data.

Parameters:node is the RS485 node number used if the NextMove BX is the master of the network. Aslave node must pass its own RS485 node number. This parameter is ignored for RS232 andDual Port RAM.

0 <= node <= 15

Page 102: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 102

index specifies the element in the comms array to write to.

1 <= index < 99

value specifies the value to write to the comms array.

MIN_FLOAT <= value <= MAX_FLOAT

Restrictions:For RS485 multi-drop bus, the controller node number must first be configured using theSerialNode function.

Example:Using the comms protocol to allow the host to control application.

NextMove PC:/* Simple loop showing use of comms protocol *//* Comms address 1 - command *//* Comms address 2 - axis *//* Comms address 10 - data */

float command;float axis;float data;

setComms (0, 1, 0.0); /* Clear down the command */

while(1) { getComms (0, 1, &command); getComms (0, 2, &axis);

if (command) setComms (0, 1, 0.0); switch (command) { case 1: getComms (0, 10, &data); setSPEED (axis, data); break;

case 2: getComms (0, 10, &data); setMOVER (axis, data); GO (1, axis); break;

case 3: getComms (0, 10, &data); setACCEL (axis, data); setDECEL (axis, data); break; }}

Page 103: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 103

NextMove BX:/* Simple loop showing use of comms protocol *//* Comms address 1 - command *//* Comms address 2 - axis *//* Comms address 10 - data */

float command;float axis;float data;

setCommsMode (tmRS485, 1); /* enable the RS485 comms protocol */setComms (0, 1, 0.0); /* Clear down the command */

while(1) { getComms (0, 1, &command); getComms (0, 2, &axis);

if (command) setComms (0, 1, 0.0); switch (command) { case 1: getComms (0, 10, &data); setSPEED (axis, data); break;

case 2: getComms (0, 10, &data); setMOVER (axis, data); GO (1, axis); break;

case 3: getComms (0, 10, &data); setACCEL (axis, data); setDECEL (axis, data); break; }}

See Also:

CommsMode, SerialNode

CommsModePC BX Scaled Default Range

❏ - 0 0 - 3

Prototype:__int16 getCommsMode (__uint8 terminal, __int8 *mode)__int16 setCommsMode (__uint8 terminal, __int8 mode)

Page 104: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 104

Description:Control the use of protected comms protocol on the RS232 or RS485 serial ports. In order touse a serial port for this purpose comms must be enabled and the node number of thecontroller must be configured using the SerialNode function for RS485.

Parameters:terminal specifies the terminal channel to set the use of comms for.

Value Constant Meaning

1 tmRS232 RS232 serial port2 rmRS485 RS485 serial port

mode specifies the functionality of the comms protocol accepting the following bit pattern:

Bit Meaning

0 Enable the comms protocol on the specified channel if bit is set.1 Master of the network. Bit 0 must be set. Only node 0, as set with the

SerialNode function, can be the network master.

Examples:/* Enable comms on the 485 port. Set node number to 0 and indicate that *//* we are the network master. Set comms 1 to 10 on all nodes to 0 */

setSerialNode (tmRS485, 0); /* Set RS485 node number to 0 */setCommsMode (tmRS485, 3); /* Enable comms and master of network */

for (location = 1; location <= 10; location++) { /* Write to local comms array */ setComms (0, location, 0.0);

/* Write to nodes 1 and 13 */ setComms (1, location, 0.0); setComms (13, location, 0.0);}

See also:

Comms, SerialNode

Page 105: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 105

CONFIGPC BX Scaled Default Range❏ ❏ - 1 / 2 0 - 3 PC

0 - 1 BX

Prototype:__int16 getCONFIG (__uint8 axisNo, __uint16 *config)__int16 setCONFIG (__uint8 axisNo, __uint16 config)

Description:Sets or returns the configuration of the axis. The configuration of an axis controls thehardware that is available to the user and the hardware used to produce motion on an axis.The possible configuration of an axis depends on the hardware available. Possibleconfigurations can be read using the DriveType function.

The value that an axis will accept depends on the physical channels available. A servo axis(consisting of a DAC and encoder) can only be configured as cfOFF or cfSERVO. A stepperaxis (consisting of a pulse and direction output) can only be configured as cfOFF,cfSTEPPER or cfPWM. The configuration of the axis controls what can be done with theaxis and which functions can be called. The following functions can only be used if the axisis configured off: DAC, Pulse, StepDirection and FREQ.

Turning an axis off will result in a speed-up in program execution. This is useful in a 1 or 2axis system where the remaining axes are not used. With the axis turned off, its encoderposition can still be read and the axis can also be used a master axis in master slave movetypes. cfPWM is not available on a stepper NextMove expansion board.

Due to the hardware restraints, the stepper axes on NextMove PC can not be configured ascfPWM and cfSTEPPER at the same time. Changing the configuration of one axis willautomatically change the configuration of other axes. For example, if axes 5 and 6 areconfigured for normal use as steppers, setting axis 5 as cfPWM would result in both axes 5and 6 being changed to cfPWM as cfPWM and cfSTEPPER are mutually exclusive across thestepper axes.

Parameters:axisNo specifies the axis on which the configuration is to be set or returned.

0 <= axisNo < MAX_AXES.

Page 106: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 106

config specifies the new axis configuration and may take one of the predefined constants:

Value Constant Meaning

0 cfOFF The axis is turned off and can be used for open loopcontrol

1 cfSERVO The axis is a servo.2 cfSTEPPER The axis is a stepper.3 cfPWM The axis is a PWM output.

Restrictions:The axis must be idle before a call to CONFIG to avoid a system Error. Some drive typesare not supported by every axis.

Default:Axes 0 - 3 will default to cfSERVO. Axes 4 - 7 on NextMove PC will default tocfSTEPPER.

Example:/*----------------------------------------------------------------------*//* Try to configure 8 axes of servo. If the hardware is not available *//* then configure non servo axes as off. *//*----------------------------------------------------------------------*/void configureDrives (void){ __int16 i; __uint32 type;

for (i = 0; i < cnMAX_AXES; i++) { getDriveType (i, &type); if (type & dtSERVO) setCONFIG (i, cfSERVO); else setCONFIG (i, cfOFF); }}

See Also:

DAC, CANCEL, DEFAULT, DriveType, FREQ, NumberOf, Pulse, PWMOnTime,PWMPeriod, RESET, StepDirection

CONTOFFPC BX Scaled Default Range❏ ❏ - off -

Prototype:__int16 CONTOFF (__uint8 axisNo)

Page 107: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 107

Description:Turns contouring off on the specified axis. When contouring is off successive moves willramp down to zero speed before the next move is started. In multi-axis moves (CIRCLEA,VECTORR etc.) contour control is only significant on the master axis. Contouring may beturned on by calling CONTON.

Parameters:axisNo specifies the axis on which contouring is to be turned off.

0 <= axisNo < MAX_AXES.

Restrictions:Contour control does not affect moves that have already been loaded.

Default:By default contouring is turned off.

Example:/*----------------------------------------------------------------------*//* An x-y gantry is used to dispense glue around a simple gasket. The *//* gasket is oblong with semi-circular ends. The glue is laid at a *//* constant speed of 100 mm/s. *//*----------------------------------------------------------------------*/void layBead (void){ __uint8 isidle;

setSPEED (0, 100); /* set lay speed of 100 mm/s */ CONTON (0); /* turn contouring on */ setOUTx (3, True); /* turn on the glue nozzle */

setVECTORR (2, 0, 100.0, 1, 0.0); /* lay along bottom edge */ GO (1, 0); setCIRCLER (0, 1, 0, 50, 180); /* lay around right hand end */ GO (1, 0); setVECTORR (2, 0, -100.0, 1, 0.0); /* lay along top edge */ GO (1, 0); setCIRCLER (0, 1, 0, -50, 180); /* lay around left hand end */ GO (1, 0);

do { getIDLE (0, &isidle); } while (!isidle); setOUTx (3, False); /* back at start, turn glue off */ CONTOFF (0); /* no more contouring required */}

See Also:

CONTON

Page 108: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 108

CONTONPC BX Scaled Default Range❏ ❏ - off -

Prototype:__int16 CONTON (__uint8 axisNo)

Description:Turns contouring on, for the specified axis. When contouring is on successive moves willbe merged together without ramping down to zero speed before the next move is started. Inmulti-axis moves (CIRCLER, VECTORA etc.) contour control is only significant on themaster axis. Requirements for constant path speed and high positional accuracy oftenconflict. PathMode may be used to specify the way in which the path is controlled.

Contouring affects the following move types:

mdLINEARmdCIRCULAR

The MoveBufferStatus function can read if a move in the buffer is contoured or not.Moves with specified slew speeds can be loaded into the buffer when used in conjunctionwith the Feedrate function.

Parameters:axisNo specifies the axis on which contouring is to be turned on.

0 <= axisNo < MAX_AXES.

Restrictions:Contour control does not affect moves that have already been loaded.

Default:By default contouring is turned off.

Example:/*----------------------------------------------------------------------*//* An x-y gantry is used to dispense glue around a simple gasket. The *//* gasket is oblong with semi-circular ends. The glue is laid at a *//* constant speed of 100 mm/s. *//*----------------------------------------------------------------------*/void layBead (void){ __uint8 isidle;

Page 109: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 109

setSPEED (0, 100); /* set lay speed of 100 mm/s */ CONTON (0); /* turn contouring on */ setOUTx (3, True); /* turn on the glue nozzle */ setVECTORR (2, 0, 100.0, 1, 0.0); /* lay along bottom edge */ GO (1, 0); setCIRCLER (0, 1, 0, 50, 180); /* lay around right hand end */ GO (1, 0); setVECTORR (2, 0, -100.0, 1, 0.0); /* lay along top edge */ GO (1, 0); setCIRCLER (0, 1, 0, -50, 180); /* lay around left hand end */ GO (1, 0);

do { getIDLE (0, &isidle); } while (!isidle);

setOUTx (3, False); /* back at start, turn glue off */ CONTOFF (0); /* no more contouring required */}

See Also:

ACCEL, CIRCLEA, CIRCLER, CONTOFF, DECEL, GO, PathMode, RAMP, SPEED,VECTORR, VECTORR

CURRLIMITPC BX Scaled Default Range❏ ❏ - 100 0 - 100

Prototype:__int16 getCURRLIMIT (__uint8 channel, float *percentage)__int16 setCURRLIMIT (__uint8 channel, float percentage)

Description:Sets or returns the percentage of the maximum DAC output voltage that may appear on theDAC channel. Each DAC output channel has a range of ±10V. CURRLIMIT can be usedto clip the range to a percentage of ±10V. The functions refer to current limit because servoamplifiers often operate in torque mode where the DAC output acts as a current demand.

Parameters:channel specifies the DAC on which the output limit is to be set or returned.

0 <= channel < MAX_AXES

percentage specifies the value to which the output is clipped.

0 <= percentage <= 100

Page 110: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 110

Restrictions:None. Current limit may be set or returned at any time.

Default:The default value is 100%.

Example:/*----------------------------------------------------------------------*//* Set the maximum output voltage of DAC channel #0 to 5v. *//*----------------------------------------------------------------------*/setCURRLIMIT (0, 50); /* 5v is 50% of 10v */

See Also:

DAC, DEMAND, KINTRANGE

Page 111: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 111

DACPC BX Scaled Default Range❏ ❏ - - -2047 to 2047 PC

-8191 to 8181 BX

Prototype:__int16 getDAC (__uint8 channel, __int16 *binaryValue)__int16 setDAC (__uint8 channel, __int16 binaryValue)

Description:Sets or returns the value of a DAC output channel in binary form. There are four 12-bitDACs on NextMove PC and four 14 bit DACs on NextMove BX, each of which have arange of ±10v. These are normally used as the servo demand outputs and the user does notnormally have direct control over them.

NextMove BX defaults to 12 bit emulation but may be set to true 14 bit mode with theDACMode function.

Parameters:channel specifies the DAC output on which the value is to be set or returned.

0 <= channel < MAX_DACS

binaryValue specifies the voltage on the DAC as a binary value (rather than a voltage).

-2047 <= binaryValue <= 2047-2047 ≡ -10v0 ≡ 0v2047 ≡ 10v

For NextMove BX in 14 bit mode:

-8191 <= binaryValue <= 8191-8191 ≡ -10v0 ≡ 0v8191 ≡ 10v

Restrictions:setDAC may only be called if the axis channel is NOT configured as cfSERVO and there isa DAC channel present on the specified axis.

Page 112: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 112

Default:The DACs are zeroed on power up or reset.

Example:/*----------------------------------------------------------------------*//* Apply a voltage of 2.5v to DAC output #0. *//*----------------------------------------------------------------------*/setCONFIG (0, cfOFF); /* turn the axis off to allow access to dac */setDAC (0, 512); /* apply output 2047 / 4 = 512 */

See Also:

ANALOGUE, CONFIG, DACMode, DEMAND, DriveType

DACModePC BX Scaled Default Range

❏ - 0 0 - 1

Prototype:__int16 getDACMode (__uint8 channel, __uint8 *mode)__int16 setDACMode (__uint8 channel, __uint8 mode)

Description:NextMove BX has four 14 bit DAC outputs, normally used for controlling axes. The binaryrange is ±8191 counts giving ±10v. A motors tuning parameters derived on NextMove PCwould be different to the parameters on NextMove BX due to the larger binary count on theDAC (±2047 on PC). The DACMode function allows 12 bit emulation, removing the needto retune motor parameters.

The DACMode effects all modes using the DAC channel, servo demand output, TORQUEoutput and direct control with the DAC function.

14 bit mode gives a greater resolution and therefore allows for finer motor control.

Parameters:channel specifies the DAC output on which the mode is to be set or returned.

0 <= channel < MAX_DACS

mode specifies 12 or 14 bit mode.

mode = 0 12 bit emulation modemode = 1 14 bit mode

Page 113: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 113

Restrictions:None.

Default:The default is 12 bit emulation mode.

Example:/*----------------------------------------------------------------------*//* Use the full 14 bit DAC range on axis 0 *//*----------------------------------------------------------------------*/setDACMode (0, 1);

See Also:

ANALOGUE, CONFIG, DAC, DEMAND

DACMonitorAxisPC BX Scaled Default Range❏ ❏ 0 - 7 PC

0 - 3 BX

Prototype:__int16 getDACMonitorAxis (__uint8 channel, __uint8 *axisNo);__int16 setDACMonitorAxis (__uint8 channel, __uint8 axisNo);

Description:Certain system parameters, such as axis velocity, can be monitored externally by outputtingthe value through a DAC channel. This can be useful for tuning and debugging purposes.The DACMonitorAxis function specifies which axis is to be used for monitoring throughthe DAC channel.

Any axis can be monitored and multiple axis parameters can be monitored through the useof multiple DAC channels.

The DAC channels on a NextMove expansion board can be used if one is present.

Parameters:channel specifies the DAC output on which the mode is to be set or returned.

0 <= channel < MAX_DACS

axisNo specifies the axis to monitor.

0 <= axisNo < MAX_AXES

Page 114: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 114

Restrictions:There are 4 DAC channels on NextMove BX and NextMove PC. If there is a expansionfitted, this value may increase to 8 DAC channels.

Default:The default is for the axis number to be equal to the channel number.

Example:/*----------------------------------------------------------------------*//* Monitor velocity of axis 2 on DAC channel 3 *//*----------------------------------------------------------------------*/setDACMonitorAxis (3, 2);setDACMonitorMode (3, dmMEASURED_VELOCITY);

See Also:

DAC, DACMonitorGain, DACMonitorMode

DACMonitorGainPC BX Scaled Default Range❏ ❏ - 1.0 0.0 - 8388607.0

Prototype:__int16 getDACMonitorGain (__uint8 channel, float *gain);__int16 setDACMonitorGain (__uint8 channel, float gain);

Description:When using DAC monitoring, the parameter being monitored is just sent to the DACchannel. If the value is small, for example, less than 10, this equates to a voltage in theorder of 0.05V. The DACMonitorGain allows the value to be scaled to produce a largervoltage output.

Parameters:channel specifies the DAC output on which the mode is to be set or returned.

0 <= channel < MAX_DACS.

gain specifies the gain term.

0.0 <= gain < MAX_FLOAT

Restrictions:None.

Page 115: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 115

Default:The default gain is 1.0.

Example:/*----------------------------------------------------------------------*//* Monitor spaces in the move buffer. Each space will be represented *//* by 0.5V *//*----------------------------------------------------------------------*/setDACMonitorAxis (3, 0);setDACMonitorMode (3, dmFREE_SPACES);setDACMonitorGain (3, 100.0);

See Also:

DAC, DACMonitorAxis, DACMonitorMode

DACMonitorModePC BX Scaled Default Range❏ ❏ 0 0 - 5

Prototype:__int16 getDACMonitorMode (__uint8 channel, __uint8 *mode);__int16 setDACMonitorMode (__uint8 channel, __uint8 mode);

Description:Certain system parameters, can be monitored externally by outputting the value through aDAC channel. The DACMonitorAxis function specifies which axis is to be used formonitoring through the DAC channel. The DACMonitorGain function can be used to scalethe size of the output voltage.

The DAC can output values in the range +/- 2047 which equates to +/- 10V. This range canbe extended to +/- 8181 on NextMove BX with the DACMode function.

Any axis can be monitored and multiple axis parameters can be monitored through the useof multiple DAC channels. Note that this function is channel dependant and not axisdependant. The DAC channels on a NextMove expansion board can be used if one ispresent.

The axis owning the DAC channel to be used for monitoring must be configured as off.

Whilst DAC monitoring is turned on, a DAC value set with the DAC function will beoverwritten.

Page 116: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 116

Parameters:channel specifies the DAC output on which the mode is to be set or returned.

0 <= channel < MAX_DACS

mode specifies what is monitored.

Mode Constant Meaning

0 dmOFF Turns DAC monitoring off1 dmMEASURED_VELOCITY The axis measured velocity is output in

counts / second2 dmDEMAND_VELOCITY The axis demand velocity is output in

counts / second3 dmFOLLOWING_ERROR The axis following error is output in

counts4 dmFREE_SPACES The free spaces in the axis move buffer

is output5 dmDAC_DEMAND The DAC demand signal of the monitor

axis is output.

Restrictions:NextMove BX uses a 14 bit which has a of Ä8191 counts. In the example above, a DACvoltage of -5V equates to -4095 DAC counts. With a gain of 10 this would indicate avelocity of 409.5 counts / second.

Default:The default mode is dmOFF.

Example:/*----------------------------------------------------------------------*//* Monitor following of axis 5 on channel 0. Scale output by 10 *//*----------------------------------------------------------------------*/setCONFIG (0, cfOFF); /* Turn axis 0 off so its DAC can be used */setDACMonitorAxis (0, 5);setDACMonitorGain (0, 10.0);setDACMonitorMode (0, dmFOLLOWING_ERROR);

See Also:

DAC, DACMonitorAxis, DACMonitorGain

Page 117: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 117

DECELPC BX Scaled Default Range❏ ❏ ❏ 300000 servo

3000 stepper0.0 - 8388607.0

Prototype:__int16 getDECEL (__uint8 axisNo, float *deceleration)__int16 setDECEL (__uint8 axisNo, float deceleration)

Description:Sets or returns the desired deceleration rate for the specified axis in user units / second2.Moves may have different acceleration and deceleration ramps. The acceleration rate is setby calling ACCEL. If the axis is the master axis in an interpolated move, the rate will bethe deceleration rate along the resultant path. The deceleration rate used in the event ofpowered stops during error handling may be different from that normally used and is set bycalling ErrorDeceleration. The deceleration rate will be used for the following move types:

mdJOGmdHOMINGmdLINEARmdCIRCULARmdOFFSETmdFOLLOW (velocity following only)mdHTAmdINCREMENT

Parameters:axisNo specifies the axis upon which the deceleration is to be set or read.

0 <= axisNo < MAX_AXES.

deceleration is the deceleration rate in user units / sec2.

0 < deceleration <= MAX_FLOAT.

Restrictions:None. The deceleration rate may be changed or read at any time.

Default:Servo axes: 300,000 encoder edges / sec2

Stepper axes: 3,000 steps / sec2

Page 118: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 118

Example:/*----------------------------------------------------------------------*//* Define a function that will set equal acceleration and deceleration *//* ramps on a specified axis. *//*----------------------------------------------------------------------*/void setEqualRamps (__uint8 axisNo, float ramp){ setACCEL (axisNo, ramp); /* set the acceleration rate */ setDECEL (axisNo, ramp); /* set the deceleration rate equal */}

See Also:

ACCEL, CIRCLEA, CIRCLER, JOG, MOVEA, MOVER, RAMP, SCALE, SPEED,VECTORA, VECTORR

DEFAULTPC BX Scaled Default Range❏ ❏ ❏

Prototype:__int16 DEFAULT (__uint8 axisNo)

Description:Sets the motion variables for the specified axis to the default values for the axis type.

Parameters:axisNo specifies the axis whose variables should be reset.

0 <= axisNo < MAX_AXES.

Restrictions:DEFAULT should only be called when the axis is idle.

Default:The default values of the motion variables affected are:

Motion Variable Servo Axis Stepper Axis

ACCEL 300,000 3,000BACKOFF 10 10

CURRLIMIT 100 n/aDECEL 300,000 3,000

DerivativeGain 0 n/a

Page 119: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 119

Motion Variable Servo Axis Stepper Axis

ErrorDeceleration 300,000 3,000FeedrateMode frSPEED frSPEED

FeedrateOverride 100 100GAIN 0 n/a

HMSPEED 40,000 500IDLE 16,000 16,000KINT 0 n/a

KINTRANGE 100 n/aKVEL 0 n/a

KVELFF 0 n/aMFOLERR 16,000 n/a

RAMP 0 0SCALE 1 1SPEED 40,000 1,000

Stepper parameters are not applicable to NextMove BX.

Example:/*----------------------------------------------------------------------*//* Set all axes to their default values. *//*----------------------------------------------------------------------*/void setDefaults (void){ __uint16 ax;

for (ax=0; ax<cnMAX_AXES; ax++) { isidle = 0; while (!isidle) { getIDLE (ax, &isidle); /* wait for axis to become idle */ } DEFAULT (ax); /* set default values */ }}

See Also:

CANCEL, CONFIG, DISLIMIT, RESET

Page 120: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 120

DEMANDPC BX Scaled Default Range❏ ❏ - 0 -100 - 100

Prototype:__int16 getDEMAND (__uint8 channel, float* percentage)

Description:Returns the voltage output of the DAC channel as a percentage of the full scale outputvoltage.

Parameters:channel specifies the DAC output whose value should be returned.

0 <= channel < MAX_AXES

percentage is the current percentage voltage on DAC channel.

Restrictions:None. DEMAND may be called at any time.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Enter torque mode on axis #1 then read the demand back. *//*----------------------------------------------------------------------*/setTORQUE (1, 50); /* Set DAC output to 50% full scale */getDEMAND (1, &percentage);demand = percentage; /* demand has value of 50.0 */

See Also:

CURRLIMIT, DAC, TORQUE

DerivativeGainPC BX Scaled Default Range❏ ❏ - 0 0 - 10000

Prototype:__int16 getDerivativeGain (__uint8 axisNo, float *derivativeGain)__int16 setDerivativeGain (__uint8 axisNo, float derivativeGain)

Page 121: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 121

Description:Sets or returns the derivative gain on the specified servo axis.

Parameters:axisNo specifies the axis on which the derivative gain is to be set or returned.

0 <= axisNo < MAX_AXES.

derivativeGain is the servo loop derivative gain applied to the axis.

0 <= derivativeGain < 10000

Restrictions:Derivative gain may be changed at any time but is only applicable to axes configured ascfSERVO.

Default:After power up or a board reset, derivative gain is set to zero.

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. *//*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis){ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */ setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enabledrive (axis); /* now enable the drive again */}

See Also:

GAIN, KINT, KINTRANGE, KVEL, KVELFF

disableDrivePC BX Scaled Default Range❏ ❏ 0 0 - 1

Prototype:__int16 disableDrive (__uint8 axisNo)

Page 122: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 122

Description:Disables the external drive associated with the axis. If an enable output has been specifiedfor the axis, using EnableOutput, the output is driven inactive.

Parameters:axisNo specifies the axis on which the drive is to be disabled.

0 <= axisNo < MAX_AXES.

Restrictions:None. The drive can automatically be disabled by default action as a result of anasynchronous error on the axis.

Default:By default all outputs are inactive, configured active high. The active level can beconfigured with the ACTIVEOUTLEVEL function.

Example:/*----------------------------------------------------------------------*//* Allow a servo axis to be moved manually until a button is pressed. *//*----------------------------------------------------------------------*/setTORQUE (0); /* set DAC output to be zero */disableDrive (0); /* disable the velocity drive */state = 0;while (!state) { /* wait for the button to be pressed */ getINx (3, &state);}enableDrive (0); /* re-enable the drive */RESET (0); /* servo at the new position */

See Also:

EnableOutput, ENABLE, enableDrive

DISLIMITPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 DISLIMIT (__uint8 axisNo)

Page 123: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 123

Description:Asynchronous limit errors, both hardware limits and software limits can be disabled by acall to DISLIMIT. This has the effect of setting the default action mode inHardwareLimitMode and SoftwareLimitMode to ignore any errors. Changes the mode tosomething other than ignore will re-enable the generation of limit errors. A call toENLIMIT will set the mode to the last mode set by calls to HardwareLimitMode andSoftwareLimitMode. See chapter 3.5 for full details on errors and error handling.

Parameters:axisNo specifies the axis on which limit errors are to be suppressed.

0 <= axisNo < MAX_AXES.

Restrictions:None.

Default:By default, hardware and software limit generation is enabled.

Example:/*----------------------------------------------------------------------*//* Allow a servo to be moved manually off a limit until a button pressed*//*----------------------------------------------------------------------*/DISLIMIT (0); /* disable the limit and cancel error if any */setTORQUE (0); /* set DAC to zero */disableDrive (0); /* disable the velocity drive */while (!state) { /* wait for the button to be pressed */ getINx (3, &state);}enableDrive (0); /* re-enable the drive */RESET (0); /* servo at the new position */ENLIMIT (0); /* re-enable limit checking. */

See Also:

AsyncError, ENLIMIT, Error, ErrorMask, ForwardLimitSwitchInput,ForwardSoftwareLimit, LIMITF, LIMITR, ReverseLimitSwitchInput,ReverseSoftwareLimit

Page 124: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 124

DriveTypePC BX Scaled Default Range❏ ❏ - - 0 - 7

Prototype:__int16 getDriveType (__uint8 axisNo, __uint32 type)

Description:Returns the possible axis configurations that are available based on the available hardware.The axis configurations are set with the CONFIG function. The types available arereturned as a bit pattern as follows:

Bit Symbolic Constant Description

0 dtSERVO Drive can be configured as cfSERVO1 dtSTEPPER Drive can be configured as cfSTEPPER2 dtPWM Drive can be configured as cfPWM

All axes can be configured as cfOFF.

Parameters:axisNo specifies the axis on which the available types are required.

0 <= axisNo < MAX_AXES

type is the bit pattern of hardware as detailed above.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Show information about each axis. *//*----------------------------------------------------------------------*/__int16 axis;__uint32 type;

for (axis = 0; axis < cnMAX_AXES; axis++) { getDriveType (axis, &type); message (axis, type);}

Page 125: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 125

See Also:

CONFIG, NumberOf

DualPortHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:TDualPortHandler* setDualPortHandler (TDualPortHandler* handler)

Description:Installs a user handler that will be called in response to a dual port RAM interrupt. A dualport RAM interrupt is generated when data is written into the PC interrupt Register from thehost. This location is typically used to signal that a message should be read from dual portRAM. The form and location of the data placed in dual port RAM is largely left to the usersdiscretion.

On receipt of a dual port RAM interrupt the NextMove will perform some defaultprocessing then chain to the user supplied routine.

Parameters:handler is the address of the user supplied function that will be called in response to a dualport RAM interrupt. TDualPortHandler is defined in the file MG.H as:

typedef void TDualPortHandler (__uint16 code)

code is the value that NextMove read from the PC interrupt Register.

Possible Errors:NextMove does not, and cannot, determine whether the address passed is valid.

Restrictions:This function is not available in Immediate Command Mode from the host. There is aMINT interface Library function installDPRHandler which services DPR interrupts fromNextMove PC to the host.

Default:By default there is no user supplied handler.

Example:/*-----------------------------------------------------------------------*//* NextMove program utilising DPR handler to perform motion */

Page 126: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 126

/*-----------------------------------------------------------------------*/#include "mg.h"

/*-----------------------------------------------------------------------*//* DPRHandler *//* *//* Function: *//* Installed by call to 'setDualPortHandler' this function will be *//* called by NextMove in response to a dual port RAM interrupt. *//* *//* Tests for code for setMOVER and CANCEL. *//* If received setMOVER calls setMOVER. On third call system will hang *//* because the move buffer is full. *//* If CANCEL received the global breakLoop is set true. When the idle *//* handler is next called the loop that has hung will be broken. *//* *//* Argument List: *//* code - the interrupting value. *//* Return Value: *//* None. *//*-----------------------------------------------------------------------*/void DPRHandler (__uint16 code){ __uint8 axis; float distance;

/*---------------------------------------------------------------------*/ /* Test command code passed in dual port RAM. */ /*---------------------------------------------------------------------*/ switch (code) { case _setMOVER : axis = getWord (0, roFRONT_START); distance = getFloat (0, roFRONT_START+1); putWord (0, roFRONT_START, setMOVER (axis, distance)); break;

case _CANCEL : axis = getWord (0, roFRONT_START); breakLoop = 1; break;

case _RESET : axis = getWord (0, roFRONT_START); putWord (0, roFRONT_START, RESET (axis)); break; }}

/*-----------------------------------------------------------------------*//* main *//* *//* Function: *//* PC : Downloads 'idhndler.out' which demonstrates the use of an idle *//* handler on NextMove. *//* Calls setMOVER 3 times. Expect hang on 3rd call. Allow user *//* to break hang by pressing Esc. *//* NM : Installs a DPR interrupt handler. Traps codes for setMOVER and *//* CANCEL. */

Page 127: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 127

/* *//* Argument List: *//* None. *//* *//* Return Value: *//* 0 *//*-----------------------------------------------------------------------*/__int16 main (void){ /*---------------------------------------------------------------------*/ /* Get NextMove Generator going. */ /*---------------------------------------------------------------------*/ if (initialiseNextMove () == FAIL) { while (1); } /*---------------------------------------------------------------------*/ /* Install a dual port RAM handler. This will get called in the event */ /* of a dual port RAM interrupt. */ /*---------------------------------------------------------------------*/ setDualPortHandler (DPRHandler); /*---------------------------------------------------------------------*/ /* Signal the host that an application is running. */ /*---------------------------------------------------------------------*/ putWord (0, roAPPLICATION_CODE, 0x100); /*---------------------------------------------------------------------*/ /* Now simply wait for dual port RAM interrupts. */ /*---------------------------------------------------------------------*/ while (1); return 0;}

See Also:

ErrorHandler, FastposHandler, IdleHandler, StopSwitchHandler,UserInterruptHandler

Page 128: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 128

ENABLEPC BX Scaled Default Range❏ ❏ 0 - 1

Prototype:__int16 ENABLE (__uint8 state)

Description:Provides direct control over the enable relay output. Each axis may be configured to haveits own drive enable output selected from the user digital outputs by calling EnableOutput.After default error processing the relay output may be turned off. This output may thereforebe used as a general purpose error signal or global system enable for all drives. If the relayoutput is turned off by default error handling it is the users responsibility to reset it to asuitable state. A call to RESET will also energise the relay.

An axis must have its drive enabled before a move can be loaded. If the axis does not havean enable output assigned for it, then the relay must be energised in order to load a move.

Parameters:state describes the desired state of the relay output.

0 - the relay should be turned off (contacts opened).1 - the relay should be energized (contacts closed).

Restrictions:The relay may be controlled at any time. Default action error handling can turn the outputoff.

Default:By default the relay is turned off.

Example:/*----------------------------------------------------------------------*//* Allow a servo axis to be moved manually off a limit until a button *//* pressed. The axis is enabled via the relay output. *//*----------------------------------------------------------------------*/setTORQUE (0); /* set DAC to zero */ENABLE (0); /* disable the velocity drive */while (!state) { /* wait for the button to be pressed */ getINx (3, &state);}ENABLE (1); /* re-enable the drive */RESET (0); /* servo at the new position */

Page 129: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 129

See Also:

disableDrive, enableDrive, EnableOutput, RESET

enableDrivePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 enableDrive (__uint8 axisNo)

Description:Enables the external drive associated with the specified axis. If an enable output has beenspecified for the axis, using EnableOutput, the output is driven active. A call to RESETwill also enable the drive enable channel.

An axis must have its drive enabled before a move can be loaded. If the axis has an enableoutput assigned for it, then it must be activated in order to load a move.

Parameters:axisNo specifies the axis on which the drive is to be enabled.

0 <= axisNo < MAX_AXES.

Restrictions:None.

Default:By default all outputs are inactive, configured active high.

Example:/*----------------------------------------------------------------------*//* Allow a servo axis to be moved manually off a limit until a button *//* pressed. *//*----------------------------------------------------------------------*/DISLIMIT (0); /* disable the limit and cancel error if any */setTORQUE (0); /* set DAC to zero */disableDrive (0); /* disable the velocity drive */while (!state) { /* wait for the button to be pressed */ getINx (3, &state);}enableDrive (0); /* re-enable the drive */RESET (0); /* servo at the new position */ENLIMIT (0); /* re-enable limit checking. */

Page 130: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 130

See Also:

disableDrive, EnableOutput, ENABLE, RESET

EnableOutputPC BX Scaled Default Range❏ ❏ - - 0 - 11 PC

0 - 7 BX

Prototype:__int16 getEnableOutput (__uint8 axisNo, __int16 *outputChannel)__int16 setEnableOutput (__uint8 axisNo, __int16 outputChannel)

Description:Sets or returns the user digital output channel configured to be the drive enable output forthe axis. Each axis may have its own drive enable, may share the same output with anynumber of other axes or may not have an enable at all.

Parameters:axisNo specifies the axis on which the enable output is to be set or returned.

0 <= axisNo < MAX_AXES.

outputChannel specifies the user output used as the axis drive enable.

-2 <= outputChannel < MAX_OUTPUTS

-1 : the axis uses the relay as its drive enable output.

-2 : the axis has no drive enable output.

Restrictions:None.

Default:By default, there are no assigned enable outputs.

Example:/*----------------------------------------------------------------------*//* Reconfigure all stepper axes to share the same enable output. Servo *//* axes have none (they will use the relay output) *//*----------------------------------------------------------------------*/void configureEnables (void){ __uint8 ax;

Page 131: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 131

for (ax=0; ax < 4; ax++) setEnableOutput (ax, -1); for (; ax<cnMAX_AXES; ax++) setEnableOutput (ax, 3);}

See Also:

disableDrive, ENABLE, enableDrive

EncoderPC BX Scaled Default Range❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getEncoder (__uint8 axisNo, float *encoder)__int16 setEncoder (__uint8 axisNo, float encoder)

Description:Axis position is normally read with the POS function. The Encoder function allows an axisencoder value to be read directly, independent of the axis position. If the axis POS is zeroedor set to a value, this does not affect the Encoder position and vice-versa.

The ability to have direct access to the encoder is useful in a number of situations. If axisposition is changed during a program by writing to the POS function, the encoder value willbe unchanged. If the axis is configured as cfOFF, then position is not generated and cannotbe read.

If a NextMove expansion board is attached, such that a eight axis stepper system is beingused, the Encoder function allows the encoders to be accessed.

The encoder value is zeroed on power up and can only be manually zeroed or changed. Theencoder position can have a scale factor separate to the axis scale factor and positionwrapping can be set up.

The Encoder value be scaled using the EncoderScale value. Velocity may be read with theEncoderVel function.

Parameters:axisNo is the axis encoder to be read or written to.

0 <= axisNo <= MAX_AXES.

encoder is the absolute position of the encoder in user units.

MIN_FLOAT <= encoder <= MAX_FLOAT.

Page 132: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 132

Restrictions:Not applicable to stepper axes.

Default:After power up or board reset, the absolute position is set to zero.

Example:/*----------------------------------------------------------------------*//* Zero the encoder after datum on axis 1 *//*----------------------------------------------------------------------*/__uint8 isidle;

setHOME (1, hmNEGATIVE_SWITCH_INDEX); /* start homing sequence */

isidle = 0;while (!isidle){ getIDLE (1, &isidle); /* wait for sequence to finish */}

setEncoder (1, 0.0); /* set new encoder position */

See Also:

AuxEncoder, EncoderScale, EncoderVel, EncoderWrap, FastEncoder

EncoderScalePC BX Scaled Default Range❏ ❏ - 0 - 8388607.0

Prototype:__int16 getEncoderScale (__uint8 axisNo, float *scale)__int16 setEncoderScale (__uint8 axisNo, float scale)

Description:Axis position is normally read with the POS function. The Encoder function allows an axisencoder value to be read directly, independent of the axis position. The EncoderScalefunction allows a scale factor to be set that relates the number of counts to user units. Thevalue returned by the Encoder function will be in user units.

The SCALE function relates counts to user units for the axis position as read with the POSfunction. This is independent of the EncoderScale function.

Parameters:axisNo is the axis encoder to be read or written to.

Page 133: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 133

0 <= axisNo <= MAX_AXES.

scale specifies the number of encoder edges or steps per user unit.

MIN_FLOAT <= scale <= MAX_FLOAT.

Restrictions:None.

Default:The default scale factor is 1.

Example:/*----------------------------------------------------------------------*//* An encoder has 1024 lines. This gives 4096 counts per revolution *//* with quadrature. The encoder is mounted on a conveyer where 2.5 *//* revolutions is 1 inch or travel *//*----------------------------------------------------------------------*/setEncoderScale (10240.0); /* set user units to inches */

See Also:

AuxEncoder, Encoder, EncoderVel, EncoderWrap

EncoderVelPC BX Scaled Default Range❏ ❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getEncoderVel (__uint8 axisNo, float *velocity)

Description:The EncoderVel function allows the encoder velocity to be read directly from the encoder.Encoder position can be read with the Encoder function. The velocity read is in user unitsas scaled with the EncoderScale function.

Parameters:axisNo is the axis encoder to be read or written to.

0 <= axisNo <= MAX_AXES.

velocity is the velocity in user units.

MIN_FLOAT <= velocity <= MAX_FLOAT.

Page 134: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 134

Restrictions:None. Due to quantisation errors typical of any sampled system the value returned byEncoderVel is inaccurate at low speeds. The velocity is the change in position measuredduring the last sampling period expressed in user units. The minimum value, other thanzero, that can be returned equates to an encoder edge frequency of 500Hz. eg: if youprogram in revs and there are 2,000 edges per rev. the minimum non-zero velocity will be+/- 15 rpm.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Wait until the encoder velocity exceeds 2000 rpm and then turn output*//* 5 on. *//*----------------------------------------------------------------------*/float vel;

do { getEncoderVel (3, &vel);} while (vel < 33.3);

setOUTx (5, 1);

See Also:

AuxEncoder, Encoder, EncoderScale, EncoderWrap

EncoderWrapPC BX Scaled Default Range❏ ❏ ❏ - 0 - 8388607.0

Prototype:__int16 getAuxEncoderWrap (__uint8 axisNo, float *wrap)__int16 setAuxEncoderWrap (__uint8 axisNo, float wrap)

Description:Normally, the position of the encoder, as read with the Encoder function, is within the fullrange of +/- 8388607.0 counts. In a rotary system, for example, it may be desirable to haveencoder position within a certain range. The EncoderWrap function allows a wrap value tobe set such that the position read with the Encoder function is allows between zero and thespecified wrap value.

To turn encoder wrap off, a wrap value of 0.0 is given. This returns the position to its fullpossible range.

Page 135: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 135

Parameters:axisNo is the axis encoder to be read or written to.

0 <= axisNo <= MAX_AXES.

wrap is the absolute position of the encoder in user units that the position will wrap at

0 <= wrap <= MAX_FLOAT.

Restrictions:None.

Default:After power up or board reset, the position wrapping is turned off.

Example:/*----------------------------------------------------------------------*//* Read encoder 3 in degrees within one revolution. The encoder has *//* 1024 lines, 4096 counts per revolution with quadrature. The Encoder *//* function will return a value between 0 and 360. *//*----------------------------------------------------------------------*/float position;

setEncoderScale (3, 11.378); /* set user units to revs s */setEncoderWrap (3, 360.0); /* Position wrap at 3600 */

while (running){ getEncoder (&position); /* 0 <= encoder value < 360 */}

See Also:

AuxEncoder, Encoder, EncoderScale, EncoderVel

ENLIMITPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 ENLIMIT (__uint8 axisNo)

Page 136: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 136

Description:Asynchronous limit errors, both hardware limits and software limits can be disabled by acall to DISLIMIT. This has the effect of setting the default action mode inHardwareLimitMode and SoftwareLimitMode to ignore any errors. Changes the mode tosomething other than ignore will re-enable the generation of limit errors. A call toENLIMIT will set the mode to the last mode set by calls to HardwareLimitMode andSoftwareLimitMode. See chapter 3.5 for full details on errors and error handling.

Parameters:axisNo specifies the axis on which limit errors are to be enabled.

0 <= axisNo < MAX_AXES.

Restrictions:None.

Default:By default, hardware and software limit generation is enabled.

Example:/*----------------------------------------------------------------------*//* Allow a servo axis to be moved manually off a limit until a button *//* pressed. *//*----------------------------------------------------------------------*/DISLIMIT (0); /* disable the limit and cancel error if any */setTORQUE (0); /* set DAC to zero */disableDrive (0); /* disable the velocity drive */while (!state) { /* wait for the button to be pressed */ getINx (3, &state);}enableDrive (0); /* re-enable the drive */RESET (0); /* servo at the new position */ENLIMIT (0); /* re-enable limit checking. */

See Also:

DISLIMIT, ForwardLimitSwitchInput, ForwardSoftwareLimit,HardwareLimitMode, ReverseLimitSwitchInput, ReverseSoftwareLimit,SoftwareLimitMode

Page 137: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 137

ERRORPC BX Scaled Default Range❏ ❏ - 0 0 - 3263

Prototype:__int16 getERROR (__uint8 axisNo, __int32* error)

Description:Asynchronous errors are reported in the asynchronous error structure. ERROR provides aquick method of accessing axis errors from that structure. A bit map is returned showingwhich errors are active. The possible errors are shown below. Axis errors can be cleared bywriting directly to the error structure with AsyncError or by calling CANCEL or RESET.Software limit errors, hardware limit errors and following errors can also be cleared bysetting the default action mode to ignore.

See chapter 3.5 for full details on errors and error handling.

Parameters:axisNo specifies the axis on which the error status is to be interrogated.

0 <= axisNo < MAX_AXES.

error is returned as a bit map with bits set indicating that the condition exists. The bit mapis as follows:

Bit Error Condition Meaning

0 erABORT Motion aborted1 erFWD_HARD_LIMIT Forward hardware limit hit2 erREV_HARD_LIMIT Reverse hardware limit hit3 erFWD_SOFT_LIMIT Forward software limit exceeded4 erREV_SOFT_LIMIT Reverse software limit exceeded5 erFOLLOWING_ERROR Following error limit exceeded6 Reserved7 erERROR_INPUT External error input active8 Reserved9 Reserved

10 erADC_ERROR Analog value limit exceeded11 erSLAVE_SYNC_ERROR Master/slave syncronisation error

Restrictions:None.

Page 138: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 138

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Error handler called by asynchronous errors. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ __int16 ax; __int32 errCode;

for (ax=0;ax<cnMAX_AXES;ax++) { errCode=0; getERROR (ax, &errCode); if (errCode) { /*----------------------------------------------------------------*/ /* Error on axis ax. Read bit map and take appropriate action */ /*----------------------------------------------------------------*/ } }}

See Also:

AsyncError, AxisStatus, CANCEL, ErrorHandler, ErrorMask, RESET, SystemError

ErrorDecelerationPC BX Scaled Default Range❏ ❏ ❏ 300000 servo

3000 stepper0.0 - 8388607.0

Prototype:__int16 getErrorDeceleration (__uint8 axisNo, float *errorDeceleration)__int16 setErrorDeceleration (__uint8 axisNo, float errorDeceleration)

Description:Sets or returns the desired deceleration rate for the axis; to be used during powered stops inthe event of an asynchronous error. If the axis is the master axis in an interpolated moveErrorDeceleration will be the deceleration rate along the resultant path.

The specification of a different deceleration rate to be used under error conditions allowsaxes to be brought to a controlled stop at a rate that is independent of that used during anormal machine cycle. ErrorDeceleration would typically be set to the maximum valuethat an axis could achieve.

Error conditions that can cause error deceleration to be used (default action modepermitting) are:

Page 139: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 139

erFWD_HARD_LIMITerREV_HARD_LIMITerFWD_SOFT_LIMITerREV_SOFT_LIMIT

The stop switch input can also cause error deceleration to be used.

Parameters:axisNo specifies the axis upon which the error deceleration is to be set or read.

0 <= axisNo < MAX_AXES.

errorDeceleration is the deceleration rate in user units / sec2.

0 < errorDeceleration <= MAX_FLOAT

Restrictions:None. The deceleration rate may be changed or read at any time.

Default:Servo axes: 300,000 encoder edges / sec2

Stepper axes: 3,000 steps / sec2

Example:/*----------------------------------------------------------------------*//* Set the ramp rates on axis #0. The scale factor has previously been *//* set for millimetres. *//*----------------------------------------------------------------------*/setACCEL (0, 1000); /* set cycle acceleration to 1 m/s2 */setDECEL (0, 1000); /* set cycle deceleration to 1 m/s2 */setErrorDeceleration (0, 10000); /* set error deceleration to 10 m/s2 */

See Also:

ACCEL, AsyncError, DECEL, ERROR, ErrorMask, HardwareLimitMode,SoftwareLimitMode, StopSwitchMode

ErrorHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setErrorHandler (TErrorHandler *handler)

Page 140: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 140

Description:Installs a user handler that will be called in response to an asynchronous error condition.The user supplied handler is called prior to any default error handling and it is therefore theusers responsibility to ensure that errors are handled quickly and safely. When the userhandler returns, any remaining errors will be handled by NextMove.

Parameters:handler is the address of the user supplied function that will be called in response to anerror. TErrorHandler is defined in the file MG.H as:

typedef void TErrorHandler (void)

Possible Errors:NextMove does not, and cannot, determine whether the address passed is valid.

Restrictions:None.

Default:By default there is no user supplied handler.

Example:/*----------------------------------------------------------------------*//* User supplied error handler.If hardware limit then stop and home axis*//*----------------------------------------------------------------------*/void myErrorHandler (void){ __uint32 axisError;

getERROR (0, &axisError); if (axisError & erFWD_HARD_LIMIT || axisError & erREV_HARD_LIMIT) { DISLIMIT(0); STOP(0); do { getIDLE (0, &isidle); } while (!isidle); setHOME (0, hmPOSITIVE_INDEX); }}void main (void){ setErrorHandler (myErrorHandler); /* install the error handler */}

See Also:

AsyncError, DualPortHandler, FastposHandler, ERROR, ErrorMask,StopSwitchHandler, SystemError, UserInterruptHandler

Page 141: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 141

ErrorInputPC BX Scaled Default Range❏ ❏ - - 0 - 23 PC

0 - 15 BX

Prototype:__int16 getErrorInput (__uint8 axisNo, __int16 *inputChannel)__int16 setErrorInput (__uint8 axisNo, __int16 inputChannel)

Description:Sets or returns the user digital input configured to be the error input for the axis. Each axismay have its own error input, share an input with any number of other axes or have no errorinput. When the input becomes active, an asynchronous axis error will be generated and theuser supplied error handler will be called if it is defined and enabled (see ErrorMask). Ifthe error is not handled by the user, default action is to crash stop the axis involved andremove the drive enable and drop the relay.

Parameters:axisNo specifies the axis on which the error input channel is to be set or returned.

0 <= axisNo < MAX_AXES.

inputChannel specifies the user digital input used as the error input for axis axisNo.

-1 <= inputChannel < MAX_INPUTS

-1 : axisNo does not have an error input.

Restrictions:None.

Default:There is no default error input.

Example:/*----------------------------------------------------------------------*//* Define a new error input for axis #3. All other axes have none. *//*----------------------------------------------------------------------*/void configureErrorInputs (void){ __uint8 ax;

for (ax=0; ax<cnMAX_AXES; ax++) setErrorInput (ax, -1); setErrorInput (3, 3); /* specify new input for axis #3 */}

Page 142: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 142

See Also:

ActiveInputLevel, AsyncError, ERROR, ErrorMask, ErrorHandler,InputActiveMode

ErrorMaskPC BX Scaled Default Range❏ ❏ - - 0 - 3263

Prototype:__int16 getErrorMask (__uint8 axisNo, __uint32 *mask)__int16 setErrorMask (__uint8 axisNo, __uint32 mask)

Description:Sets or returns the current value of the axis error mask. Each axis has a status register,error register (part of the asynchronous error structure) and error mask. The status registerindicates the existence of off-normal conditions whether they constitute an error or not.Different error types have default mode functions which decide if these conditions shouldgenerate errors, e.g. SoftwareLimitMode. If an asynchronous axis error is generated, errormask controls which or these errors will call the user supplied error handler. Calling theuser error handler allows the user to handle an error before default action takes place. If theuser error handler is not called, default action will take place according the mode of thedefault action functions.

To call the user error handler, the appropriate bit must be set in the error mask. See chapter3.5 for full details on errors and error handling.

Parameters:axisNo specifies the axis on which the error mask is to be set or returned.

0 <= axisNo < MAX_AXES.

mask defines which asynchronous axis errors will call the user error handler. Setting a bitallows the error handler to be called. Clearing a bit indicates that default action will takeplace immediately. The bit pattern is as follows:

Bit Error Condition Meaning

0 erABORT Motion aborted1 erFWD_HARD_LIMIT Forward hardware limit hit2 erREV_HARD_LIMIT Reverse hardware limit hit3 erFWD_SOFT_LIMIT Forward software limit exceeded

Page 143: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 143

Bit Error Condition Meaning

4 erREV_SOFT_LIMIT Reverse software limit exceeded5 erFOLLOWING_ERROR Following error limit exceeded6 Reserved7 erERROR_INPUT External error input active8 Reserved9 Reserved

10 erADC_ERROR Analog value limit exceeded11 erSLAVE_SYNC_ERROR Master/slave syncronisation error

Restrictions:None.

Default:By default, all error conditions will call the user error handler, i.e. all bits are set.

Example:/*----------------------------------------------------------------------*//* Select to generate errors on ABORT, following error and hardware *//* limit errors on axis #2 only. *//*----------------------------------------------------------------------*/setErrorMask (2, erABORT + erFOLLOWING_ERROR + erFWD_HARD_LIMIT + erREV_HARD_LIMIT);

See Also:

AxisStatus, AsyncError, ERROR, ErrorHandler, FEMode, HardwareLimitMode,SoftwareLimitMode, SystemError

Page 144: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 144

FastAuxEncoderPC BX Scaled Default Range❏ ❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFastAuxEncoder (float *latchedValue)

Description:NextMove BX has an auxiliary encoder input and NextMove PC has one if a NextMoveexpansion board is attached. When the controller receives a fast interrupt, the auxiliaryencoder position is read and stored in the FastAuxEncoder function. Unlike theAuxEncoder function which is updated every 2 ms, the FastAuxEncoder value is theauxiliary encoder value read at the time of the fast interrupt. The maximum latency to readthe fast position is in the order of 30 micro-seconds.

If the user fast interrupt handler is defined, this will be called in response to the fastinterrupt. The fast interrupt will be latched on a pulse width of about 30 micro-seconds,although a width of 100 micro-seconds is recommended.

Due to the speed of the fast interrupt, it may be necessary to de-couple the input to avoidspurious calls to the fast interrupt handler.

Parameters:latchedValue is the latched value of the auxiliary encoder in user units.

MIN_FLOAT <= latchedValue < MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Install a FASTPOS interrupt handler. Read the latched value of the *//* auxiliary encoder. *//*----------------------------------------------------------------------*/void myFastposHandler (void){ fastposition = 0; getFastAuxEncoder (&fastposition);}void main (void){

Page 145: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 145

setFastposHandler (myFastposHandler); /* install the handler */}

See Also:

AuxEncoder, FastAuxEncoderX, FastEncoder, FASTPOS, FastposHandler, POS

FastAuxEncoderXPC BX Scaled Default Range

❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFastAuxEncoderX (__uint8 source, float *latchedValue)

Description:NextMove BX has an auxiliary encoder input. When NextMove BX receives an auxiliaryfast interrupt, the auxiliary encoder position is latched. The latched value for each of theauxiliary fast interrupts can be read with the FastAuxEncoderX function. The maximumlatency to latch the auxiliary encoder value on an auxiliary fast interrupt is 1ms.

If the user auxiliary fast interrupt handler is defined, this will be called in response to thefast interrupt.

There are three auxiliary fast interrupts. There are separate latches for each interrupt, so theinterrupt latch to read must be specified in the call.

Parameters:source specifies the auxiliary fast interrupt latch to read.

1 <= source <= 3

latchedValue is the latched value of the auxiliary encoder in user units.

MIN_FLOAT <= latchedValue < MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Install an auxiliary fast interrupt handler. Read the latched value *//* of the auxiliary encoder. *//*----------------------------------------------------------------------*/

Page 146: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 146

void myFastposHandlerX (__uint8 source){ fastposition = 0; getFastAuxEncoderX (source, &fastposition);}void main (void){ setFastposHandlerX (myFastposHandlerX); /* install the handler */}

See Also:

AuxEncoder, FastAuxEncoder, FastEncoderX, FastPosX, FastposHandlerX

FastEncoderPC BX Scaled Default Range❏ ❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFastEncoder (__uint8 axisNo, float *latchedValue)

Description:Axis position is normally read with the POS function. The Encoder function allows an axisencoder value to be read directly, independent of the axis position.

When the controller receives a fast interrupt, the encoder value is read and stored in theFastEncoder function. Unlike the encoder value which is updated every servo loop, theFastEncoder value is the axis encoder value read at the time of the fast interrupt. Themaximum latency to read the fast position is in the order of 30 micro-seconds.

If the user fast interrupt handler is defined, this will be called in response to the fastinterrupt. The fast interrupt will be latched on a pulse width of about 30 micro-seconds,although a width of 100 micro-seconds is recommended.

Due to the speed of the fast interrupt, it may be necessary to de-couple the input to avoidspurious calls to the fast interrupt handler.

The value returned by the FastEncoder function is dependent on the encoder scale factor.The positions of all encoders are latched.

Parameters:axisNo specifies the axis whose latched position is to be returned.

0 <= axisNo < MAX_AXES

latchedValue is the latched value of the auxiliary encoder in user units.

MIN_FLOAT <= latchedValue < MAX_FLOAT

Page 147: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 147

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* In the user fast interrupt handler, compare the latched values of *//* encoders 2 and 3 and calculate a correction. *//*----------------------------------------------------------------------*/void myFastposHandler (void){ float latchEncoder2; float latchEncoder3;

getFastEncoder (2, &latchEncoder2); getFastEncoder (3, &latchEncoder3); correction = (latchEncoder2 - latchEncoder3) * correctionFactor;}void main (void){ setFastposHandler (myFastposHandler); /* install the handler */}

See Also:

Encoder, FastAuxEncoder, FASTPOS, FastposHandler, POS

FastEncoderXPC BX Scaled Default Range

❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFastEncoderX (__uint8 source, __uint8 axisNo, float *latchedValue)

Description:When NextMove BX receives an auxiliary fast interrupt, all encoder values are latched. Thevalues for each interrupt can be read with the FastEncoderX function. The maximumlatency to latch the encoder values on an auxiliary fast interrupt is 1ms.

If the user auxiliary fast interrupt handler is defined, this will be called in response to thefast interrupt.

There are three auxiliary fast interrupts. There are separate latches for each interrupt, so theinterrupt latch to read must be specified in the call.

Page 148: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 148

Parameters:source specifies the auxiliary fast interrupt latch to read.

1 <= source <= 3

axisNo specifies the axis whose latched encoder value is to be returned.

0 <= axisNo < MAX_AXES

latchedValue is the latched value of the encoder.

MIN_FLOAT <= latchedValue < MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* In the auxiliary fast interrupt handler, compare the latched values *//* encoder 0 from latch 2 and 3 and calculate a correction. *//*----------------------------------------------------------------------*/void myFastposHandlerX (__uint8 source){ float encoderLatch2; float encoderLatch3;

getFastEncoderX (2, 0, &encoderLatch2); getFastEncoderX (3, 0, &encoderLatch3); correction = (encoderLatch2 - encoderLatch3) * correctionFactor;}void main (void){ setFastposHandlerX (myFastposHandlerX); /* install the handler */}

See Also:

Encoder, FastAuxEncoderX, FastEncoder, FastPosX, FastposHandlerX

FASTPOSPC BX Scaled Default Range❏ ❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFASTPOS (__uint8 axisNo, float *latchedPosition)

Page 149: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 149

Description:Returns the absolute position of axis axisNo recorded the last time that the FASTPOS inputwas active. When the FASTPOS input becomes active the axis positions are internallylatched. If a user defined FASTPOS handler has been installed this will be calledimmediately after the positions have been latched.

Parameters:axisNo specifies the axis whose latched position is to be returned.

0 <= axisNo < MAX_AXES

latchedValue is the latched value of the auxiliary encoder in user units.

MIN_FLOAT <= latchedValue < MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Install a FASTPOS interrupt handler. Triggered by a registration *//* mark the stored position may be used to correct a bag making process.*//*----------------------------------------------------------------------*/void myFastposHandler (void){ fastposition = 0; getFASTPOS (0, &fastposition); correctionLength = bagLength - fastposition; /* calculate correction*/}void main (void){ setFastposHandler (myFastposHandler); /* install the handler */ makeBags (); /* then make some bags */}

See Also:

FastAuxEncoder, FastEncoder, FastposHandler, POS

Page 150: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 150

FastPosXPC BX Scaled Default Range

❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFastPosX (__uint8 source, __uint8 axisNo, float *latchedPosition)

Description:When NextMove BX receives an auxiliary fast interrupt, all axis positions are latched. Thevalues for each interrupt can be read with the FastPosX function. The maximum latency tolatch the encoder values on an auxiliary fast interrupt is 1ms.

If the user auxiliary fast interrupt handler is defined, this will be called in response to thefast interrupt.

There are three auxiliary fast interrupts. There are separate latches for each interrupt, so theinterrupt latch to read must be specified in the call.

Parameters:source specifies the auxiliary fast interrupt latch to read.

1 <= source <= 3

axisNo specifies the axis whose latched position is to be returned.

0 <= axisNo < MAX_AXES

latchedPosition is the latched position of the axis in user units.

MIN_FLOAT <= latchedPosition < MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Read the latched position on axes 0 and 1 on auxiliary latch 1 *//*----------------------------------------------------------------------*/ float latch0; float latch1;

getFastPosX (1, 0, &latch0); getFastPosX (1, 1, &latch1);

Page 151: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 151

See Also:

FastAuxEncoderX, FastEncoderX, FASTPOS, FastposHandlerX

FastPosHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setFastposHandler (TFastposHandler *handler)

Description:Installs a user handler that will be called in response to the FASTPOS input interrupt. Theuser supplied handler is called immediately after the axis positions have been internallylatched. The latched axis positions may be read by calling FASTPOS. Latched encodervalues can be read with the FastEncoder function.

Parameters:handler is the address of the user supplied function that will be called in response to theFASTPOS input interrupt. TFastposHandler is defined in the file MG.H as:

typedef void TFastposHandler (void)

Possible Errors:NextMove will call the function whose address is passed in handler provided that theaddress is non-zero. NextMove does not, and cannot, determine whether the address isvalid.

Restrictions:None.

Default:By default there is no user supplied handler.

Example:/*----------------------------------------------------------------------*//* Install a FASTPOS interrupt handler. Triggered by a registration *//* mark the stored position may be used to correct a bag making process.*//*----------------------------------------------------------------------*/void myFastposHandler (void){ fastposition = 0; getFASTPOS (0, &fastposition); correctionLength = bagLength - fastposition; /* calculate correction*/}

Page 152: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 152

void main (void){ setFastposHandler (myFastposHandler); /* install the handler */ makeBags (); /* then make some bags */}

See Also:

DualPortHandler, ErrorHandler, FASTPOS, FastposHandlerX,StopSwitchHandler, UserInterruptHandler

FastPosHandlerXPC BX Scaled Default Range

❏ - - -

Prototype:__int16 setFastposHandlerX (TFastposHandlerX *handler)

Description:Installs a user handler that will be called in response to any of the three auxiliary fastinterrupt inputs on NextMove BX. The user supplied handler is called immediately after theaxis positions have been internally latched. The latched axis positions may be read bycalling FastPosX. Latched encoder values can be read with the FastEncoderX function.

When the handler is called, the number of the auxiliary fast interrupt is specified to allowthe code to read the latch values from the appropriate latch.

Parameters:handler is the address of the user supplied function that will be called in response to anauxiliary fast interrupt. TFastposHandlerX is defined in the file MG.H as:

typedef void TFastposHandler (__uint8 source)

Possible Errors:NextMove will call the function whose address is passed in handler provided that theaddress is non-zero. NextMove does not, and cannot, determine whether the address isvalid.

Restrictions:None.

Default:By default there is no user supplied handler.

Page 153: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 153

Example:/*----------------------------------------------------------------------*//* Install an auxiliary fast interrupt handler. Read latched position *//* on axes 0 and 1 and latched encoder values on axes 2 and 3. *//*----------------------------------------------------------------------*/void myAuxFastInterruptHandler (__uint8 source){ float pos0, pos1; float enc2, enc3;

getFastPosX (source, 0, &pos0); getFastPosX (source, 1, &pos0); getFastEncoderX (source, 2, &pos0); getFastEncoderX (source, 3, &pos0);}

void main (void){ setFastposHandlerX (myAuxFastInterruptHandler); /* install handler */}

See Also:

DualPortHandler, ErrorHandler, FastPosX, FastposHandler, StopSwitchHandler,UserInterruptHandler

FeedratePC BX Scaled Default Range❏ ❏ ❏ 40000 servo

1000 stepper0.0 - 8388607.0

Prototype:__int16 getFeedrate (__uint8 axisNo, float *feedrate)__int16 setFeedrate (__uint8 axisNo, float feedrate)

Description:Sets the maximum speed of an individual move loaded in the move buffer. For a positionalmove, the motion profile is specified by the acceleration, deceleration and maximum slewspeed. The Feedrate and SPEED functions operate identically; both setting the maximumslew speed for a positional move. The way in which the slew speed is interpreted iscontrolled with the FeedrateMode function.

In ‘speed mode’ the slew speed is applied to all positional, including those already in thebuffer. In ‘feedrate mode’ the slew speed only applies to new moves loaded into the buffer.Moves already in the move buffer will be executed at the slew speed they were loaded with.

Page 154: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 154

The two functions are included to make the use of the slew speed more obvious in thesource code. Ideally, the Feedrate function would be used when in ‘feedrate mode’ and theSPEED function when in ‘speed mode’.

Reading the feedrate returns the last value written to it. It does not necessarily return theslew speed of the currently executing move as this can be affected by the FeedrateModeand FeedrateOverride functions.

Slew speed is used during the following move types:

mdLINEARmdCIRCULARmdOFFSETmdHTAmdINCREMENT

The slew speed may not be achieved if the move length is not sufficient to achieve atrapezoidal profile. If the slew speed is changed whilst in ‘speed mode’, it will affect allmoves loaded in the buffer. The move in progress will ramp using the current accelerationand deceleration rates to the new slew speed.

Parameters:axisNo specifies the axis on which the slew speed is to be set or returned.

0 <= axisNo < MAX_AXES.

feedrate is the maximum speed applied to the axis.

0 <= feedrate < MAX_FLOAT.

Restrictions:None.

Default:Servo axes: 40,000 encoder edges / secondStepper axes: 1,000 steps / second

Example:/*----------------------------------------------------------------------*//* Load two moves in the buffer, the first with a slew speed of 50, the *//* second with a slew speed of 30. *//*----------------------------------------------------------------------*/setFeedrateMode (0, frFEEDRATE); /* feedrate mode */setFeedrate (0, 50.0); /* slew speed of 50 */setMOVER (0, 100.0); /* load mover of 100 */GO(1, 0); /* start move */

Page 155: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 155

setFeedrate (0, 30.0); /* new slew speed. Move in progress */ /* unaffected as axis in feedrate mode*/setMOVER (0, 100.0); /* load mover of 100 */GO(1, 0); /* start move */

See Also:

ACCEL, DECEL, FeedrateMode, FeedrateOverride, SPEED, VEL

FeedrateModePC BX Scaled Default Range❏ ❏ - 0 0 - 3

Prototype:__int16 getFeedrateMode (__uint8 axisNo, __uint8 *mode)__int16 setFeedrateMode (__uint8 axisNo, __uint8 mode)

Description:The FeedrateMode function controls the how the slew speed set with the SPEED orFeedrate functions is interpreted and also allows the affect of the FeedrateOverridefunction to be enabled or disabled.

mode accepts a bit pattern as follows:

Bit Constant Meaning

0 frSPEED Bit 0 not set. The axis is in speed mode.0 frFEEDRATE Bit 0 set. The axis is in feedrate mode.1 frOVERRIDEENABLE Slew speed is modified by the feedrate

override percentage.

In ‘speed mode’, bit 0 not set, the slew speed for positional moves is set with the SPEED orFeedrate functions. The change in slew speed takes immediate effect on moves alreadyloaded into the move buffer, the axis changing to the new slew speed at the currentacceleration or deceleration rate.

Example:float distanceToGo;

setFeedrateMode (1, frSPEED); /* speed mode */setSPEED (1, 30); /* slew speed 30 uu/s */setMOVER (1, 50); /* relative move of 50 units */GO (1, 1); /* start the move */do { getOFFSET (1, &distanceToGo); /* read distance left to go */} while (distanceToGo < 25) /* wait until half way */

Page 156: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 156

setFeedrate (1, 10); /* change slew speed to 10 uu/s */

In this example, the move is started and ramps to a slew speed of 30 user units per second.When there is less than 25 units left to travel, the slew speed is changed to 10 user units persecond. This will have an immediate affect with the axis decelerating to the new slewspeed.

In ‘feedrate mode’, bit 0 set, the slew speed for positional moves is set with the SPEED orFeedrate functions. The current slew speed is loaded with each positional move. When amove is executed from the buffer, it uses the slew speed it was loaded with, regardless of thecurrent slew speed.

Feedrate mode is useful for programming changes in slew speed across a number of moves.This is useful in contouring applications where the slew speed of corners and complexshapes needs to be slower than that of longer smoother shapes.

When contouring is turned on, with the CONTON function, a move will be performed at thespecified slew speed or slower, if the slew speed of the next loaded move dictates that theaxis needs to decelerate. If the next slew speed is higher than the current slew speed, thenthe axis will not accelerate until it passes into the next move. I.e. Any acceleration ordeceleration will always occur in the fastest of a pair of moves.

Example:float distanceToGo;

setFeedrateMode (1, frFEEDRATE); /* feedrate mode */setSPEED (1, 30); /* slew speed 30 uu/s */setMOVER (1, 50); /* relative move of 50 units */GO (1, 1); /* start the move */do { getOFFSET (1, &distanceToGo); /* read distance left to go */} while (distanceToGo < 25) /* wait until half way */setFeedrate (1, 10); /* change slew speed to 10 uu/s */setMOVER (1, 50); /* relative move of 50 units */

In this example, the move is started and ramps to a slew speed of 30 user units per second.When there is less than 25 units left to travel, the slew speed is changed to 10 user units persecond. This has no effect on the move in progress however. When the next move of 50units starts, a slew speed of 10 user units per second is used.

Bit 1 controls the use of feedrate override. If bit 1 is set, then the slew speed is modified bythe percentage set with the FeedrateOverride function. This is regardless of bit 0, i.e.speed or feedrate mode. If bit 1 is not set, then the FeedrateOverride function is ignoredand the move will execute at the desired slew speed.

Parameters:axisNo specifies the axis on which the feedrate mode is to be set or returned.

Page 157: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 157

0 <= axisNo < MAX_AXES.

mode is the mode applied to the axis.

0 <= mode <= 3

Restrictions:None.

Default:The default mode is frSPEED.

See Also:

ACCEL, DECEL, Feedrate, FeedrateOverride, SPEED

FeedrateOverridePC BX Scaled Default Range❏ ❏ - 100 0 - 8388607.0

Prototype:__int16 getFeedrateOverride (__uint8 axisNo, float *feedrateOverride)__int16 setFeedrateOverride (__uint8 axisNo, float feedrateOverride)

Description:For a positional move, the motion profile slew speed can be defined by the SPEED orFeedrate functions. If the FeedrateMode function is used to set an axis to ‘feedrate mode’,slew speeds are loaded with each move and it is not possible to change the slew speed of amove already in the buffer. The FeedrateOverride function allows the slew speed ofmoves to be changed by defining an override percentage. If the override is 100% then slewspeed will be the value defined by Feedrate or SPEED. If the percentage is higher , themove will run faster and vice-versa.

The use of the override percentage can be turned on and off with the FeedrateModefunction. If feedrate override is disabled and the axis is in feedrate mode, the Suspendfunction can be used to temporarily pause a move in progress. FeedrateOverride applies tothe following move types:

mdLINEARmdCIRCULARmdOFFSETmdINCREMENT

Page 158: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 158

Parameters:axisNo specifies the axis on which the override is to be set or returned.

0 <= axisNo < MAX_AXES.

feedrateOverride is the override percentage to be applied to the axis.

0 <= feedrateOverride <= MAX_FLOAT

Restrictions:None.

Default:The default override is 100%.

Example:/*----------------------------------------------------------------------*//* Load a number of moves on axis 5 with varying slew speeds. Analog *//* channel 0 is used to control the override percentage *//*----------------------------------------------------------------------*/__uint16 move;__int16 analogue;

setADCMode (0, 0); /* Set channel as single ended unipolar */setFeedrateMode (5, frFEEDRATE + frOVERRIDEENABLE); /* Feedrate mode and override enabled */setFeedrate (5, 30); /* slew speed of 30 */setMOVER (5, 50); /* move of 50 */setFeedrate (5, 50); /* slew speed of 50 */setMOVER (5, 50); /* move of 50 */setFeedrate (5, 10); /* slew speed of 10 */setMOVER (5, 50); /* move of 50 */GO(1, 5); /* Start the moves */do { getANALOGUE (0, &analogue); /* Read channel 0. Gives 0 - 4095 */ setFeedrateOverride (5, analogue/10); /* override in range 0 - 400% */ getMODE (5, &move); /* read current move type */} while (move != mdIDLE); /* Loop until moves finished */

See Also:

ACCEL, DECEL, Feedrate, FeedrateMode, SPEED, Suspend

Page 159: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 159

FEModePC BX Scaled Default Range❏ ❏ 1 0 - 1

Prototype:__int16 getFEMode (__uint8 axisNo, __uint8 *mode)__int16 setFEMode (__uint8 axisNo, __uint8 mode)

Description:Sets or returns the mode for following error default action. A following error condition willexist if the axis following error exceeds the maximum set by MFOLERR. When afollowing error condition exists, the mode is checked to see if an asynchronous axis errorshould be generated. If an axis error is generated and the user error handler is not called(see ErrorMask) or it is not defined or it does not clear the error, then the default action setby the mode will be taken.

Parameters:axisNo specifies the axis on which the following error mode switch is to be set or returned.

0 <= axisNo < MAX_AXES.

mode specifies the response to an axis exceeding its following error limit and can take oneof the following values:

Value Constant Meaning

0 feIGNORE No action is taken in response to the maximum followingerror limit being exceeded

1 feNORMAL An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to crash stop the axis and any axesinvolved in the move. The axis enable will be removed.The error can be cleared by writing to the asynchronouserror structure directly using AsyncError, by callingCANCEL or RESET or by setting the mode to feIGNORE.

Restrictions:Only applicable to axes configured as cfSERVO.

Default:The default mode is feNORMAL.

Page 160: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 160

Example:/*----------------------------------------------------------------------*//* A system uses stepper axes only but the encoder inputs are used for *//* position checking. *//*----------------------------------------------------------------------*/void configureServos (void){ __uint8 ax;

for (ax=0; ax<cnMAX_SERVOS; ax++) { setCONFIG (ax, cfOFF); /* turn the servo axes off */ setFEMode (ax, feIGNORE); /* ignore any following errors */ }}

See Also:

AsyncError, AxisStatus, CANCEL, ERROR, ErrorMask, ErrorHandler, FOLERR,MFOLERR, RESET

FloatPC BX Scaled Default Range❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFloat (__int16 address, float *value)__int16 putFloat (__int16 address, float value)

Description:Allows a floating point number to be read or written to dual port RAM. Dual port RAM issplit into a number of areas for different purposes. There are some areas spare for user datatransfer. Two locations are used since DPR is 16 bits wide. See the ‘MINT InterfaceLibrary Users Guide’ for details on dual port RAM usage.

Parameters:address specifies the dual port RAM offset.

0 <= address < 0x3FF

value is the value to be written or read from dual port RAM.

MIN_FLOAT <= value <= MAX_FLOAT

Restrictions:Some areas should not be changed manually. See the ‘MINT Interface Library Users Guide’for details on dual port RAM usage.

Page 161: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 161

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Write the contents of an array, tolerances[10], to 0x200 *//*----------------------------------------------------------------------*/for (count = 0; count < 10; count++) { putFloat (0x200 + 2 * count, tolerances[count]);}

See Also:

Comms, Long, Uint, Word

FLYPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 FLY (__uint8 axisNo, float distance)

Description:A flying shear allows the position lock of a master and slave axis over defined distance withimposed accelerations and deceleration. The motion is divided into segments where amaster distance and a slave distance are given for that segment. The move distance is thenperformed on the slave over the master distance at a constant acceleration rate. The slavewill start a segment with the velocity from the end of the last segment.

This function sets up a fly segment on the slave axis. The master reference is specified withthe MasterSource and MasterChannel functions and the master distance is specified withthe MasterDistance function. The master distance value is directional. If the master ismoving in a positive direction, MasterDistance must be positive and vice-versa.

Each fly segment is loaded individually into the move buffer. The fly segments will blendtogether as long the next segment is already in the buffer. If no more segments areavailable, the axis will crash stop.

A GO is required to execute each fly segment as it is loaded into the buffer. The move has amode of mdFLY and no other moves apart from further fly segments can be loaded into themove buffer. The flying shear will continue until no more segments are available or themove is terminated by the user with STOP, CANCEL or RESET.

Page 162: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 162

Flying shear distances need to be calculated accurately in order to stop small accumulativeerrors. These are particularly noticeable where a number of segments are repeated. Flyingshear and follow segments can be mixed together with the use of the FOLLOWMODEfunction.

Parameters:axisNo specifies the axis on which the flying shear segment is to be setup.

0 <= axisNo < MAX_AXES.

distance is the distance in user units that the slave axis should move.

MIN_FLOAT <= distance <= MAX_FLOAT

Restrictions:The function will wait until there is a free slot in the move buffer. To avoid the call hangingyou should test for a free slot prior to calling FLY calling okToLoadMove. The axis mustbe idle or be in mode mdFLY, not configured as cfOFF, and have no error present.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* A master axis moves at constant velocity. It is required that the *//* slave axis accelerates to a 1:1 ratio with the master before coming *//* to a halt and pausing for a specified master distance. This pattern *//* then repeats for 30 cycles. *//*----------------------------------------------------------------------*/__uint8 counter = 0;

setMasterSource (0, msPOS); /* Follow master axis position */setMasterChannel (0, 3); /* Slave axis 0. Master axis 3 */

do { setMasterDistance (0, 10); /* Accelerate from rest to 1:1 over 10 */ FLY (0, 5); /* revs of the master */ GO (1, 0); setMasterDistance (0, 25); /* Stay at 1:1 ratio for 25 revs */ FLY (0, 25); GO (1, 0); setMasterDistance (0, 6); /* Decelerate to rest of 6 master revs */ FLY (0, 3); GO (1, 0); setMasterDistance (0, 5); /* Remain stationary for 5 master revs */ FLY (0, 0); GO (1, 0);

counter++;} while (counter < 31);

Page 163: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 163

See Also:

GO, MasterChannel, MasterSource, MoveBufferSize, MasterDistance, STOP,

FOLERRPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getFOLERR (__uint8 axisNo, float *followingError)

Description:Returns the instantaneous following error from the axis in user units. The following error isthe difference between the profiled demand position (where you want to be) and themeasured axis position. If the following error exceeds the value set by MFOLERR the axishas exceeded its following error limit and an error condition will be generated. Dependingon the default action mode set by FEMode, an asynchronous axis error will be generated.The user supplied error handler may then be called according to the setting of the error mask(see ErrorMask). Monitoring the following error is useful when tuning a servo system.

Parameters:axisNo specifies the axis on which the following error is to be returned.

0 <= axisNo < MAX_AXES.

followingError is the following error in user units.

MIN_FLOAT <= followingError <= MAX_FLOAT

Restrictions:Only applicable to axes configured as cfSERVO.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Move axis #0 and log the maximum following error during motion. *//*----------------------------------------------------------------------*/float maxFE; /* global will store max. value */

void getMaxFollowingError (void){ float fe;

Page 164: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 164

maxFE = 0; /* set initial max value to zero */ setMOVER (0, 1000); /* start move on axis #0 */ GO (1, 0); isidle = 0; while (!isidle) { /* repeat until motion has stopped */ getIDLE (0 , &isidle); getFOLERR (0, &fe); /* get the following error */ if (fe > maxFE) maxFE = fe; /* save the largest value read */ }}

See Also:

FEMode, MFOLERR

FOLLOWPC BX Scaled Default Range❏ ❏ - - -8388607.0 - 8388607.0

Prototype:__int16 getFOLLOW (__uint8 axisNo, float *followRatio)__int16 setFOLLOW (__uint8 axisNo, float followRatio)

Description:Causes an axis to ‘follow’ another axis with a specified gear ratio; a form of programmablesoftware gearbox. The change in position of the slave or following axis is controlled by thechange in position of a master axis. The master reference is selected by callingMasterSource and MasterChannel. FOLLOW is used to specify the gear ratio betweenthe two axes.

The way in which the slave axis accelerates to the follow ratio is controlled by theFOLLOWMODE function. Four modes are possible; position locked, velocity locked,clutch mode and continuous clutch mode.

After a successful call to FOLLOW, motion will begin immediately and a move of typemdFOLLOW will be loaded in the move buffer. The move will continue until a follow ratioof zero is set or the move is terminated with STOP, CANCEL or RESET.

Positional offsets can be performed whilst following by calling OFFSET.

Parameters:axisNo specifies the axis that is required to follow the master axis.

0 <= axisNo < MAX_AXES.

followRatio is the master slave ratio.

MIN_FLOAT <= followRatio <= MAX_FLOAT

Page 165: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 165

Restrictions:A follow move cannot be loaded if the axis is configured as cfOFF or the mode of motion isnot:

mdIDLE, mdFOLLOW or mdFLY

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Axis 0 and 1 form an XY table and are being manually moved around *//* a shape. Axes 2 and 3 are to produce an identical shape on a cutting*//* XY table./*----------------------------------------------------------------------*/__uint8 state;

setMasterSource (2, msPOS); /* Follow master position */setMasterSource (3, msPOS); /* Follow master position */setMasterChannel (2, 0); /* Axis 2 to follow axis 0 */setMasterChannel (3, 1); /* Axis 3 to follow axis 1 */

do { /* Wait for start signal from */ INx (0, &state); /* input 0 */} while (!state);

setFOLLOW (2, 1.5); /* Start following on both slave*/setFOLLOW (3, 1.5); /* axes to produce shape that is*/ /* 1.5 times as big */

See Also:

FOLLOWMODE, MasterChannel, MasterDistance, MasterSource, OFFSET

FOLLOWMODEPC BX Scaled Default Range❏ ❏ 0 0 - 3

Prototype:__int16 getFOLLOWMODE (__uint8 axisNo, __uint8 *followMode)__int16 setFOLLOWMODE (__uint8 axisNo, __uint8 followMode)

Description:This is used to select the way in which an axis executing a FOLLOW motion accelerates tothe programmed follow ratio. This function should be called prior to setting up aFOLLOW move.

Page 166: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 166

Parameters:axisNo specifies the axis on which to set or return the following mode.

0 <= axisNo < MAX_AXES.

followMode is the mode in which any FOLLOW motion on axisNo will be performed. Itcan take one of the following values:

Value Constant

0 fmNO_RAMP1 fmRAMP2 fmCLUTCH3 fmCONTINUOUS_CLUTCH

fmNO_RAMP: Changes in follow ratio are performed by the slave with no ramping.(Infinite demand acceleration and deceleration).

fmRAMP: Changes in follow ratio are followed by the slave with linear acceleration andeceleration ramps. The ramps are taken from the ACCEL and DECEL values on the slaveaxis. Changes in master speed are also follows using linear acceleration and deceleration.

fmCLUTCH: Ramping to and from rest will be performed with a flying shear motion. Thismeans the ramping will occur over a master axis distance specified with theMasterDistance function. Once at the required follow ratio, further changes in follow ratioare performed by the slave axis with no ramping. The STOP function must be called to stopthe FOLLOW motion and perform a flying shear to rest over the distance specified byMasterDistance.

fmCONTINUOUS_CLUTCH: All changes in follow ratio are performed with a flying shearmotion. Ramping will occur over a master distance specified with the MasterDistancefunction. The STOP function must be called to stop the FOLLOW motion and perform aflying shear to rest over the distance specified by MasterDistance. FLY segments can alsobe called whilst in this follow mode and a number of changes in follow ratio can effectivelybe buffered as each change will be done with a flying shear segment.

Restrictions:The following mode cannot be changed while the axis is performing a FOLLOW move.

Default:The default follow mode is fmNO_RAMP.

Page 167: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 167

Example:/*----------------------------------------------------------------------*//* Axis 3 is a master axis to be followed. The slave must accelerate *//* up to a 2:1 ratio with the master over 10 metres of master travel. *//* When input 0 becomes active, change ratio to 3:1. When input 1 *//* becomes active, the slave must decelerate to rest of 2 metres of *//* master travel. *//*----------------------------------------------------------------------*/__uint8 state;

setMasterSource (0, msDEMAND); /* Follow master demand speed */setMasterChannel (0, 3); /* Axis 0 to follow axis 3 */setFOLLOWMODE (0, fmCLUTCH); /* Ramp using a flying shear */setMasterDistance (0, 10); /* Ramp over 10 m of master */setFOLLOW (0, 2); /* Start following at 2:1 ratio */

do { getINx(0, &state); /* Wait for input 0 to be active*/} while (!state);

setFOLLOW (0, 3); /* Change following to 3:1 ratio */

do { getINx(1, &state); /* Wait for input 1 to be active*/} while (!state);

setMasterDistance (0, 2); /* Ramp over 2 m of master */STOP(0); /* Stop following, ramp to rest */

See Also:

ACCEL, DECEL, FLY, FOLLOW, MasterChannel, MasterDistance,MasterSource, STOP

ForwardLimitSwitchInputPC BX Scaled Default Range❏ ❏ - 0 - 23 PC

0 - 15 BX

Prototype:__int16 getForwardLimitSwitchInput (__uint8 axisNo, __int16 *inputChannel)__int16 setForwardLimitSwitchInput (__uint8 axisNo, __int16 inputChannel)

Description:Sets or returns the user digital input channel configured to be the axis forward end of travellimit switch input. Each axis may be configured to have its own limit switch input, share aninput with any number of other axes or have no limit switch input. When a limit switchbecomes active the action taken depends upon the mode selected bysetHardwareLimitMode.

Page 168: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 168

Parameters:axisNo specifies the axis on which the forward limit switch input is to be set or returned.

0 <= axisNo < MAX_AXES.

inputChannel specifies the user digital input that is connected to the forward limit switch.

-1 <= inputChannel < MAX_INPUTS

-1 : axisNo has no forward limit switch.

Restrictions:None.

Default:There are no default limit switch assignments.

Example:/*----------------------------------------------------------------------*//* Disable all limit switch inputs. *//*----------------------------------------------------------------------*/void disableAllLimits (void){ __uint8 ax;

for (ax=0; ax<cnMAX_AXES; ax++) { setForwardLimitSwitchInput (ax, -1); /* no forward limit switch */ setReverseLimitSwitchInput (ax, -1); /* no reverse limit switch */ }}

See Also:

ERROR, ErrorMask, ForwardSoftwareLimit, HardwareLimitMode, LIMITF, LIMITR,ReverseLimitSwitchInput, ReverseSoftwareLimit, SoftwareLimitMode

ForwardSoftwareLimitPC BX Scaled Default Range❏ ❏ ❏ 8388607.0 -8388607.0 - 8388607.0

Prototype:__int16 getForwardSoftwareLimit (__uint8 axisNo, float *forwardLimit)__int16 setForwardSoftwareLimit (__uint8 axisNo, float forwardLimit)

Page 169: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 169

Description:Sets or returns the maximum forward limit of travel on axis axisNo. Each axis may beconfigured to have a maximum and minimum limit of travel. If an axis moves beyond theselimit positions, an asynchronous axis error will be generated. The user defined error handlerwill be called if it is defined and enabled (see ErrorMask). If the error is not handled bythe user then default action will be taken according to the mode set withSoftwareLimitMode.

Parameters:axisNo specifies the axis on which the forward software limit is to be set or returned.

0 <= axisNo < MAX_AXES.

forwardLimit is the most positive position, in user units, that axisNo may achieve before asoftware limit condition is reported.

MIN_FLOAT <= forwardLimit <= MAX_FLOAT

Restrictions:None.

Default:The default forward software limit position is MAX_FLOAT.

Example:/*----------------------------------------------------------------------*//* if axis #0 has hit its forward software limit, set elsewhere in the *//* program, check the interference of axis #1. If axis #1 is clear *//* expand the software limit on axis #0. *//*----------------------------------------------------------------------*/void checkSoftwareLimits (void){ status = 0; getAxisStatus ( 0 , &status ); if ( status & erFWD_SOFT_LIMIT) { if (getPOS (1) > 1564.3) setForwardSoftwareLimit (0, 1000); }}

See Also:

AsyncError, AxisStatus, DISLIMIT, ENLIMIT, ErrorMask, ReverseSoftwareLimit,SoftwareLimitMode

Page 170: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 170

FREQPC BX Scaled Default Range❏ -8000000 - 8000000

Prototype:__int16 getFREQ (__uint8 axisNo, float *frequency)__int16 setFREQ (__uint8 axisNo, float frequency)

Description:Allow user to set frequency output in the range of 150Hz to 8MHz. The axis must beconfigured off in order to control the frequency output directly. The direction of thedirection output signal is controlled by the sign of the value passed to the function. A valuethat is under 150Hz will not produce any output on the pulse output. FREQ cannot be usedif any of the stepper channels are configured as cfPWM. The pulse and direction outputs canalso be controlled directly with the Pulse and StepDirection functions.

Parameters:axisNo specifies the axis on which the frequency is to be set or returned.

0 <= axisNo < MAX_AXES

frequency is the pulse output frequency in Hertz.

-8MHz <= frequency <= 8MHz

Restrictions:Applicable only to axes that could be configured as stepper axes. The axis must beconfigured as cfOFF.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Force a constant frequency on axis #5. *//*----------------------------------------------------------------------*/setCONFIG (5, cfOFF); /* turn axis off to prevent error */setFREQ (5, 1000); /* force frequency of 1 kHz */

See Also:

CONFIG, Pulse, StepDirection

Page 171: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 171

GAINPC BX Scaled Default Range❏ ❏ 0 0 - 10000

Prototype:__int16 getGAIN (__uint8 axisNo, float *proportionalGain)__int16 setGAIN (__uint8 axisNo, float proportionalGain)

Description:

Servo Axis:Sets or returns the proportional gain on servo axis axisNo.

Stepper Axis:The stepper gain adjusts the speed of ‘pull-in’ of a stepper move, so directly affects theovershoot and settling time of stepper axis moves. The default value is 0.02 and will notneed to be modified for most stepper applications.

A normal stepper move should look like this:

Page 172: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 172

Increasing the stepper gain will increase the overshoot

Decreasing the stepper gain will increase settling time

This parameter should be modified with care as very small adjustments can have alarge affect on the move profile.

Page 173: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 173

Parameters:axisNo specifies the axis on which the proportional gain is to be set or returned.

0 <= axisNo < MAX_AXES

proportionalGain is the servo loop proportional gain applied to the axis.

0 <= proportionalGain < 10000

Restrictions:Proportional gain may be changed at any time but is only applicable to axes configured ascfSERVO or cfSTEPPER.

Default:After power up or board reset, proportional gain is set to zero.

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. *//*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis){ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */ setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enableDrive (axis); /* now enable the drive again */}

See Also:

DerivativeGain, KVEL, KVELFF, KINT, KINTRANGE, RESET

GearingPC BX Scaled Default Range❏ ❏ 100.0 -8388607.0 - 8388607.0

Prototype:__int16 getGearing (__uint8 axisNo, float *gearing);__int16 setGearing (__uint8 axisNo, float gearing);

Page 174: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 174

Description:All sampled master / slave systems have an inherent lag in the system. This lag is speeddependant, the faster the master axis, the larger the lag seen. Gearing compensation can beused to overcome this lag for the FOLLOW, FLY and Cam move types.

The Gearing function allows the lag or lead position of the slave axis to be controlled. Thedefault value is 100% which is 0 lag. A value of 200% will make the slave axis lead themaster axis by a value that is dependant on the slave axis speed. A value of -100% willincrease the size of the lag on the slave. The gearing compensation is based on axis speed,so the actual size of any requested lead or lag will change at different speeds.

Parameters:axisNo specifies the axis on which the compensation value is to be set or returned.

0 <= axisNo < MAX_AXES

gearing is the compensation percentage.

MIN_FLOAT <= gearing < MAX_FLOAT

Restrictions:None.

Default:The default compensation is 100%.

Example:/*----------------------------------------------------------------------*//* Compensate for axis 0 following axis 3 *//*----------------------------------------------------------------------*/setMasterSource (0, msPOS); /* Master is axis position */setMasterChannel (0, 3); /* Master is axis 3 */setGearing (0, 100.0); /* Compensate lag */setGearingMode (0, 1); /* Turn on gearing compensation */setFOLLOW (0, 1.0); /* Start following the master */

See Also:

Cam, FLY, FOLLOW, GearingMode, MasterChannel, MasterSource

Page 175: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 175

GearingModePC BX Scaled Default Range❏ ❏ 0 0 - 1

Prototype:__int16 getGearingMode (__uint8 axisNo, __uint8 *mode);__int16 setGearingMode (__uint8 axisNo, __uint8 mode);

Description:All sampled master / slave systems have an inherent lag in the system. This lag is speeddependant, the faster the master axis, the larger the lag seen. Gearing compensation can beused to overcome this lag for the FOLLOW, FLY and Cam move types.

The percentage compensation size is set with the GEARING function.

Parameters:axisNo specifies the axis on which the compensation value is to be set or returned.

0 <= axisNo < MAX_AXES

mode controls the mode.

Value Symbolic Constant Description

0 gcOFF Turn gearing compensation off1 gcFEEDFORWARD Turn gearing compensation on.

Restrictions:None.

Default:Gearing compensation is turned off by default.

Example:/*----------------------------------------------------------------------*//* Turn gearing compensation on *//*----------------------------------------------------------------------*/setGearingMode (0, gcFEEDFORWARD);

See Also:

Cam, FLY, FOLLOW, GearingMode, MasterChannel, MasterSource

Page 176: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 176

GOPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 GO (__uint8 numberOfAxes, ...)

Description:Starts any pending motion on one or more axes simultaneously. A move will be pendingafter a successful call to any of the following move types:

mdLINEAR, mdCIRCULAR, mdOFFSET, mdFLY, mdHTA, mdCAM, mdSPLINE andmdMSPLINE, mdINCREMENT

GO takes a variable argument list of __uint8s, each of which specifies an axis upon whichmotion should be started. The axis specified in the list does not have to be the master axisof the pending move. Issuing GO to any axis involved in a multi-axis move will trigger themotion on the set of axes. If there are multiple moves in the move buffer, then all thosemoves will be triggered. Subsequently loaded moves will require an additional call to GO.

Parameters:numberOfAxes specifies the number of additional arguments that are being passed to thefunction.

1 <= numberOfAxes <= MAX_AXES.

The additional arguments should be passed as __uint8s. Each argument may take thevalues:

0 <= argument < MAX_AXES.

If the number of arguments or their type does not agree with that specified the result of thecall will be indeterminate. It is the programmers responsibility to ensure that the numberand type of the arguments match this description.

Restrictions:GO sets an internal trigger which allows the pending motion to start. When the motionactually starts depends upon the existing motion status of the axis and any other axis whichmay be required to take part in the pending motion.

When calling GO from the host from Visual Basic or Delphi, variable argument lists are notsupported. There are eight GO functions, GO1 .. GO8. The appropriate function should beused, depending on the number of axes to triggered.

Page 177: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 177

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Two x-y plotters are each used to draw a figure of eight with the two*//* circle centres lying on the x axis. Radius of each circle is 20 mm, *//* path speed is 100 mm/s. Starting position is (0, 0). *//*----------------------------------------------------------------------*/void figureOfEight (void){ CONTON (0); /* draw shape without stopping */ CONTON (2); /* 2nd system */ setSPEED (0, 100); /* path speed is 100 mm/s */ setSPEED (2, 100); /* 2nd system */ setCIRCLER (0, 1, 20, 0, 360); /* anti-clockwise in right hand plane*/ setCIRCLER (2, 3, 20, 0, 360); /* same on 2nd system */ GO (2, 0, 2); /* start the moves on both systems */ setCIRCLER (0, 1, -20, 0, -360); /* clockwise in left hand plane */ setCIRCLER (2, 3, -20, 0, -360); /* same on 2nd system */ GO (2, 1, 3); /* start the moves on both systems */}

See Also:

CIRCLEA, CIRCLER, IDLE, MOVEA, MoveBufferSize, MOVER, okToLoadMove,VECTORA, VECTORR

Page 178: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 178

HardwareLimitModePC BX Scaled Default Range❏ ❏ 0 0 - 3

Prototype:__int16 getHardwareLimitMode (__uint8 axisNo, __uint8 *mode)__int16 setHardwareLimitMode (__uint8 axisNo, __uint8 mode)

Description:Limit switch inputs can be attached to axes using the ForwardLimitSwitchInput andReverseLimitSwitchInput functions. When one of these inputs becomes active, an errorcondition will exist for the axis.

The default action mode is checked to see if an asynchronous axis error should be generated.If one is, the user supplied error handler will be called if it is defined and enabled (seeErrorMask). This function controls the default action that will be taken if the user suppliederror handler does not clear the error.

Setting the mode to hlIGNORE will clear a hardware limit error.

Parameters:axisNo specifies the axis on which the software switch is to be set or returned.

0 <= axisNo < MAX_AXES.

mode specifies the action that should be taken when a hardware limit input becomes active:

Value Constant Meaning

0 hlIGNORE Hardware limit inputs are ignored and no error is generated.1 hlNORMAL An asynchronous axis error will be generated. The user

supplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to crash stop the axis and any axesinvloved in the move. The axis enable will be removed andthe relay output dropped. The error can be cleared bywriting to the aasynchronous error struicture directly usingAsyncError or by calling CANCEL or RESET.

Page 179: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 179

Value Constant Meaning

2 hlCANCEL An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to crash stop the axis and any axesinvloved in the move. The error can be cleared by writingto the aasynchronous error struicture directly usingAsyncError or by calling CANCEL or RESET.

3 hlSTOP An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to decelerate the axis at the rate set withErrorDeceleration. The error can be cleared by writing tothe asynchronous error structure directly using AsyncErroror by calling CANCEL or RESET.

Restrictions:None.

Default:By default hardware limit mode is set to hlNORMAL.

Example:/*----------------------------------------------------------------------*//* Select that hardware limits on axis #0 do not call the error handler *//* but automatically ramp the axis to a powered stop. *//*----------------------------------------------------------------------*/getErrorMask ( 0, &mask);setErrorMask (0, mask & (erFWD_HARD_LIMIT + erREV_HARD_LIMIT));setHardwareLimitMode (0, hlSTOP);

See Also:

AsyncError, ERROR, ErrorMask, ForwardLimitSwitchInput, LIMITF, LIMITR,ReverseLimitSwitchInput

Page 180: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 180

HMSPEEDPC BX Scaled Default Range❏ ❏ ❏ 40000 servo

500 stepper0 - 8388607.0

Prototype:__int16 getHMSPEED (__uint8 axisNo, float *homeSpeed)__int16 setHMSPEED (__uint8 axisNo, float homeSpeed)

Description:Sets or returns the speed at which axis axisNo will search for a home switch. When homingon a switch the axis will search for the switch at homeSpeed. On seeing the home inputactive the axis will reverse at homeSpeed / backoff until the home input is inactive (and anencoder marker pulse is found if this has been selected).

Parameters:axisNo specifies the axis on which the home speed is to be set or returned.

0 <= axisNo < MAX_AXES.

homeSpeed is the speed in user units / second at which axis axisNo searches for a homeswitch.

0 < homeSpeed < MAX_FLOAT

Restrictions:None. homeSpeed may be altered at any time.

Default:Servo axes: 40,000 encoder edges / secondStepper axes: 500 steps / second

Example:/*----------------------------------------------------------------------*//* Home axis #2. *//* Search for home switch in a negative direction at 50 mm/s. *//* Creep off the switch at 2 mm/s. *//*----------------------------------------------------------------------*/void homeAxis2 (void){ setHMSPEED (2, 50); /* set search speed to 50 mm/s */ setBACKOFF (2, 25); /* creep = 50 / 25 = 2 mm/s */ setHOME (2, hmNEGATIVE_SWITCH); /* start the home sequence */}

Page 181: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 181

See Also:

ACCEL, BACKOFF, DECEL, HOME

HoldToAnaloguePC BX Scaled Default Range❏ ❏ - - -2047 - 4095

Prototype:__int16 getHoldToAnalogue (__uint8 axisNo, __int16 *analogueValue)__int16 setHoldToAnalogue (__uint8 axisNo, __int16 analogueValue)

Description:Sets or returns the current hold value in a Hold To Analogue move. mdHTA is a mode ofmotion which allows the value seen on one of the analog input channels to be held at aconstant specified value where the position of the axis has a direct affect on the value seenon the analog channel. The HoldToAnalogue function specifies the desired analog holdvalue.

The axis position is controlled to minimise the error between the desired hold value and themeasured analog value. The Hold To Analogue algorithm uses a proportional gainHTAGain and a damping term HTADamping to control motor position. The normalPIDVF loop is also used to control the axis position.

The axis must be idle and free from errors before the move can be started. Only furtherHoldToAnalogue moves can be loaded on the axis to change to current hold value. Themove type is subject to all synchronous and asynchronous error conditions. If anasynchronous error dictates that the ErrorDeceleration must be used then the move willstop using the error deceleration rate.

The motion is subject to all NextMove error types.

The motion of the axis is at all times within the profile defined with the ACCEL, DECELand SPEED/Feedrate functions. The response of the axis to an error on the analog channelcan therefore be easily controlled

Reading the function returns the current value being held to. If the axis is not currently inmdHTA, then reading the function will return the last hold value.

The analog channel to use is defined with the HTAChannel function. It also possible to setup an analog filter with the HTAFilter function and to set up an error deadband with theHTADeadband function.

The motion can be terminated by the STOP function which will cause the axis to rampdown at the current deceleration rate or CANCEL which will cause the axis to crash stop.

Page 182: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 182

The value passed to the function is the desired value to be seen on the analog input channel.The valid range of the hold value depends on the current configuration of the analog inputchannel. The analog input channel is set with the HTAChannel function and the analogchannel configuration is set with the ADCMode function. For bipolar analog channelconfiguration, the hold value range is -2047 to 2047. For unipolar analog channelconfiguration, the hold value range is 0 to 4095.

The GO function is required to start motion. Hold To Analogue can be used on servo orstepper axes.

Restrictions:The axis cannot be configured as cfOFF or be in error and must be idle prior to the call.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Hold axis 2 to a value of 250 using channel 6 *//*----------------------------------------------------------------------*/setADCMode (6, acBIPOLAR); /* Bipolar channel */setHTAChannel (2, 6); /* Use channel 6 */setHTADeadBand (2, 2); /* Error deadband of 2 counts */setHTAFilter (2, 0.2); /* low analogue filter value */setHTAGain (2, 0.03); /* set the hta gain term */setHTADamping (2, 0.2); /* set the hta damping term */ACCEL (2, 200); /* set max accel rate */DECEL (2, 300); /* set max decel rate */setSPEED (2, 20); /* set max move speed */setHoldToAnalogue (2, 250); /* set hold value of 250 counts */GO (1, 2); /* start the move */

See Also:

ACCEL, ADCMode, CANCEL, DECEL, Feedrate, HTAChannel, HTADamping,HTADeadband, HTAFilter, HTAGain, SPEED, STOP

HOMEPC BX Scaled Default Range❏ ❏ - - 0 - 6

Prototype:__int16 getHOME (__uint8 axisNo, __uint8 *switchState)__int16 setHOME (__uint8 axisNo, __uint8 homeMode)

Page 183: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 183

Description:A digital input may be designated the home switch for an axis using the HomeSwitchInputfunction. This function returns the state of the home switch for this axis or starts a homingcycle in the specified mode. Homing can be performed according to the modes detailedbelow. The current ACCEL and DECEL ramps are used for the move with the speedspecified by HMSPEED.

The mode of motion is mdHOMING and the move can be terminated by calling STOP,CANCEL or RESET.

Parameters:axisNo specifies the axis whose home switch input is to be read or which should start ahoming sequence.

0 <= axisNo < MAX_AXES.

homeMode specifies one of a number of predefined homing sequences and may take one ofthe predefined values:

Value Constant Meaning

0 hmNEGATIVE_SWITCH The axis moves at HMSPEED in anegative direction until the homeswitch input becomes active. The axisdecelerates to rest then reverses atHMSPEED / BACKOFF until thehome switch input is inactive at whichpoint the axis decelerates to rest.

1 HmPOSITIVE_SWITCH As hmNEGATIVE_SWITCH but theinitial search direction is positive

2 hmNEGATIVE_INDEX The axis moves at HMSPEED /BACKOFF in a negative directionuntil a marker pulse is detected. Theaxis decelerates to rest then reverses ata preset creep speed until the markerpulse is located again at which pointthe motion abruptly stops.

3 HmPOSITIVE_INDEX As hmNEGATIVE_INDEX but theinitial search direction is positive

Page 184: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 184

Value Constant Meaning

4 hmNEGATIVE_SWITCH_INDEX The axis moves at HMSPEED in anegative direction until the homeswitch input becomes active. The axisdecelerates to rest then reverses atHMSPEED / BACKOFF until thehome switch input is inactive and amarker pulse is detected. The axisdecelerates to rest then reverses at apreset creep speed until the markerpulse is located again at which pointthe motion abruptly stops.

6 HmPOSITIVE_SWITCH_INDEX As hmNEGATIVE_SWITCH_INDEXbut the initial search direction ispositive

switchState returns the state of the home switch input.

0 - input is inactive or no home switch has been specified. 1 - input is active.

Restrictions:HOME will start a homing sequence without a call to GO. The axis cannot be configuredas cfOFF or be in error and must be idle prior to the call.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Home axis #2. *//* Search for home switch in a negative direction at 50 mm/s. *//* Creep off the switch at 2 mm/s. *//*----------------------------------------------------------------------*/void homeAxis2 (void){ setHMSPEED (2, 50); /* set search speed to 50 mm/s */ setBACKOFF (2, 25); /* creep = 50 / 25 = 2 mm/s */ setHOME (2, hmNEGATIVE_SWITCH); /* start the home sequence */ isidle = 0; while (!isidle) { getIDLE (2, &isidle); /* wait for the sequence to finish */ }}

Page 185: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 185

See Also:

ActiveInputLevel, ACCEL, BACKOFF, DECEL, HMSPEED, HomeSwitchInput,InputActiveMode

HomeSwitchInputPC BX Scaled Default Range❏ ❏ - - 0 - 23 PC

0 - 15 BX

Prototype:__int16 getHomeSwitchInput (__uint8 axisNo, __int16 *inputChannel)__int16 setHomeSwitchInput (__uint8 axisNo, __int16 inputChannel)

Description:A digital input can be assigned as a home switch for an axis. Each axis may be configuredto have its own home switch input, share an input with any number of other axes or have nohome switch input. Home switch inputs are only used during homing sequences (initiatedby calling HOME).

Parameters:axisNo specifies the axis on which the home switch input is to be set or returned.

0 <= axisNo < MAX_AXES.

inputChannel specifies the user digital input that is connected to the home switch.

-1 <= inputChannel < MAX_INPUTS

-1 : axisNo has no home switch.

Restrictions:None.

Default:There are no default home input assignments.

Example:/*----------------------------------------------------------------------*//* Redefine the home switch input for axis #3. *//*----------------------------------------------------------------------*/setHomeSwitchInput (3, 20); /* new home switch input is input #20 */

See Also:

ForwardLimitSwitchInput, HOME, ReverseLimitSwitchInput

Page 186: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 186

HTAChannelPC BX Scaled Default Range❏ ❏ 0 - 0 - 7

Prototype:__int16 getHTAChannel (__uint8 axisNo, __uint8 *channel)__int16 setHTAChannel (__uint8 axisNo, __uint8 channel)

Description:The HTAChannel function specifies the analog channel to monitor during a Hold ToAnalogue move on that axis. The analog channel can be in any configuration (ADCMode)as long as it is not turned off. The analog channel can have any configuration. The channelnumber must be a valid channel number. Reading the function returns the analog channelcurrently being used.

The default channel assignments are as follows:

Axis 0 1 2 3 4 5 6 7Analog Channel 1 3 5 7 9 11 13 15

Restrictions:None.

Default:See above.

Example:/*----------------------------------------------------------------------*//* Set the hold channel for a move on axis 7 to be 3 *//*----------------------------------------------------------------------*/setHTAChannel (7, 3);

See Also:

ADCMode, HoldToAnalogue

HTADampingPC BX Scaled Default Range❏ ❏ - 0 -8388607.0 - 8388607.0

Prototype:__int16 getHTADamping (__uint8 axisNo, float *damping)__int16 setHTADamping (__uint8 axisNo, float damping)

Page 187: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 187

Description:The HTADamping function is used to set the damping term in the Hold To Analoguealgorithm. The algorithm used to minimise error is:

Velocity Error Gain Error Damping= × + ×∆

HTADamping sets the Damping term in the above equation. A negative number can beused to reverse the move direction of the Hold To Analogue move. Under normalcircumstances, it is assumed that if the current analog value is lower than the desired holdvalue, that a positive direction move is required. If a negative direction move is required inthis situation then the HTADamping and HTAGain terms should both be negativenumbers.Restrictions:None.

Default:See above.

Example:/*----------------------------------------------------------------------*//* Set the damping term to 1.2 in a reverse direction system *//*----------------------------------------------------------------------*/setHTADamping (3, -1.2);

See Also:

HoldToAnalogue, HTAGain

HTADeadbandPC BX Scaled Default Range❏ ❏ - 0 0 - 4095

Prototype:__int16 getHTADeadBand (__uint8 axisNo, __int16 *deadBandValue)__int16 setHTADeadBand (__uint8 axisNo, __int16 deadBandValue)

Description:In the Hold To Analogue move, the error is calculated as the difference between themeasured analog value and the specified hold value. A deadband can be set up so that thesystem will only try and reduce the error when it becomes larger than the size specified withthe HTADeadband function.

Page 188: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 188

The deadband size is in analog counts. The value is specified as a positive number and isthe maximum size of the absolute analog error before the system will respond.

If the analog channel being used is configured to be bipolar, then a deadband greater than2047 will result in no movement on the axis

Restrictions:None.

Default:The default deadband is zero.

Example:/*----------------------------------------------------------------------*//* Read the deadband size on axis 1 *//*----------------------------------------------------------------------*/__int16 deadband;

getHTADeadBand (1, &deadband);

See Also:

ADCMode, HoldToAnalogue, HTAChannel

HTAFilterPC BX Scaled Default Range❏ ❏ - 0 0 - 1

Prototype:__int16 getHTAFilter (__uint8 axisNo, float* filterValue)__int16 setHTAFilter (__uint8 axisNo, float filterValue)

Description:Whilst a Hold To Analogue move is in progress, the analog channel being used can befiltered by a simple first order filter. This allows any high frequency noise to be removedfrom the incoming analog signal. The HTAFilter function allows the rate of smoothing tobe set between 0 and 1. A value of 0 turns the filter off. The closer the value to 1, the lesseffect each new analog sample has on the analog value being used for following. Forexample, if the factor is set to 0.9999 then it will take a number of seconds for the analogvalue seen in the Hold To Analogue move to respond to an actual change on the analoginput channel.

Page 189: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 189

The filter is applied to an axis, not a specific input channel. The filter will then be used onwhichever channel is assigned with the HTAChannel function for that axis. The filteringonly applies to the Hold To Analogue move type and the filtered value is not reflected in thevalue read from the ANALOGUE function or from the value updated in dual port RAM atany time.

Restrictions:None.

Default:The default is zero, i.e. no filtering.

Example:/*----------------------------------------------------------------------*//* Set the filter value to a high value of 0.7 *//*----------------------------------------------------------------------*/setHTAChannel (0, 0.7);

See Also:

HoldToAnalogue, HTADeadband

HTAGainPC BX Scaled Default Range❏ ❏ - 0 -8388607.0 - 8388607.0

Prototype:__int16 getHTAGain (__uint8 axisNo, float *gain)__int16 setHTAGain (__uint8 axisNo, float gain)

Description:The HTAGain function is used to set the gain term in the Hold To Analogue algorithm.The algorithm used to minimise error is:

Velocity Error Gain Error Damping= × + ×∆

HTAGain sets the Gain term in the above equation. A negative number can be used toreverse the move direction of the Hold To Analogue move. Under normal circumstances, itis assumed that if the current analog value is lower than the desired hold value, that apositive direction move is required. If a negative direction move is required in this situationthen the HTADamping and HTAGain terms should both be negative numbers.

Page 190: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 190

Restrictions:None.

Default:The default value is zero.

Example:/*----------------------------------------------------------------------*//* Set the gain term to a value of 0.01 *//*----------------------------------------------------------------------*/setHTAGain (5, 0.01);

See Also:

HoldToAnalogue, HTADamping

Page 191: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 191

IDLEPC BX Scaled Default Range❏ ❏ ❏ 16000 0 - 8388607.0

Prototype:__int16 getIDLE (__uint8 axisNo, __uint8 *state)__int16 setIDLE (__uint8 axisNo, float steadyStateError)

Description:When a move finishes, its mode of motion will be set to mdIDLE. The axis may still bemoving however due to following error. IDLE tests whether the move has finished and theaxis is within a specified distance of where is should be.

Sets a position window around the target position within which the measured position mustlie before the motion is considered to have finished. The full condition that must besatisfied in order for an axis to be idle is:

� mode of motion is zero (idle) and� ABS(target position - measured position) < steadyStateError

Parameters:axisNo specifies the axis from which the idle state is required or upon which the idlewindow is to be specified.

0 <= axisNo < MAX_AXES

state returns the idle state.

0 - the axis is not idle.1 - the axis is idle.

steadyStateError specifies the size of the position window, in user units, within which themeasured position must lie for the axis to be considered idle.

0 <= steadyStateError <= MAX_FLOAT.

Restrictions:The idle window can only be set on axes configured as cfSERVO or cfSTEPPER.

Default:Servo axes: 16,000 encoder edges

Stepper axes: 16,000 steps

Page 192: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 192

Example:/*----------------------------------------------------------------------*//* Trigger an output between two moves when the axis is at rest. *//*----------------------------------------------------------------------*/setIDLE (0, 0.5); /* axis must be within 0.5 mm of target position */setMOVEA (0, 1000); /* set up and start the first move */GO (1, 0);state = 0;

while (!state){ getIDLE (0, &state); /* wait for the move to complete */}setOUTx (10, True); /* turn on output #10 */setMOVEA (0, 2000); /* set up and start the 2nd move */GO (1, 0);

See Also:

GO, MODE, STOP

IdleHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setIdleHandler (TIdleHandler *handler)

Description:Installs a user function that can be used to break infinite loops. There are times when MINTMotion Library functions execute loops that wait for a particular condition to be met. If thiscondition is never met, due to a software or hardware fault, the code can hang. All suchloops that have the potential to hang call an ‘idle handler’. If this function returns non-zerothe loop will be broken. A default handler is always installed:

__uint8 defaultIdleHandler (void){ return 0;}

The function returns the address of the handler that was installed when the function wascalled.

Parameters:handler is the address of the user supplied function that will be called from within loops.

TIdleHandler is defined in the file MG.H as:typedef __uint8 TIdleHandler (void);

Page 193: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 193

Possible Errors:None.

Restrictions:In order to maximise code execution speed the relevant loops do not test for a NULLaddress. If the function is passed NULL it will install the default handler.

� If you are running code on NextMove (compiled with a C31 compiler) your loop breakerwill break loops on NextMove.

� If you are running Embedded Emulation from the host, see the AbortMMLCommandfunction.

Default:The default handler shown above is installed.

Example:/*=======================================================================*//* Test module. Test NextMove idleHandler. *//*=======================================================================*//*=======================================================================*//* INCLUDES *//*=======================================================================*/#include "mg.h"

/*=======================================================================*//* GLOBALS *//*=======================================================================*//*-----------------------------------------------------------------------*//* global used to signal to the idle handler that the hung loop should *//* broken *//*-----------------------------------------------------------------------*/volatile __uint8 breakLoop = 0;

/*=======================================================================*//* FUNCTION PROTOTYPES *//*=======================================================================*/__uint8 loopBreaker (void);

/*-----------------------------------------------------------------------*//* loopBreaker *//* *//* Function: *//* Installed by 'setIdleHandler' this function breaks loops that may *//* have hung. To break or not to break is by the value of the global *//* 'breakLoop' on NextMove. *//* *//* Argument List: *//* None. *//* *//* Return Value: */

Page 194: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 194

/* Current value of 'breakLoop' on NextMove. *//* *//*-----------------------------------------------------------------------*/__uint8 loopBreaker (void){ if (breakLoop) { breakLoop = 0; return 1; } return 0;}

/*-----------------------------------------------------------------------*//* DPRHandler *//* *//* Function: *//* Installed by call to 'setDualPortHandler' this function will be *//* called by NextMove in response to a dual port RAM interrupt. *//* *//* Tests for code for setMOVER and CANCEL. *//* If received setMOVER calls setMOVER. On third call system will hang *//* because the move buffer is full. *//* If CANCEL received the global breakLoop is set true. When the idle *//* handler is next called the loop that has hung will be broken. *//* *//* Argument List: *//* code - the interrupting value. *//* *//* Return Value: *//* None. *//* *//*-----------------------------------------------------------------------*/void DPRHandler (__int16 code){ __uint8 axis; float distance; /*---------------------------------------------------------------------*/ /* Test command code passed in dual port RAM. */ /*---------------------------------------------------------------------*/ switch (code) { case _setMOVER : axis = getWord (0, roFRONT_START); distance = getFloat (0, roFRONT_START+1); putWord (0, roFRONT_START, setMOVER (axis, distance)); break;

case _CANCEL : axis = getWord (0, roFRONT_START); breakLoop = 1; break;

case _RESET : axis = getWord (0, roFRONT_START); putWord (0, roFRONT_START, RESET (axis)); break; }}

Page 195: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 195

/*-----------------------------------------------------------------------*//* main *//* *//* Function: *//* NM : Installs a DPR interrupt handler. Traps codes for setMOVER and *//* CANCEL. *//* *//* Argument List: *//* None. *//* *//* Return Value: *//* 0 *//* *//*-----------------------------------------------------------------------*/__int16 main (void){ /*---------------------------------------------------------------------*/ /* Call initialiseNextMove to get the system running. */ /*---------------------------------------------------------------------*/ if (initialiseNextMove () == FAIL) { while (1); }

/*---------------------------------------------------------------------*/ /* Install our own idle handler to replace the default function. */ /*---------------------------------------------------------------------*/ setIdleHandler (loopBreaker);

/*---------------------------------------------------------------------*/ /* Install a dual port RAM handler. This will get called in the event */ /* of a dual port RAM interrupt. */ /*---------------------------------------------------------------------*/ setDualPortHandler (DPRHandler);

/*---------------------------------------------------------------------*/ /* Signal the host that an application is running. */ /*---------------------------------------------------------------------*/ putWord (0, roAPPLICATION_CODE, 0x100);

/*---------------------------------------------------------------------*/ /* Now simply wait for dual port RAM interrupts. */ /*---------------------------------------------------------------------*/ while (1);

return 0;}/*=======================================================================*//* END OF FILE *//*=======================================================================*/

Page 196: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 196

INPC BX Scaled Default Range❏ ❏ - - 0 - 16777215 PC

0 - 65535 BX

Prototype:__int16 IN (__uint32 *inputs)

Description:Returns the state of all digital user inputs as a bitmap. There are 24 uncommitted, opto-isolated digital inputs on NextMove PC and 16 on NextMove BX.

Parameters:inputs is a bit pattern representing the state of the digital input channels.

Possible Errors:None.

Restrictions:The inputs are polled at 1 kHz. Edge triggered inputs are latched until read by a call to INor INx. Inputs are reported as active or inactive rather than high or low as the active state ofeach channel is freely configurable.

From Visual Basic, the function is called getIN.

Default:By default each input is configured as level triggered, active high.

Example:/*----------------------------------------------------------------------*//* Read the value from a 16 position thumbwheel switch connected to *//* inputs 5, 6, 7 and 8. *//*----------------------------------------------------------------------*/thumbWheel = (IN () & 0x1E0) >> 5; /* mask bits off and shift down */

See Also:

ActiveInputLevel, InputActiveMode, INx, NegativeEdgeTriggeredInputs, OUT,OUTx, PositiveEdgeTriggeredInputs

Page 197: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 197

INCAPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 setINCA (__uint8 axisNo, float absolute)

Description:Loads an absolute incremental move into the move buffer. When the move is triggered withthe GO function, the axis will accelerate at the ACCEL rate to the slew speed defined bythe SPEED or Feedrate functions. The axis will travel at the slew speed until it starts todecelerate at the DECEL rate, coming to a halt at the requested position.

The end point of the move can be changed at any time by using the INCA or INCRfunctions. This allows the axis to be moved a new position using the standard motiontrapezoid velocity profile. The target of this move can be changed whilst the motion is inprogress, making this move type suitable for when the target position is constantly beingcalculated or updated.

The INCA move will set bit 14 in the MODE function. Motion can be stopped with theSTOP function and will be terminated according to any error condition set up on the axis.

The axis must be IDLE before the move can be loaded. Reading the MOVEA or MOVERfunctions returns the absolute end point of the move. Reading the OFFSET function willreturn the distance left to travel for the move.

If the axis is already at the absolute position specified then no move will be generated.

Parameters:axisNo specifies the axis to set up the move on.

0 <= axisNo < MAX_AXES.

absolute specifies the target position, in user units, to which axisNo is required to move.

MIN_FLOAT <= absolutePosition <= MAX_FLOAT

Restrictions:None.

Default:None.

Page 198: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 198

Example:/*----------------------------------------------------------------------*//* Start a move to position 100. If input 4 becomes active then change *//* target position to 125. *//*----------------------------------------------------------------------*/__uint8 input4;

setINCA (7, 100.0);GO (1, 7);do { getINx (4, &input4);} while (!state);

setINCA (7, 125.0);

See Also:

ACCEL, Feedrate, GO, INCR, MOVEA, MOVER, OFFSET, SPEED, STOP

INCRPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 setINCR (__uint8 axisNo, float absolute)

Description:Loads an relative incremental move into the move buffer. When the move is triggered withthe GO function, the axis will accelerate at the ACCEL rate to the slew speed defined bythe SPEED or Feedrate functions. The axis will travel at the slew speed until it starts todecelerate at the DECEL rate, coming to a halt at the requested position.

The end point of the move can be changed at any time by using the INCA or INCRfunctions. This allows the axis to be moved a new position using the standard motiontrapezoid velocity profile. The target of this move can be changed whilst the motion is inprogress, making this move type suitable for when the target position is constantly beingcalculated or updated.

The INCA move will set bit 14 in the MODE function. Motion can be stopped with theSTOP function and will be terminated according to any error condition set up on the axis.

The axis must be IDLE before the move can be loaded. Reading the MOVEA or MOVERfunctions returns the absolute end point of the move. Reading the OFFSET function willreturn the distance left to travel for the move.

Page 199: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 199

Parameters:axisNo specifies the axis to set up the move on.

0 <= axisNo < MAX_AXES.

absolute specifies the target position, in user units, to which axisNo is required to move.

MIN_FLOAT <= absolutePosition <= MAX_FLOAT

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Start a move to position 100. If input 4 then move the target *//* position 20 back. *//*----------------------------------------------------------------------*/__uint8 input4;

setINCA (7, 100.0);GO (1, 7);

do { getINx (4, &input4);} while (!state);

setINCR (7, -20.0); /* New target is position is 80 user units */

See Also:

ACCEL, Feedrate, GO, INCA, MOVEA, MOVER, OFFSET, SPEED, STOP

initialiseNextMovePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 initialiseNextMove (void)

Description:Initialises NextMove’s data structures, hardware and interrupt system. This function mustbe called before any other MML functions. It will typically be called early within main.

Page 200: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 200

On the host, initialiseNextMove is only available in Immediate Command Mode when inembedded emulation mode. initialiseNextMove will reset the NextMove controller,download an application and run the application.

The application to be downloaded to the NextMove should be an executable COFF file. Itsfull path should be specified with the setProgramPath function.

Parameters:None.

Possible Errors:On NextMove, during initialisation of the system, it is unlikely that any errors would beencountered. The call may return erOUT_OF_MEMORY if you have linked your programwith a very small amount of heap. You should increase the size of the heap if this error isencountered. SystemError structure holds error cause if call fails. See chapter 3.5 for furtherdetails.

Restrictions:This function must be called within an application before any other MINT Motion Libraryfunctions are called.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Simple program main which could run on NextMove or Host. *//*----------------------------------------------------------------------*/#if __TARGET__ == __PC__#define SINGLE_CON#define _NEXTMOVE_PC_ONLY_

#include “host_cif.h”#endif

#include “mg.h”

void main (void){ #if __TARGET__ == __PC__ OCHANDLE hNextMove;

hNextMove = createNextMovePCHandle ( 0, 0x23c ); selectGlobalController( hNextMove ); setProgramPath (“mint.out”);

#endif

Page 201: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 201

initialiseNextMove();}

See Also:

DEFAULT

InputActiveModePC BX Scaled Default Range❏ ❏ - 0 0 - 16777215 PC

0 - 65535 BX

Prototype:__int16 getInputActiveMode (__uint32 *edgeTriggeredInputs)__int16 setInputActiveMode (__uint32 edgeTriggeredInputs)

Description:Sets or returns a bitmap describing which of the user digital inputs should be edge or leveltriggered. Each of the 24 user digital inputs may be configured to be active on a level or anedge. For level triggered inputs the active state is selectable by calling ActiveInputLevel.For edge triggered inputs the input can be configured to become active on positive, negativeor both edges by calling PositiveEdgeTriggeredInputs andNegativeEdgeTriggeredInputs. Edge triggered inputs are latched until read.

Parameters:edgeTriggeredInputs is a bitmap of those user digital inputs which are edge triggered. If abit is:

0 - the input is level triggered.1 - the input is edge triggered.

Restrictions:Although the call does not prevent it you should avoid configuring the home, limit, error andstop inputs as edge triggered.

Default:By default all user inputs are configured as level triggered, active high.

Example:/*----------------------------------------------------------------------*//* Override the default input configuration. We require: *//* inputs | level / edge | trigger condition *//* 0 - 1 | edge | positive edges *//* 2 - 3 | edge | negative edges *//* 4 - 7 | level | input low */

Page 202: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 202

/* 8 - 23 | level | input high *//*----------------------------------------------------------------------*/void configureInputs (void){ setInputActiveMode (0x0F); /* inputs 0-3 edge triggered */ setPositiveEdgeTriggeredInputs (0x03); /* 0 and 1 trigger on +ve edge */ setNegativeEdgeTriggeredInputs (0x0C); /* 2 and 3 trigger on -ve edge */ setActiveInputLevel (0xFFFF0F); /* 4 to 7 active low */}

See Also:

ActiveInputLevel, IN, Inx

integralTermModePC BX Scaled Default Range❏ ❏ - 0 0 - 2

Prototype:__int16 getIntegralTermMode (__uint8 axisNo, __uint8 *mode)__int16 setIntegralTermMode (__uint8 axisNo, __uint8 mode)

Description:Sets or returns a software switch that controls how the servo loop integral term is appliedduring motion.

Parameters:axisNo specifies the axis on which the software switch is to be set or returned.

0 <= axisNo < MAX_AXES.

mode specifies the way in which the servo loop integral gain term is applied. mode may takeone of the following values:

Value Constant Meaning

0 itNEVER The integral term is never applied. (the integrator is grounded).1 ItALWAYS The integral term is always applied. KINT and KINTRANGE

control the effect of the integral term.2 ItSMART The integral term is only applied when the axis demand speed is

constant ie: when the axis is at rest or moving at constant speed.At all other times the integrator is grounded.

Restrictions:The servo loop integral term is only applicable to axes configured as cfSERVO. A call to theCANCEL or RESET functions will zero the integrator.

Page 203: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 203

Default:By default integral term mode is set to itALWAYS.

Example:/*----------------------------------------------------------------------*//* Turn the integral gain off on axis #0. *//*----------------------------------------------------------------------*/setIntegralTermMode (0, itNEVER);

See Also:

KINT, KINTRANGE

INxPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 INx (__uint8 channel, __uint8 *state)

Description:Returns the status of the specified user input channel. There are 24 uncommitted, opto-isolated digital inputs on NextMove PC and 16 inputs on NextMove BX.

Parameters:channel specifies the user input channel whose state is to be read.

0 <= channel < MAX_INPUTS

state holds the state of the specified input channel.

0 - the channel is inactive1 - the channel is active

Restrictions:The inputs are polled at 1 kHz. Edge triggered inputs are latched until read by a call to INor INx. Inputs are reported as active or inactive rather than high or low as the active state ofeach channel is freely configurable.

Default:By default each input is configured as level triggered, active high.

Example:/*----------------------------------------------------------------------*/

Page 204: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 204

/* Wait for a trigger signal from a pushbutton connected to input #13. *//*----------------------------------------------------------------------*/state = 0;while (!state){ INx (13, &state); /* wait for the input to become active */}

See Also:

ActiveInputLevel, InputActiveMode, IN, NegativeEdgeTriggeredInputs,PositiveEdgeTriggeredInputs

Page 205: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 205

JOGPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getJOG (__uint8 axisNo, float *jogSpeed)__int16 setJOG (__uint8 axisNo, float jogSpeed)

Description:Returns the current jogSpeed set on axis axisNo. Sets up a jog move on axis axisNo withspeed and direction (velocity) specified by jogSpeed. A jog move is an infinite positionalmotion (it has no end point) that is executed at jogSpeed user units / second. It is notnecessary to call GO to start the motion. A move of type mdJOG will be placed in the movebuffer.

The velocity of a jog move may be changed at any time by calling JOG with the newdesired velocity. The acceleration and deceleration used during speed changes are those lastset by calls to ACCEL and DECEL respectively. The axis will decelerate and acceleratethrough zero speed if a change in direction is requested. A jog move may be terminated bycalling STOP, CANCEL, RESET or JOG with a jogSpeed of zero.

The jog move is capable of blending. This means that the axis does not have to be idlebefore the move is set up. When the jog move is started, the axis will accelerate ordecelerate from the current velocity to the jogSpeed using the current acceleration anddeceleration rates. Blending cannot be performed from the following move types:

mdHOMINGmdCIRCULARmdLINEAR (VECTORA and VECTORR)

Parameters:axisNo specifies the axis on which the move is to be set up or from which the jogSpeed is tobe read.

0 <= axisNo < MAX_AXES.

jogSpeed specifies the jog speed and direction of the axis.

MIN_FLOAT <= jogSpeed <= MAX_FLOAT. (A positive value means move in apositive direction).

Restrictions:The axis cannot be configured as cfOFF or be in error. The axis must idle of in modemdJOG before a move can be loaded.

Page 206: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 206

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Implement a simple joystick speed control on axis #3. *//* Reads analogue inputs 0 and 1 as bipolar, differential and converts *//* the result to a speed in the range +/- 100 mm/s. No deadband. *//*----------------------------------------------------------------------*/void joyStick (void){ getANALOGUE ( 0, &value ); /* mode of analogue channel set by ADCMode */ value = value * 100 / 2048; setJOG (0, value);}

See Also:

ACCEL, DECEL, MODE

Page 207: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 207

KAccelPC BX Scaled Default Range❏ ❏ - 0 0.0 - 10000.0

Prototype:__int16 getKAccel (__uint8 axisNo, float *accelerationGain)__int16 setKAccel (__uint8 axisNo, float accelerationGain)

Description:Sets the digital servo loop acceleration feed forward gain term. This term is designed toreduce velocity overshoots on high acceleration moves.

Due to the quantisation of the positional data and the speed of the servo loop, for theacceleration feed forward term to affect the servo loop the acceleration of the axis mustexceed 1,000,000 encoder counts/s2.

No acceleration feed forward.

Page 208: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 208

With acceleration feed forward.

Parameters:axisNo specifies the axis on which acceleration feed forward is to apply.

0 <= axisNo < MAX_AXES.

accelerationGain specifies the multiplicative factor used in the servo loop to apply theacceleration feed forward.

0.0 <= accelerationGain <= 10,000.0

RestrictionsDue to the quantisation of the positional data and the speed of the servo loop, for theacceleration feed forward term to affect the servo loop the acceleration of the axis mustexceed 1,000,000 encoder counts/s2.

Example:setKAccel (0, 45.0);

Sets the acceleration feed forward term for axis 0 to be 45.float accelGain;..

Page 209: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 209

getKAccel (0, &accelGain);

gets the acceleration gain on axis 0.

See also:

CURRLIMIT, DerivativeGain, GAIN, integralTermMode, KINT, KVEL, KVELFF

KeypadNodePC BX Scaled Default Range❏ ❏ - - 0 - 63

Prototype:__int16 getKeypadNode (__int16 port, __uint8 *node);__int16 setKeypadNode (__int16 port, __uint8 node);

Description:NextMove has support for up to four KeypadNodes. The KeypadNode keyword is used tospecify the node identifier of the KeypadNode and the channel used to communicate withthis node. Valid channels for keypad nodes are; _tmLCD1, _tmLCD2, _tmLCD3, _tmLCD4.The KeypadNode must previously have been added to the CAN bus using the NodeTypekeyword.

Parameters:port specifies the I/O port via which the keypad will communicate. Valid ports for keypadsare:

Value Constant Meaning

8 tmLCD1 Keypad 116 tmLCD2 Keypad 232 tmLCD3 Keypad 364 tmLCD4 Keypad 4

node specifies the node number of the keypad node.

0 < node < 64

For this function to be successful this node must be live.

Restrictions:Only one keypad node can be assigned to a port at once. If a second keypad node is assignedto a port currently in use then the port is reassigned without warning.

Page 210: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 210

Example:unsigned __int8 i;

setNodeType( 14, ntKEYPAD );do { getNodeLive( 14, &i );} while( &i );setKeypadNode( tmLCD1, 14 );

See also:

NodeType, NodeLive

KINTPC BX Scaled Default Range❏ ❏ - 0 0 - 10000

Prototype:__int16 getKINT (__uint8 axisNo, float *integralGain)__int16 setKINT (__uint8 axisNo, float integralGain)

Description:Sets or returns the servo loop integral gain term for axis axisNo.

Parameters:axisNo specifies the axis on which the integral gain is to be set or returned.

0 <= axisNo < MAX_AXES

integralGain is the servo loop integral gain term.

0 <= integralGain <= 10000

Restrictions:KINT is only applicable to axes configured as cfSERVO.

Default:After power up or a board reset, integral gain is set to zero.

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. *//*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis){ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */

Page 211: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 211

setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enableDrive (axis); /* now enable the drive again */}

See Also:

DerivativeGain, GAIN, integralTermMode, KINTRANGE, KVEL, KVELFF

KINTRANGEPC BX Scaled Default Range❏ ❏ - 100 0 - 100.0

Prototype:__int16 getKINTRANGE (__uint8 axisNo, float *percentage)__int16 setKINTRANGE (__uint8 axisNo, float percentage)

Description:Sets or returns the current value of the integrator range axis axisNo. The maximumcontribution that the integral term may apply to the DAC output is limited to percentage ofthe full scale DAC output.

Parameters:axisNo specifies the axis on which the integration limit is to be set or returned.

0 <= axisNo < MAX_AXES

percentage specifies the maximum voltage that the integral term may contribute to the DACoutput.

0 <= percentage <= 100

Restrictions:The integration limit is only applicable to axes configured as cfSERVO.

Default:After power up or a board reset, the integration limit is set to 100%.

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. *//*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis)

Page 212: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 212

{ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */ setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enableDrive (axis); /* now enable the drive again */}

See Also:

CURRLIMIT, DerivativeGain, GAIN, integralTermMode, KINT, KVEL, KVELFF

KVELPC BX Scaled Default Range❏ ❏ - 0 0 - 10000

Prototype:__int16 getKVEL (__uint8 axisNo, float *velocityFeedbackGain)__int16 setKVEL (__uint8 axisNo, float velocityFeedbackGain)

Description:Sets or returns the servo loop velocity feedback gain on axis axisNo.

Parameters:axisNo specifies the axis on which the servo loop velocity feedback gain is to be set orreturned.

0 <= axisNo < MAX_AXES

velocityFeedbackGain specifies the servo loop velocity feedback gain applied to axisaxisNo.

0 <= velocityFeedbackGain <= 10000

Restrictions:Velocity feedback gain is only applicable to axes configured as cfSERVO.

Default:After power up or a board reset, the velocity feedback gain is set to zero.

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. */

Page 213: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 213

/*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis){ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */ setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enableDrive (axis); /* now enable the drive again */}

See Also:

DerivativeGain, GAIN, integralTermMode, KINT, KVELFF

KVELFFPC BX Scaled Default Range❏ ❏ - 0 0 - 10000

Prototype:__int16 getKVELFF (__uint8 axisNo, float *velocityFeedforwardGain)__int16 setKVELFF (__uint8 axisNo, float velocityFeedforwardGain)

Description:Sets or returns the servo loop velocity feedforward gain on axis axisNo.

Parameters:axisNo specifies the axis on which the servo loop velocity feedforward is to be set orreturned.

0 <= axisNo < MAX_AXES

velocityFeedforwardGain specifies the servo loop velocity feedforward gain applied to axisaxisNo.

0 <= velocityFeedforwardGain < 10000

Restrictions:Velocity feedforward gain is only applicable to axes configured as cfSERVO.

Default:After power up or a board reset, velocity feedforward gain is set to zero.

Page 214: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 214

Example:/*----------------------------------------------------------------------*//* Setup axis gains on a specified axis. Disable while changing. *//*----------------------------------------------------------------------*/void setupSystemGains (__uint8 axis){ if (axis > 3) return; /* only set up servo axes */ disableDrive (axis); /* disable the drive for safety */ setGAIN (axis, 2); /* set the proportional gain */ setDerivativeGain (axis, 0); /* set the derivative gain */ setKVEL (axis, 80); /* set the velocity feedback gain */ setKVELFF (axis, 80); /* set the velocity feedforward gain */ setKINT (axis, 0); /* set the integral gain */ setKINTRANGE (axis, 25); /* limit integral term to 25% */ enableDrive (axis); /* now enable the drive again */}

See Also:

DerivativeGain, GAIN, integralTermMode, KINT, KVEL

Page 215: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 215

LastMoveBufferIDPC BX Scaled Default Range❏ ❏ - 0 1 - 65535

Prototype:__int16 getLastMoveBufferID (__uint8 axisNo, __uint16 *identifier)

Description:When a move is loaded into the move buffer, it is possible to give that move an identifierwith the MoveBufferID function. Reading the MoveBufferID function will return theidentifier of the currently executing move in the buffer. When the axis is idle or performingan unsupported move type, the identifier is zero. The LastMoveBufferID function allowsthe identifier of the previously executed move to read, even if no move is in progress.

An identifier can be used with the following move types:

mdLINEARmdCIRCULARmdFLY

Parameters:axisNo specifies the axis on which the number of free move buffer spaces is to read.

0 <= axisNo < MAX_AXES.

identifier specifies the 16 bit identifier.

1 <= identifier <= 65535

If there is no move in the move buffer, or the move is not one of the supported move types,then the identifier will return zero.

Restrictions:None.

Default:If there is no move in the buffer, then the identifier will return zero. The default value of theidentifier is zero.

Example:/*----------------------------------------------------------------------*//* Load a number of moves into the buffer. When the third move begins, *//* turn on output 4. *//*----------------------------------------------------------------------*/__uint16 id;

Page 216: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 216

setMoveBufferID(0, 1); /* ID of 1 */setVECTORR(2, 0, 20, 1, 20); /* vector on axes 0 and 1 */GO(1, 0); /* start the move */setMoveBufferID(0, 2);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);setMoveBufferID(0, 3);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);setMoveBufferID(0, 4);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);do { getMoveBufferID (0, &id); /* wait until id = 3 */} while (id != 3)setOUT(4, 1); /* turn output 4 on */

See Also:

MoveBufferFree, MoveBufferSize, MoveBufferStatus

LIMITFPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 getLIMITF (__uint8 axisNo, __uint8 *state)

Description:Returns the state of the forward end of travel limit switch on axis axisNo. The digital inputcan be assigned as an axis limit switch with the ForwardLimitSwitchInput function. Theactive state of the input is freely programmable. An asynchronous error can be generatedwhen the limit switch is activated.

Parameters:axisNo specifies the axis on which the limit switch state is to be returned.

0 <= axisNo < MAX_AXES.

state is the current state of the forward end of travel limit switch input.

0 - the input is inactive or no forward limit switch input specified.1 - the input is active.

Restrictions:None.

Page 217: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 217

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Disable error reporting and default action on limits on axis #3. *//* Provide a function that polls the state of both limits. *//*----------------------------------------------------------------------*/void checkLimits (void){ statef = 0; stater = 0; getLIMITF( 3, &statef); getLIMITR( 3, &stater); state = statef | stater; setOUTx (7, state); /* output #7 shows either active*/}void main (void){ setErrorMask (3, 0); /* Don’t call error handler */ setHardwareLimitMode (3,hlIGNORE); /* Ignore hardware limits on axis 3 */}

See Also:

AsyncError, ForwardLimitSwitchInput, ForwardSoftwareLimit,HardwareLimitMode, LIMITR, ReverseLimitSwitchInput, ReverseSoftwareLimit,SoftwareLimitMode

LIMITRPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 LIMITR (__uint8 axisNo, __uint8 *state)

Description:Returns the state of the reverse end of travel limit switch on axis axisNo. The digital inputcan be assigned as an axis limit switch with the ReverseLimitSwitchInput function. Theactive state of the input is freely programmable. An asynchronous error can be generatedwhen the limit switch is activated.

Parameters:axisNo specifies the axis on which the limit switch state is to be returned.

0 <= axisNo < MAX_AXES.

Page 218: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 218

state is the current state of the reverse end of travel limit switch input.

0 - the input is inactive or no reverse limit switch input specified.1 - the input is active.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Portion of error handler *//* Limit error signalled. Jog axis off limit until limit switch no *//* longer active. *//*----------------------------------------------------------------------*/__uint8 state;

if (ERROR.2 & erREV_HARD_LIMIT) { /* Reverse limit hit */ STOP (2); /* Stop any move in progress */ do { getIDLE (2, &state); /* Wait until idle */ } while (!state); setJOG (2, 10); /* Jog away from limit */ do { getLIMITR (2, &state); /* Wait until limit inactive */} while (state); STOP (2); /* Stop jogging */

See Also:

AsyncError, ForwardLimitSwitchInput, ForwardSoftwareLimit,HardwareLimitMode, LIMITF, ReverseLimitSwitchInput, ReverseSoftwareLimit,SoftwareLimitMode

LongPC BX Scaled Default Range❏ - - -8388607 - 8388607

Prototype:__int16 getLong (__int16 address, __int32 *value)__int16 putLong (__int16 address, __int32 value)

Page 219: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 219

Description:Allows a signed 32 bit number to be read or written to dual port RAM. Dual port RAM issplit into a number of areas for different purposes. There are some areas spare for user datatransfer. Two locations are used since DPR is 16 bits wide. See the ‘MINT InterfaceLibrary Users Guide’ for details on dual port RAM usage.

Parameters:address specifies the dual port RAM offset.

0 <= address < 0x3FF

value is the value to be written or read from dual port RAM.

MIN_FLOAT <= value <= MAX_FLOAT

Restrictions:Some areas should not be changed manually. See the ‘MINT Interface Library Users Guide’for details on dual port RAM usage.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Write the contents of an array, tolerances[10], to 0x200 *//*----------------------------------------------------------------------*/for (count = 0; count < 10; count++) { putLong (0x200 + 2 * count, tolerances[count]);}

See Also:

Comms, Float, Uint, Word

LOOPTIMEPC BX Scaled Default Range❏ ❏ - 1000 500, 1000

Prototype:__int16 getLOOPTIME (__uint16 *microSeconds)__int16 setLOOPTIME (__uint16 microSeconds)

Page 220: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 220

Description:Sets the servo loop closure period to one of three pre-defined values. The servo algorithm isapplied to all servo axes on a periodic basis. The regularity and frequency of this algorithmaffects the performance of the servo drives. The servo loop can be closed every 1000µs or500µs. Generally speaking, only very high performance servo drives actually require thehigh frequency loop closure. The more often the loops are closed in a given period the lessprocessor time is available for the application program code.

The get function returns the current loop closure period.

Parameters:microSeconds specifies the loop closure time in micro seconds. This may take one of thesevalues: 500, 1000.

Restrictions:User code executes slower at the high servo loop frequencies.

Default:The default servo loop period is 1000µs.

Example:/*----------------------------------------------------------------------*//* Decrease the servo loop period to 500µs. *//*----------------------------------------------------------------------*/setLOOPTIME (500);

Page 221: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 221

MasterChannelPC BX Scaled Default Range❏ ❏ - 0 0 - 7 PC

0 - 3 BX

Prototype:__int16 getMasterChannel (__uint8 axisNo, __uint8 *channel);__int16 setMasterChannel (__uint8 axisNo, __uint8 channel);

Description:MasterChannel is used in conjunction with MasterSource to define the master positionreference for gearing moves, Cam, FLY and FOLLOW.

Parameters:axisNo is the axis to set the master channel on.

0 <= axisNo <= MAX_AXES

channel is the channel to follow. The range varies according to the master source value.

Restrictions:If the MasterSource is changed, the MasterChannel will be reset to its default value.

Default:The default values are as follows:

MasterSource Constant Default MasterChannel

msPOS 0msENCODER 0

msAUXENCODER 0msVIRTUAL The MasterSource axismsDEMAND 0

Example:/*----------------------------------------------------------------------*//* Follow axis 3 demand velocity on axis 6 *//*----------------------------------------------------------------------*/setMasterSource (6, msDEMAND);setMasterChannel (6, 3);

See Also:

FOLLOW, FLY, MasterSource

Page 222: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 222

MasterDistancePC BX Scaled Default Range❏ ❏ ❏ 1 -8388607.0 - 8388607.0

Prototype:__int16 getMasterDistance (unsigned __int8 axisNo, float *masterDistance)__int16 setMasterDistance (unsigned __int8 axisNo, float masterDistance)

Description:Sets or returns the segment distance that a master axis must travel over for a mdFLY ormdCAM move. Flying shears and Cam profiles are specified in terms of segments. Thisvalue specifies how far the master axis must travel in order to complete a slave axissegment. The master axis is set using the MasterSource and MasterChannel functions.The master distance is specified in user units of the master axis. Consequently, the masteraxis and the master axis scale factor should be specified before setting the master distance.

Parameters:axisNo specifies the axis on which the master increment is being specified.

0 <= axisNo < MAX_AXES.

masterDistance is the master distance length in user units.

MIN_FLOAT <= masterDistance <= MAX_FLOAT

masterDistance cannot be equal to zero.

Restrictions:The masterDistance cannot be set to zero.

Default:The default master distance is 1.

Example:/*----------------------------------------------------------------------*//* Set up a flying shear on axis 0. The master axis is axis 1. Each *//* FLY segment will take 10 master axis revs to complete. *//*----------------------------------------------------------------------*/setMasterSource (0, msPOS); /* Follow master position */setMasterChannel (0, 1); /* Axis 0 to follow axis 1 */setMasterdistance (0, 10); /* Master distance of 10 revs */setFLY (0, 5); /* Accelerate to 1:1 ratio */GO (1, 0);setFLY (0, 10); /* 1:1 ratio for one segment */GO (1, 0);setFLY (0, 5); /* Decelerate to rest */GO (1, 0);

Page 223: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 223

See Also:

Cam, FLY, MasterChannel, MasterSource

MASTERINCThis function has been replaced with the MasterDistance function.

MasterSourcePC BX Scaled Default Range❏ ❏ - 0 0 - 4

Prototype:__int16 getMasterSource (__uint8 axisNo, __uint8 *source);__int16 setMasterSource (__uint8 axisNo, __uint8 source);

Description:MasterSource is used to define the master position source for gearing moves, Cam, FLYand FOLLOW.

When the MasterSource is changed, MasterChannel is set to its default value.

MasterChannel and MasterSource replace the FOLLOWAXIS function.

Parameters:axisNo is the axis to set the master channel on.

0 <= axisNo <= MAX_AXES

source is the source for the master reference, accepting one of the following values:

Value Constant Function

0 msPOS Use an axis position as the master reference. If themaster axis is configured as off, then usemsENCODER.

1 msENCODER Use an axis encoder value as the master reference.2 msAUXENCODER Use the auxiliary encoder channel as the master

reference.3 msVIRTUAL Use a virtual axis as the master reference. The

master speed is set by writing to SPEED on the

Page 224: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 224

Value Constant Function

master channel..4 msDEMAND Use an axis demand velocity as the master

reference.

Restrictions:If the MasterSource is changed, the MasterChannel will be reset to its default value.

Default:The default source is msPOS.

Example:/*----------------------------------------------------------------------*//* Follow axis 3 demand velocity on axis 6 *//*----------------------------------------------------------------------*/setMasterSource (6, msDEMAND);setMasterChannel (6, 3);

See Also:

FOLLOW, FLY, MasterSource

MaxAnaloguePC BX Scaled Default Range❏ ❏ - 4095 -2047 - 4095

Prototype:__int16 getMaxAnalogue (__uint8 channel, __int16 *value)__int16 setMaxAnalogue (__uint8 channel, __int16 value)

Description:It is possible to attach limit values to analog input channels such that if those limits areexceeded, an error is generated. Analog channels can be associated with one or more axessuch that when and analog error occurs, asynchronous errors will be generated on allassociated axes.

This function sets or returns the upper analog limit value for a channel. If the analog valueof the channel exceeds this limit value, an error condition will be generated on all attachedaxes.

Upper and lower analog limits are set on an analog channel using the MaxAnalogue andMinAnalogue functions. Channels are associated with an axis using MonitorChannels andthe ADCError function is used to see which channels and limits are in error.

Page 225: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 225

Parameters:channel specifies the analog input channel on which to set the upper limit value.

0 <= channel <= MAX_ADCS

Analog input channels can return a value within one of two ranges, depending upon themode of the channel set with the ADCMode function. The upper limit that can be setdepends on the mode of the channel as follows:

For bipolar channels, -2047 <= value <= 2047For unipolar channels, 1 <= value <= 4095

The upper limit value must also be greater than the lower limit value, read using theMinAnalogue function.

Restrictions:The upper limit cannot be changed on a channel that is configured as being turned acOFF.

Default:The default upper limit value is 4095.

Example:/*----------------------------------------------------------------------*//* Set the upper and lower limits of channel 0 to be 100 and 1000 *//* Attach channel 0 to axes 4 and 7 *//*----------------------------------------------------------------------*/setMaxAnalogue (0, 1000);setMinAnalogue (0, 100);setMonitorChannels (4, 1); /* Bit map of channels */setMonitorChannels (7, 1); /* Bit map of channels */

See Also:

ADCError, ADCMode, AsyncError, ErrorMask, MinAnalogue, MonitorChannels

MaximumSpeedPC BX Scaled Default Range❏ ❏ ❏ 0 0 - 8388607.0

Prototype:__int16 getMaximumSpeed (__uint8 axisNo, float *speed)__int16 setMaximumSpeed (__uint8 axisNo, float speed)

Page 226: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 226

Description:With the use of FeedrateOverride and performing interpolated moves at a given pathspeed, it is possible to demand velocities from an axis above the value set with the SPEEDor Feedrate functions. The MaximumSpeed function allows a maximum speed to be setfor an axis. This maximum speed will be used by the following move types:

mdCIRCULARmdFOLLOW (velocity mode only)mdHOMINGmdINCREMENTmdJOGmdLINEAR

The axis speed will be limited to approximately the maximum speed. If the maximum speedis reached, motion will continue and a warning will be indicted in the AxisStatus function.Bit 15 will be set (constant: erMAX_SPEED). When the demand speed falls below themaximum speed, the status bit will be cleared.

In the case of multi axis moves, vectors and circles, only the maximum speed for master axisis used and this is taken to be the maximum path speed allowed. In the situation of axeshaving different maximum speeds, the slowest should be used for the master axis.

Setting a value of 0 turns off maximum speed checking.

Parameters:axisNo specifies the axis on which the speed is to be set or returned.

0 <= axisNo < MAX_AXES.

speed is the maximum speed applied to the axis.

0 <= speed < MAX_FLOAT.

Restrictions:None.

Default:The default value is 0, turning off checking.

Example:/*----------------------------------------------------------------------*//* Limit axis speed on axes 0 and 1 to 150 mm/s *//*----------------------------------------------------------------------*/setSPEED (0, 120.0); /* Path speed for interpolated moves */setMaximumSpeed (0, 150.0); /* Maximum axis speed */

Page 227: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 227

setMaximumSpeed (1, 150.0); /* Maximum axis speed */setFeedrateMode (0, frFEEDRATE + frOVERRIDEENABLE);

See Also:

AxisStatus, Feedrate, FeedrateOverride, SPEED

MFOLERRPC BX Scaled Default Range❏ ❏ ❏ 16000 0 - 8388607.0

Prototype:__int16 getMFOLERR (__uint8 axisNo, float *followingErrorLimit)__int16 setMFOLERR (__uint8 axisNo, float followingErrorLimit)

Description:Sets or returns the maximum following error that servo axis axisNo may experience beforean error is reported. Following error is the difference between the demand position (whereyou want to be) and the measured axis position. If the following error exceeds the value setby MFOLERR the axis has exceeded its following error limit and an error condition will besignalled. This will generate an error according to the default action mode set withFEMode. The instantaneous following error may be read by calling FOLERR. Monitoringthe following error is useful when tuning a servo system.

Parameters:axisNo specifies the axis on which the following error limit is to be set or returned.

0 <= axisNo < MAX_AXES

followingErrorLimit specifies the maximum following error, in user units, that axisNo mayexperience before an error is generated.

0 < followingErrorLimit < MAX_FLOAT

Restrictions:Following error limit is only applicable to axes configured as cfSERVO.

Default:Servo axes: 16,000 encoder edges.

Example:/*----------------------------------------------------------------------*//* Move axis #0 and log the maximum following error during motion. *//*----------------------------------------------------------------------*/float maxFE; /* global will store max. value */

Page 228: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 228

void getMaxFollowingError (void){ float fe;

maxFE = 0; /* set initial max value to zero */ setMOVER (0, 1000); /* start move on axis #0 */ GO (1, 0); state = 0; while (!state) { getIDLE (0, &state); /* wait for the move to complete */ getFOLERR (0, &fe); /* get the following error */ if (fe < 0) fe = -fe; /* if its -ve make it +ve */ if (fe > maxFE) maxFE = fe; /* save the largest value read */ }}

See Also:

AsyncError, ERROR, ErrorHandler, ErrorMask, FEMode, FOLERR

MinAnaloguePC BX Scaled Default Range❏ ❏ - -2047 -2047 - 4095

Prototype:__int16 getMinAnalogue (__uint8 channel, __int16 *value)__int16 setMinAnalogue (__uint8 channel, __int16 value)

Description:It is possible to attach limit values to analog input channels such that if those limits areexceeded, an error is generated. Analog channels can be associated with one or more axessuch that when and analog error occurs, asynchronous errors will be generated on allassociated axes.

This function sets or returns the lower analog limit value for a channel. If the analog valueof the channel exceeds this limit value, an error condition will be generated on all attachedaxes.

Upper and lower analog limits are set on an analog channel using the MaxAnalogue andMinAnalogue functions. Channels are associated with an axis using MonitorChannels andthe ADCError function is used to see which channels and limits are in error.

Parameters:channel specifies the analog input channel on which to set the lower limit value.

0 <= channel <= MAX_ADCS

Page 229: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 229

Analog input channels can return a value within one of two ranges, depending upon themode of the channel set with the ADCMode function. The upper limit that can be setdepends on the mode of the channel as follows:

For bipolar channels, -2047 <= value <= 2047For unipolar channels, 1 <= value <= 4095

The lower limit value must also be less than the upper limit value, read using theMaxAnalogue function.

Restrictions:The lower limit cannot be changed on a channel that is configured as being turned acOFF.

Default:The default lower limit value is -2047.

Example:/*----------------------------------------------------------------------*//* Set the upper and lower limits of channel 3 and 7 to be -200 and 110 *//* Attach channels to axes 2 *//*----------------------------------------------------------------------*/setMaxAnalogue (3, 110);setMinAnalogue (3, -200);setMaxAnalogue (7, 110);setMinAnalogue (7, -200);setMonitorChannels (2, 0x88); /* Bit map of channels */

See Also:

ADCError, ADCMode, AsyncError, ErrorMask, MaxAnalogue, MonitorChannels

MODEPC BX Scaled Default Range❏ ❏ - - 0 - 16384

Prototype:__int16 getMODE (__uint8 axisNo, __uint32 *modeOfMotion)

Description:Returns the current mode of motion on axis axisNo. MODE describes the move generatedby the profiler. When a move theoretically finishes however, the axis may still be movingdue to the recovery of following error. The IDLE function should be checked to see if anaxis has finished moving.

Page 230: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 230

Parameters:axisNo specifies the axis whose mode of motion should be returned.

0 <= axisNo < MAX_AXES

modeOfMotion returns the current mode of motion on axisNo.

Bit Constant Meaning

0 mdIDLE Axis is idle (value = 0)0 mdSERVO_OFF Axis is turned off1 mdLINEAR Axis is performing a linear move2 mdJOG Axis is performing a constant velocity move3 mdCIRCULAR Axis is performing a circular move4 mdTORQUE Axis is in torque mode5 mdHOMING Axis is homing6 mdOFFSET Axis is performing a linear offset7 mdFOLLOW Axis is in follow mode8 mdHTA Axis is performing a Hold To Analogue move9 mdFLY Axis is performing a flying shear10 mdCAM Axis is performing a Cam profile11 mdSPLINE Axis is performing a SPLINE move12 mdMSPLINE Axis is performing a MoveSPLINE move14 mdINCREMENT Axis is performing an Increment move

These constants are assigned values that may be combined using bitwise OR. The modemay contain more than one of these constants. For example, in the case of an OFFSETmove superimposed upon FOLLOW mode the return value would be:

mdFOLLOW | mdOFFSET

Restrictions:None.

Default:By default all axes are idle (mdIDLE).

Example:/*----------------------------------------------------------------------*//* Selectively cancel motion on axis #1. *//*----------------------------------------------------------------------*/modeofmotion = 0;getMODE ( 1, &modeofmotion);if (modeofmotion & mdTORQUE) CANCEL (1); /* only cancel torque mode */

Page 231: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 231

See Also:

Cam, CIRCLEA, CIRCLER, FLY, FOLLOW, GO, JOG, HoldToAnalogue, HOME,MOVEA, MoveBufferFree, MoveBufferSize, MOVER, MoveSPLINE,okToLoadMove, SPLINE, TORQUE, VECTORA, VECTORR

MonitorChannelsPC BX Scaled Default Range❏ ❏ - 0 0 - 255

Prototype:__int16 getMonitorChannels (__uint8 axisNo, __uint32 *monitorChannels)__int16 setMonitorChannels (__uint8 axisNo, __uint32 monitorChannels)

Description:It is possible to attach limit values to analog input channels such that if those limits areexceeded, an error is generated. Analog channels can be associated with one or more axessuch that when and analog error occurs, asynchronous errors will be generated on allassociated axes.

This function sets or returns the channels currently associated to the specified axis. If any ofthe attached channels exceeds the limit values set for that channel, an erADC_ERROR willbe shown on the axis. The ADCError function can be used to determine the source of theerror. The ErrorMask function controls if an error will call the user defined error handler.

Upper and lower analog limits are set on an analog channel using the MaxAnalogue andMinAnalogue functions.

Parameters:axisNo specifies the axis from which to set or return the attached channel bit map.

0 <= axisNo < MAX_AXES.

monitorChannels is a bit map of attached channels as shown below.

Bit Meaning

0 Analog channel 0.1 Analog channel 1.2 Analog channel 2.3 Analog channel 3.4 Analog channel 4.5 Analog channel 5.

Page 232: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 232

Bit Meaning

6 Analog channel 6.7 Analog channel 7.

Restrictions:Detaching a channel which has exceeded its limits will not clear an error on the axis.Analog errors cannot be prevented once a channel is attached to an axis.

Default:By default there are no attached channels.

Example:/*----------------------------------------------------------------------*//* Add channels 1,5 and 7 to the attached channels on axis 1. If IN1 *//* is active then detach channel 0 from axis 1 *//*----------------------------------------------------------------------*/__uint32 attached;__uint8 state;

getMonitorChannels (1, &attached); /* Read current attached list */setMonitorChannels (1, attached | 162); /* Add channels 1,5,7 */

getINx (1, &state); /* Read digital input 1 */if (state) { getMonitorChannels (1, &attached); /* Read current attached list */ setMonitorChannels (1, attached & 0xFE); /* Detach channel 0 */}

See Also:

ADCError, MaxAnalogue, MinAnalogue

MOVEAPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getMOVEA (__uint8 axisNo, float *targetPosition)__int16 setMOVEA (__uint8 axisNo, float absolutePosition)

Description:Returns the absolute target position of the current move, in user units, from axis axisNo.

Sets up a positional move to an absolute position on a single axis. After a successful call toMOVEA, axisNo will have a move pending. The move will not execute until triggered by acall to GO. The move loaded in the move buffer will be of type mdLINEAR.

Page 233: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 233

If the current move has no target position, such as for a JOG, then getMOVEA will returnthe starting point of current move.

Parameters:axisNo specifies the axis from which the target position is to be returned or upon which apositional move is to be set up.

0 <= axisNo < MAX_AXES.

absolutePosition specifies the target position, in user units, to which axisNo is required tomove.

MIN_FLOAT <= absolutePosition <= MAX_FLOATtargetPosition returns the target position of the current move in user units.

MIN_FLOAT <= targetPosition <= MAX_FLOAT

Restrictions:If axisNo is already at absolutePosition no move will be generated. setMOVEA will waitfor a free slot in the move buffer. To avoid the call hanging you should test for a free slotprior to calling setMOVEA by calling okToLoadMove. The axis cannot be configured ascfOFF, be in error, or have a move type other than mdIDLE or mdLINEAR already loaded.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Move axis #0 to absolute position 1023.8 *//*----------------------------------------------------------------------*/while (!okToLoadMove (1, 0)); /* wait for a free slot in the move buffer*/setMOVEA (0, 1023.8); /* set up the move and.. */GO (1, 0); /* trigger it. */

See Also:

GO, IDLE, MOVER, okToLoadMove, VECTORA, VECTORR

MoveBufferFreePC BX Scaled Default Range❏ ❏ - 2 2 - 100

Prototype:__int16 getMoveBufferFree (__uint8 axisNo, __uint8 *numberFreeSpaces)

Page 234: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 234

Description:Each axis maintains a data structure into which moves are loaded. The size of this bufferand hence the number of moves that can be loaded at any time can be configured to suit yourapplication requirements.

If the buffer is full and an attempt is made to load a valid move type, program execution willwait until a free slot in the buffer becomes available. If the moves in the buffer require aGO in order to start, NextMove will hang in that state.

This situation can be avoided by testing to see if the buffer is full with the okToLoadMovefunction or by installing a user defined idle handler.

Another way is to call this function which returns the number of free spaces left in the movebuffer for the specified axis. If no moves are loaded then the number of free moves will bethe buffer size. As moves are loaded, the number of free spaces will decrease to zero,indicating that the buffer is full.

The only exception to this is when following. A move of type mdFOLLOW will not appearas if it is occupying a buffer space if the number of free spaces is read. This is because ofthe way that following can be combined with offset moves, which take up buffer spaces asnormal.

Parameters:axisNo specifies the axis on which the number of free move buffer spaces is to read.

0 <= axisNo < MAX_AXES.

NumberFreeSpaces specifies the number of free move buffer spaces.

2 <= numberOfMoves <= 100

Restrictions:None.

Default:Each axis has a default move buffer size of 2 moves (the minimum permitted). This is thenumber of free buffer spaces at startup. The number of free spaces is also available in DualPort RAM.

Example:/*----------------------------------------------------------------------*//* A flying shear is being performed that consists of many small *//* segments. There are 30 spaces in the move buffer. Whenever there *//* are less than 5 moves left (free spaces > 25) then load more segments*//*----------------------------------------------------------------------*/void checkSpace (__uint8 axisNo);

Page 235: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 235

{ __uint8 freeSpaces;

getMoveBufferFree ( axisNo, &freeSpaces ); /* Get no. spaces */ if (freeSpaces >= 25) loadSegments (axisNo); /* Load more segments */}

See Also:

GO, IDLE, IdleHandler, MoveBufferSize, okToLoadMove

MoveBufferIDPC BX Scaled Default Range❏ ❏ - 0 1 - 65535

Prototype:__int16 getMoveBufferID (__uint8 axisNo, __uint16 *identifier)__int16 setMoveBufferID (__uint8 axisNo, __uint16 identifier)

Description:To attach or read back a 16 bit identifier from the move buffer. When a move is loaded intothe move buffer, it is possible to give that move an identifier with the MoveBufferIDfunction. Reading the function returns the identifier of the currently executing move in themove buffer. This allows a number of moves to be loaded into the buffer in advance and beable to keep track of which move is currently executing.

An identifier can be used with the following move types:

mdLINEARmdCIRCULAR

Parameters:axisNo specifies the axis on which the number of free move buffer spaces is to read.

0 <= axisNo < MAX_AXES.

identifier specifies the 16bit identifier.

1 <= identifier <= 65535

If there is no move in the move buffer, or the move is not one of the supported move types,then the identifier will return zero.

Restrictions:None.

Page 236: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 236

Default:If there is no move in the buffer, then the identifier will return zero. The default value of theidentifier is zero.

Example:/*----------------------------------------------------------------------*//* Load a number of moves into the buffer. When the third move begins, *//* turn on output 4. *//*----------------------------------------------------------------------*/__uint16 id;

setMoveBufferID(0, 1); /* ID of 1 */setVECTORR(2, 0, 20, 1, 20); /* vector on axes 0 and 1 */GO(1, 0); /* start the move */setMoveBufferID(0, 2);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);setMoveBufferID(0, 3);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);setMoveBufferID(0, 4);setVECTORR(2, 0, 20, 1, 20);GO(1, 0);do { getMoveBufferID (0, &id); /* wait until id = 3 */} while (id != 3)setOUT(4, 1); /* turn output 4 on */

See Also:

MoveBufferFree, MoveBufferSize, MoveBufferStatus

MoveBufferSizePC BX Scaled Default Range❏ ❏ - 2 2 - 100

Prototype:__int16 getMoveBufferSize (__uint8 axisNo, __uint8 *numberOfMoves)__int16 setMoveBufferSize (__uint8 axisNo, __uint8 numberOfMoves)

Description:Each axis maintains a data structure into which moves are loaded. The size of this bufferand hence the number of moves that can be loaded at any time can be configured to suit yourapplication requirements. The maximum number of multi-axis moves that can be loaded islimited by the axis with the smallest move buffer. Move buffers are allocated from the heap.If your application requires large move buffers you should ensure that your program islinked with adequate heap.

Page 237: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 237

Some move types have restrictions on what move types can be in the buffer when a move isloaded. If the buffer is full and an attempt is made to load a valid move type, programexecution will wait until a free slot in the buffer becomes available. If the moves in thebuffer require a GO in order to start, NextMove will hang in that state. This situation canbe avoided by testing to see if the buffer is full with the okToLoadMove function or byinstalling a user defined idle handler. The number of remaining free spaces in the movebuffer can be read using the MoveBufferFree function.

This function sets or returns the size of the move buffer allocated on axis axisNo.

Parameters:axisNo specifies the axis on which the move buffer size is to be set or returned.

0 <= axisNo < MAX_AXES.

numberOfMoves specifies the size of the move buffer.

2 <= numberOfMoves <= 100

Restrictions:The axis must be configured as cfOFF before calling setMoveBufferSize.

Default:Each axis has a default move buffer size of 2 moves (the minimum permitted).

Example:/*----------------------------------------------------------------------*//* An x-y plotter is driven by two servo motors. It is required to *//* execute contoured moves constructed from many short vectors. A large*//* move buffer is required to prevent deceleration at way points. *//*----------------------------------------------------------------------*/setCONFIG (0, cfOFF); /* turn axes off before changing */setCONFIG (1, cfOFF); /* move buffer size */if (setMoveBufferSize (0, 100) || setMoveBufferSize (1, 100)) { /* if either allocation fails.. */ errorAllocatingBuffers (); /* signal the failure */}

See Also:

GO, IDLE, IdleHandler, MoveBufferFree, okToLoadMove

Page 238: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 238

MoveBufferStatusPC BX Scaled Default Range❏ ❏ - 8 0 - 55

Prototype:__int16 getMoveBufferStatus (__uint8 axisNo, __uint8 *status)

Description:Returns information about a move buffer. It is possible to load moves into the move bufferwith different execution parameters. The MoveBufferStatus function allows informationabout the currently executing move to be read.

Parameters:axisNo specifies the axis on which the number of free move buffer spaces is to read.

0 <= axisNo < MAX_AXES.

status is a bit pattern holding information about the current move buffer move.

Bit Meaning

0 Set: the current move was loaded in ‘feedrate mode’.Not set: the current move was loaded in ‘speed mode’.

1 Set: the current move has FeedrateOverride enabled.Not set: the current move has FeedrateOverride disabled.

2 Set: the current move has contouring turned on.Not set: the current move has contouring turned off.

3 The move buffer is empty4 The move buffer is full5 The move in the buffer is paused and at rest.

If there is no move currently loaded in the move buffer then the status value will be 8. Bits3 and 4 are mutually exclusive.

Restrictions:None.

Default:If there is no move in the buffer, the default status will be 8; the move buffer is empty.

Example:/*----------------------------------------------------------------------*/

Page 239: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 239

/* If the current move is a fast traverse ( feedrate mode and feedrate *//* override disabled ) then turn on output 11 as an indicator. *//*----------------------------------------------------------------------*/void checkFastTraverse (__uint8 axis){ __uint8 status;

getMoveBufferStatus (axis, &status); if (status & (frFEEDRATE + frOVERRIDEENABLE) == frFEEDRATE) { setOUTx (11, 1); }}

See Also:

CONTON, CONTOFF, FeedrateMode, FeedrateOverride, MoveBufferFree,MoveBufferID, MoveBufferSize

MOVERPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getMOVER (__uint8 axisNo, float *targetPosition)__int16 setMOVER (__uint8 axisNo, float relativePosition)

Description:Returns the absolute target position of the current move, in user units, from axis axisNo.

Sets up a positional move to a relative position. After a successful call to MOVER axisNowill have a move pending. The move will not execute until triggered by a call to GO. Themove loaded in the move buffer will be of type mdLINEAR.

If the current move has no target position, such as for a JOG, then getMOVER will returnthe starting point of current move.

Parameters:axisNo specifies the axis from which the target position is to be returned or upon which apositional move is to be set up.

0 <= axisNo < MAX_AXES.

relativePosition specifies the move length and direction, in user units, by which axisNo isrequired to move.

MIN_FLOAT <= relativePosition <= MAX_FLOAT

targetPosition returns the target position of the current move in user units.

Page 240: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 240

MIN_FLOAT <= targetPosition <= MAX_FLOAT

Restrictions:If relativePosition is zero no move will be generated. setMOVER will wait for a free slotin the move buffer. To avoid the call hanging you should test for a free slot prior to callingsetMOVER by calling okToLoadMove. The axis cannot be configured as cfOFF, be inerror, or have a move type other than mdIDLE or mdLINEAR already loaded.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Move axis #0 -863 mm from its last target position. *//*----------------------------------------------------------------------*/while (okToLoadMove (1, 0)); /* wait for a free slot in the move buffer*/setMOVER (0, -863); /* set up the move and.. */GO (1, 0); /* trigger it. */

See Also:

GO, IDLE, MOVEA, okToLoadMove, VECTORA, VECTORR

MoveSPLINEThis function has temporarily been removed.

Page 241: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 241

NegativeEdgeTriggeredInputsPC BX Scaled Default Range❏ ❏ - 16777215 PC

65535 BX0 - 16777215 PC

0 - 65535 BX

Prototype:__int16 getNegativeEdgeTriggeredInputs (__uint32 *negativeEdges)__int16 setNegativeEdgeTriggeredInputs (__uint32 negativeEdges)

Description:Sets or returns the user input channels that become active on negative edges. Each of theuser digital inputs may be configured to be level or edge triggered by callingInputActiveMode. Edge triggered inputs may be configured to become active on negative,positive or both edges. Active edge triggered inputs are latched until read.

Parameters:negativeEdges is a bitmap that specifies which of the inputs should become active on anegative edge.

0 - the corresponding input does not trigger on a negative edge.1 - the corresponding input is triggered on a negative edge.

Restrictions:None.

Default:By default all user digital inputs are configured to be level triggered, active high.

Example:/*----------------------------------------------------------------------*//* Override the default input configuration. We require: *//* inputs | level / edge | trigger condition *//* ------------------------------------------------- *//* 0 - 1 | edge | positive edges *//* 2 - 3 | edge | negative edges *//* 4 - 7 | level | input low *//* 8 - 23 | level | input high *//* *//*----------------------------------------------------------------------*/void configureInputs (void){ setInputActiveMode (0x0F); /* inputs 0-3 edge triggered */ setPositiveEdgeTriggeredInputs (0x03); /* 0 and 1 trigger on +ve edge */ setNegativeEdgeTriggeredInputs (0x0C); /* 2 and 3 trigger on -ve edge */ setActiveInputLevel (0xFFFF0F); /* 4 to 7 active low */}

Page 242: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 242

See Also:

ActiveInputLevel, InputActiveMode, IN, INx, PositiveEdgeTriggeredInputs

NodeLivePC BX Scaled Default Range❏ ❏ - 0 - 1

Prototype:__int16 getNodeLive (__uint8 node, __uint8 *live)

Description:The NodeLive function can be used to see if a remote node is currently live or dead. For anode to be live, it must have been added to the CAN network with the NodeType functionand the node must be responding to node guard messages being sent by NextMove. If thenode is not responding to guard messages, or has not been added to the network, then it willappear dead.

When a node becomes live or dies, the event/error is reported by the btLIVE and btDEADbits being set in the CAN event/error queue which is viewed with the CANSTATUSfunction.

Parameters:node identifies the node on the bus. This will be the node ID that was stored in the nodeduring its static configuration.

1 <= axisNo <= 63

live will return 0 if the node is dead or has not been added to the CAN network. live willreturn 1 if the node is live.

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Wait for node 5 to become live *//*----------------------------------------------------------------------*/__uint8 live;

setNodeType (5, ntINPUT_NODE_8);

Page 243: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 243

do { getNodeLive (5, &live);} while (!live);

See Also:

CANBaud, CANSTATUS, NodeType

NodeTypePC BX Scaled Default Range❏ ❏ - 0 - 9

Prototype:__int16 getNodeType (__uint8 nodeID, __uint8 *type);__int16 setNodeType (__uint8 nodeID, __uint8 type);

Description:NextMove must be told about the remote nodes present on the CAN bus. Nodes are notautomatically detected as in earlier versions of the MINT Motion Library. The NodeTypefunction is used to tell NextMove what remote nodes are present by a specifying a node IDas a specific node type.

Up to 63 nodes can be present on the CAN bus, numbered 1 to 63.

A node can be removed from the CAN network by giving a node type of ntNONE.

Parameters:nodeID is the node identifier.

1 <= nodeID < 63

type is the node type. NextMove currently supports the following node types.

Type Constant Node type

0 ntNONE Not present1 ntINPUT_NODE_8 8 digital input node2 ntOUTPUT_NODE_8 8 digital output node3 ntRELAY_NODE_8 8 relay output node8 ntIONODE24_24 24/24 IO node9 ntKEYPAD KeypadNode

Restrictions:A maximum of 63 nodes may be added to the CAN bus.

Page 244: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 244

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Add two nodes to the bus at 1000Kbits *//* node 4 : RelayNode 8 *//* node 50 : IONode 24/24 *//*----------------------------------------------------------------------*/__uint16 canstatus;__int16 statusnode;__uint8 live4;__uint8 live50;

setCANBaud (1000); /* Set the CAN baud to 1000Kbits */

setNodeType (4, ntRELAY_NODE_8);setNodeType (50, ntIONODE24_24);

/* Loop reading CANSTATUS and STATUSNODE until both nodes are live and *//* there are no CAN errors */

do { CANSTATUS (&canstatus); STATUSNODE (&statusnode);

getNodeLive (4, &live4); getNodeLive (50, &live50);

} while (( !live4 || !live50 ) || (canstatus != 0));

See Also:

NodeLive, RemoteNode

NumberOfPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 getNumberOf (__uint8 item, __int16 *number)

Description:The NumberOf function can be used to return information about what hardware is presenton NextMove.

Parameters:item is the hardware feature being requested and can accept one of the following values:

Page 245: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 245

Value Constant Meaning

0 noSERVOS Return the number of possible servo axes1 noSTEPPERS Return the number of possible stepper axes2 noINPUTS Return the number of digital inputs3 noOUTPUTS Return the number of digital outputs4 noDACS Return the number of DAC channels5 noADCS Return the number of ADC channels6 noAUX Return the number of auxiliary encoder channels

number is the number of hardware features available. The range depends on the item.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Configure program according to available hardware *//*----------------------------------------------------------------------*/__int16 number;

getNumberOf (noSERVOS, &number);if (number > 4) { ..}

getNumberOf (noINPUTS, &number);if (number < 24) { /* Configure I/O for 24 inputs */ ..} else { /* Configure I/O for 16 inputs */ ..}

getNumberOf (noAUX, &number);if (number) { /* Auxiliary encoder available for product position verification */ ..}

Page 246: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 246

OFFSETPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getOFFSET (__uint8 axisNo, float *distanceToGo)__int16 setOFFSET (__uint8 axisNo, float moveLength)

Description:The get function returns the move distance left to go on any positional move type. If avectored move is being performed, the remaining vector length is returned, not theindividual axis move length remaining. If a circular move is being performed, thecircumference of the arc remaining is returned.

The move is imposed on the base speed of the current FOLLOW move (or zero if the axisis idle). The move requires a call to GO to start motion and a move of type mdOFFSET willbe placed in the move buffer (as well as mdFOLLOW if applicable).

An offset move will continue until the specified move distance has been completed or themove is terminated by the user by calling STOP, CANCEL or RESET.

If the STOP function is issued whilst the axis is performing an OFFSET on a FOLLOWmove, the OFFSET move is immediately cancelled and the axis will stop according to theFOLLOWMODE of the move.

Parameters:axisNo specifies the axis that is to perform the offset move.

0 <= axisNo < MAX_AXES.

distanceToGo is the remaining move vector length in user units.

0 <= distanceToGo <= MAX_FLOAT

moveLength is the distance to move in user units. This does not include the distance the axismay travel as a result of the axis performing the base follow move.

MIN_FLOAT <= moveLength <= MAX_FLOAT

Restrictions:An offset move cannot be loaded if the axis is configured as cfOFF or the mode of motion isnot mdIDLE, mdFOLLOW

Page 247: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 247

The function will wait until there is a free slot in the move buffer. To avoid the call hangingyou should test for a free slot prior to calling OFFSET by calling okToLoadMove. Theaxis cannot be in error.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Axis 0 is following axis 1. When input 1 is activated perform an *//* offset of 10 mm. Input 2 will stop the follow move *//*----------------------------------------------------------------------*/__uint8 state;__uint32 mode;

setMasterSource (0, msPOS); /* Follow master position */setMasterChannel (0, 1); /* Axis 0 to follow axis 1 */setFOLLOW (0, 2.5); /* Gear ratio of 2.5:1 */do { getINx (1, &state); /* Read input 1 */ if (state) { /* If input 1 active */ getMODE (0, &mode); /* Read current mode of motion */ if ((mode & mdFOLLOW) && !(mode & mdOFFSET)) { setOFFSET (0, 10); /* If following but not offset */ GO (1, 0); /* then perform offset */ } } getINx (2, &state); /* Read input 2 */} while (!state); /* exit loop if input 2 active */do { getMODE (0, &mode); /* Read mode until offset */} while (mode & mdOFFSET); /* completed */STOP (0); /* Stop all motion */

See Also:

FOLLOW, FOLLOWMODE, MasterChannel, MasterSource, OFFSET

OffsetDistancePC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getOffsetDistance (__uint8 axisNo, float *distance)__int16 setOffsetDistance (__uint8 axisNo, float distance)

Description:Specifies the distance over which offset moves of mode 2 or 3 will occur.

Page 248: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 248

When an offset of mode 2 or 3 is executed the offset distance is taken as the distance overwhich to perform the offset.

Parameters:axisNo specifies the axis that is to perform the offset move.

0 <= axisNo < MAX_AXES.

distance is the distance over which the offset will take place in user units.

MIN_FLOAT <= distance <= MAX_FLOAT

Restrictions:The distance must be set up as positive regardless of the direction that the motors will begoing at the time the offset is executed. The distance over which the offset is performed is inthe direction of the current motion.

Default:The default is set to 1.0.

Example:setOffsetDistance( 1, 5 );

This sets the distance over which the offset will occur to be 5 user units.

See Also:

OFFSET, OffsetMode, OffsetStatus

OffsetModePC BX Scaled Default Range❏ ❏ - 0 0 - 3

Prototype:__int16 getOffsetMode (__uint8 axisNo, __uint8 *offsetMode)__int16 setOffsetMode (__uint8 axisNo, __uint8 offsetMode)

Description:The velocity profile of an OFFSET move is determined by the OffsetMode of the axis.

Page 249: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 249

The diagram below illustrates the different offset modes:

Mode 0 - default

In this mode the offset is performed using the ACCEL and DECEL as defined for the axis.The maximum speed of the offset is the base speed plus the speed defined by the SPEEDkeyword. This mode ignores any maximum speed defined for the axis and may changedirection during an offset move.

Mode 1 - speed and direction check

As with mode 0, this move uses the ACCEL and DECEL defined for the axis performingthe offset. However in this mode the motor speed will not exceed that defined by theMAXMIMUMSPEED keyword and the motor will not change direction during an offsetmove.

Mode 2 - modified acceleration and deceleration

This mode inherits the speed restrictions of mode 1 but takes place over the distance definedby the keyword OffsetDistance. This mode modifies the ACCEL and DECEL parametersof the axis during the offset move to produce a triangular velocity profile. This mode isdesigned to be used when the axis is travelling at a constant base speed as the speed of theaxis at the time of the execution of the offset is used to calculate the time in which toperform the offset. If the ACCEL and DECEL parameters required for the new profileexceed those defined for the axis the offset will abort and set OffsetStatus accordingly.

Mode 3 - modified speed

Vel OffsetMode = 0 OffsetMode = 1

OffsetMode = 2

MaximumSpeed

OffsetMode = 3

Base speed

Speed

Page 250: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 250

This mode inherits the speed restrictions of mode 1 and as with offset mode 2 takes placeover the distance defined by the function OffsetDistance. This mode modifies the SPEEDparameter in order to perform the offset at the minimum speed to achieve the offset requiredin the distance specified. It uses the current ACCEL and DECEL parameters for the axis. Ifthe speed calculated for the new profile exceeds that defined for the axis the offset will abortand set OffsetStatus accordingly.

Parameters:axisNo specifies the axis that is to perform the offset move.

0 <= axisNo < MAX_AXES.

offsetMode is the mode of all offset moves valid modes are:

mode Constant Action

0 ofSTANDARD Perform offset using accel and decel defined forthe axis with no regard for MAXSPEED orreversing.

1 ofSPEED_LIMIT Perform offset using accel and decel defined forthe axis but do not exeed maximum speed orchange direction.

2 ofACCEL_MOD Modify the ACCEL and DECEL parameters ofthe axis in order to perform the offset over thespecifed distance without constant velocity.

3 ofSPEED_MOD Modify the SPEED parameter of the axis in orderto perform the offset over the specified distance ata constant velocity.

Restrictions:The mode of an offset cannot be modified once the move has been trigged.

Default:The default offset mode is 0.

Example:setOffsetMode ( 1, 0 );

See also:

OFFSET, OffsetDistance, OffsetStatus

Page 251: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 251

OffsetStatusPC BX Scaled Default Range❏ ❏ - - 0 - 31

Prototype:__int16 getOffsetStatus (__uint8 axisNo, __uint8 *offsetStatus)

Description:Read the status of the previous offset move. OffsetStatus is a bit pattern which representsthe status of the previous OFFSET move.

Parameters:axisNo specifies the axis that is to perform the offset move.

0 <= axisNo < MAX_AXES.

Bit Constant Meaning

0 osMAX_SPEED The maximum speed as defined by theMaximumSpeed function has been reached duringthe OFFSET move.

1 osMIN_SPEED The axis stopped during theOFFSET move.2 osMAX_ACCEL The OFFSET was aborted as the acceleration required

to perform the desired profile exeeded that defined bythe ACCEL keyword.

3 osMAX_DECEL The OFFSET was aborted as the deceleration requiredto perform the desired profile exeeded that defined bythe DECEL keyword.

4 osPROFILEERROR The OFFSET was aborted because the velocity profilerequied infinate acceleration.

Example:__uint8 status;

getOffsetStatus (1, &status);

See also:

OFFSET, OffsetMode, OffsetDistance

Page 252: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 252

okToLoadMovePC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 okToLoadMove (__uint8 *isOk, __uint8 numberOfAxes, ...)

Description:Allows the user to test whether an attempt to load a move will hang in the load function.When a move is loaded, by calling MOVER, FLY etc., the function will hang until there isroom for the move in the corresponding axis move buffers. If the possibility of such a hangis unacceptable okToLoadMove may be called first. The size of the move buffer can beexpanded by calling the MoveBufferSize function. The number of free spaces available inthe move buffer can be read with MoveBufferFree. The MoveBufferStatus function alsoreturns information about the space in the move buffer.

Parameters:The function takes a variable number of arguments.

isOk returns 1 if ok to load move, 0 if move will hang.

numberOfAxes specifies the number of additional arguments passed to the function by thecaller.

1 <= numberOfAxes <= MAX_AXES.

The remaining arguments constitute a list of axis numbers on which the move bufferavailability is to be tested. The function expects that these arguments are passed as type__uint8.

0 <= axis number < MAX_AXES.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Perform an interpolated move on 4 axes. *//*----------------------------------------------------------------------*/do { okToLoadMove( &isOk, 4, 0, 1, 2, 3); /* wait for space in buffers */} while (!isOk);

Page 253: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 253

setVECTORR (4, 0, 10.0, 1, 20.0, 2, 30.0, 3, 40.0); /* set up the move and.. */GO (1, 0); /* trigger it. */

See Also:

MoveBufferFree, MoveBufferSize, MoveBufferStatus

OUTPC BX Scaled Default Range❏ ❏ - 0 0 - 4095 PC

0 - 255 BX

Prototype:__int16 getOUT (__uint32 *bitmappedOutputs)__int16 setOUT (__uint32 bitmappedOutputs)

Description:Sets or returns the state of the user digital outputs as a bitmapped value. Outputs are setactive and inactive rather than on and off as the individual active state of all user outputsmay be software configured by setActiveOutputLevel.

There are 12 digital output channels on NextMove PC and 8 digital output channels onNextMove BX.

Parameters:bitmappedOutputs specifies which of the user outputs is to be active. If a bit is:

0 - output inactive.1 - output active.

Restrictions:None.

Default:By default all outputs are inactive and are configured as active on.

Example:/*----------------------------------------------------------------------*//* Copy the bottom 12 user inputs to the user outputs but invert them. *//*----------------------------------------------------------------------*/setOUT (IN () ^ 0xFFF); /* read all inputs, exclusive OR with 1's */ /* and put onto outputs. Top bits are */

Page 254: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 254

/* ignored. */

See Also:

EnableOutput, IN, INx, OUTx

OUTxPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 getOUTx (__uint8 channel, __uint8 *state)__int16 setOUTx (__uint8 channel, __uint8 state)

Description:Reads the user output channel into state. Sets the user output channel to the desired statespecified by state. Outputs are set active and inactive rather than on and off as theindividual active state of all user outputs may be software configured byActiveOutputLevel.

Parameters:channel specifies the user output channel to be controlled.

0 <= channel < MAX_OUTPUTS

state specifies the state of the output:

0 - output inactive.1 - output active.

Restrictions:None.

Default:By default all outputs are inactive and are configured as active on.

Example:/*----------------------------------------------------------------------*//* User supplied error handler. Simply crash stop all axes and remove *//* all outputs. Then flash an error beacon connected to output 11. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ ABORT (); /* crash stop all axes */ setOUT (0); /* remove all outputs */ while (1) { /* toggle error output at 1Hz */

Page 255: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 255

setOUTx (11, True); WAIT (500); setOUTx (11, False); WAIT (500); }}

See Also:

EnableOutput, IN, INx, OUT

Page 256: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 256

PathModeThis function has been replaced with the CONTON/CONTOFF functions. It may still beused but has the same effect as using the commands CONTON and CONTOFF. Thisfunction will be removed completely in a future release.

POSPC BX Scaled Default Range❏ ❏ ❏ 0 -8388607.0 - 8388607.0

Prototype:__int16 getPOS (__uint8 axisNo, float *currentPosition)__int16 setPOS (__uint8 axisNo, float absolutePosition)

Description:Sets or returns the absolute measured position, in user units, of axis axisNo.

A call to ZERO will result in axis position being set to zero. Homing an axis will result inthe axis position being set to zero.

A servo axis encoder can be read directly using the Encoder function. The positionmaintained by the Encoder function is independent of the POS position counter.

If an axis is configured as off, then its position is no longer updated. Its encoder value maybe read instead (servo axes only).

Parameters:axisNo specifies the axis on which the position is to be set or returned.

0 <= axisNo < MAX_AXES.

absolutePosition specifies the absolute position to be loaded into the position register of theaxis.

MIN_FLOAT <= absolutePosition <= MAX_FLOAT.

currentPosition is the instantaneous axis position of axisNo.

MIN_FLOAT <= currentPosition <= MAX_FLOAT.

Restrictions:setPOS should only be called when the axis is idle.

Page 257: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 257

Default:After power up, board reset or RESET, the absolute position is set to zero.

Example:/*----------------------------------------------------------------------*//* Datum axis #1 then set the actual position to a value determined *//* during commissioning. *//*----------------------------------------------------------------------*/void datumAxis1 (void){ __uint8 isidle;

setHMSPEED (1, 50); /* set speed for homing */ setHOME (1, hmNEGATIVE_SWITCH_INDEX); /* start homing sequence */

isidle = 0; while (!isidle) { getIDLE (1, &isidle); /* wait for sequence to finish */ } setPOS (1, 89.005); /* set new reference position */}

See Also:

HOME, RESET, ZERO

PositiveEdgeTriggeredInputsPC BX Scaled Default Range❏ ❏ - 16777215 PC

65535 BX0 - 16777215 PC

0 - 65535 BX

Prototype:__int16 getPositiveEdgeTriggeredInputs (__uint32 *positiveEdges)__int16 setPositiveEdgeTriggeredInputs (__uint32 positiveEdges)

Description:Sets or returns the user input channels that become active on positive edges. Each of theuser digital inputs may be configured to be level or edge triggered by callingsetInputActiveMode. Edge triggered inputs may be configured to become active onnegative, positive or both edges. Active edge triggered inputs are latched until read. Thereare 24 digital input channels on NextMove PC and 16 digital input channels on NextMoveBX.

Parameters:positiveEdges is a bitmap that specifies which of the inputs should become active on apositive edge. If a bit is:

Page 258: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 258

0 - the corresponding input does not trigger on a positive edge.1 - the corresponding input is triggered on a positive edge.

Restrictions:None.

Default:By default all user digital inputs are configured to be level triggered, active high.

Example:/*----------------------------------------------------------------------*//* Override the default input configuration. We require: *//* inputs | level / edge | trigger condition *//* 0 - 1 | edge | positive edges *//* 2 - 3 | edge | negative edges *//* 4 - 7 | level | input low *//* 8 - 23 | level | input high *//*----------------------------------------------------------------------*/void configureInputs (void){ setInputActiveMode (0x0F); /* inputs 0-3 edge triggered */ setPositiveEdgeTriggeredInputs (0x03); /* 0 and 1 trigger on +ve edge */ setNegativeEdgeTriggeredInputs (0x0C); /* 2 and 3 trigger on -ve edge */ setActiveInputLevel (0xFFFF0F); /* 4 to 7 active low */}

See Also:

ActiveInputLevel, InputActiveMode, IN, INx, NegativeEdgeTriggeredInputs

PrecisionIncrementPC BX Scaled Default Range❏ ❏ ❏ 1.0 -8388607.0 - 8388607.0

Prototype:__int16 getPrecisionIncrement (__uint8 axisNo, float *increment);__int16 setPrecisionIncrement (__uint8 axisNo, float increment);

Description:Sets the theoretical distance between each of the values in the compensation tables.

The theoretical spacing between the values in the compensation tables is set with thePrecisionIncrement function. If dual compensation tables are being used, the increment forthe forward and reverse tables must be the same.

The sign of the increment relates to the direction of the leadscrew in relation to the axisorientation.

Page 259: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 259

Given a leadscrew defined as:

where fwd x are the actual values for travel in direction from A to B and rev x are the actualvalues for travel in the direction from B to A. For single table compensation, the fwd xvalues would apply in both direction.

If the leadscrew was laid in the machine such that travel from A to B results in a +ve changein axis position, then the increment value is positive.

If the leadscrew was laid in the machine such that travel from A to B results in a -ve changein axis position, then the increment value is negative.

Axis Position

-ve 0 +ve

Parameters:axisNo specifies the axis on which the position is to be set or returned.

0 <= axisNo < MAX_AXES.

increment specifies the theoretical distance between each of the values in the compensationtables.

MIN_FLOAT <= increment <= MAX_FLOAT.

Default:The default value for the increment is 1.0.

Example:setScale (0, 1000); /* Scale to mm */setPrecisionIncrement (0, 10.0); /* compensation values of 10.0 mm */

If the axis is scaled to mm, then the theoretical distance between the tables values is 10.0mm.

A Bfwd 2fwd 1 fwd 3

rev 2 rev 3rev 1Increment Size

A B

AB

Positive increment value

Negative increment value

Page 260: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 260

See also:

PrecisionMode, PrecisionOffset, PrecisionTable, BacklashMode

PrecisionModePC BX Scaled Default Range❏ ❏ - 0 0 - 2

Prototype:__int16 getPrecisionMode (__uint8 axisNo, __uint8 *mode);__int16 setPrecisionMode (__uint8 axisNo, __uint8 mode);

Description:Controls the action of leadscrew compensation. Leadscrew compensation has two modes ofoperation, single table mode and dual table mode.

lsTABLE - A leadscrew compensation table is defined with the PrecisionTable function.This single table is used to calculate position corrections, regardless of the direction oftravel along the table. A precision table must be specified prior to turning the compensationon. Backlash compensation can be used in conjunction with single table mode to accountfor changes in direction.

lsDUAL_TABLE - Two leadscrew compensation tables are defined with the PrecisionTablefunction. The forward table is used for travel along the table in a forward direction, thereverse table is used for travel in a reverse direction. Forward and reverse direction arebased on how the table is specified. It is assumed that the tables relate to the leadscrew as:

where fwd x are the actual values for travel in direction from A to B and rev x are the actualvalues for travel in the direction from B to A. For single table compensation, the fwd xvalues would apply in both direction.

Backlash compensation must be turned off before dual table compensation can be used. Avalue of 0, lsOFF, turns of leadscrew compensation.

Parameters:axisNo specifies the axis on which the position is to be set or returned.

0 <= axisNo < MAX_AXES.

A Bfwd 2fwd 1 fwd 3

rev 2 rev 3rev 1Increment Size

Page 261: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 261

mode controls the action of the leadscrew compensation.

Value Constant Meaning

0 lsOFF No leadscrew compensation.1 lsTABLE Uni-directional compensation.2 lsDUAL_TABLE Bi-directional compensation.

Restrictions:None.

Default:Default setting is 0.

Example:setBacklashMode (0, blOFF); /* Turn off backlash compensation */setPrecisionMode (0, lsDUAL_TABLE); /* Bi-directional compensation */

See Also:

PrecisionIncrement, PrecisionOffset, PrecisionTable, BacklashMode

PrecisionOffsetPC BX Scaled Default Range❏ ❏ ❏ 1.0 -8388607.0 - 8388607.0

Prototype:__int16 getPrecisionOffset (__uint8 axisNo, float *offset);__int16 setPrecisionOffset (__uint8 axisNo, float offset);

Description:Sets the distance between the start of the leadscrew and axis zero position. Axis zeroposition may not coincide with the start of the leadscrew. The PrecisionOffset functionallows this offset value to be specified.

Given a leadscrew defined as:

where fwd x are the actual values for travel in direction from A to B and rev x are the actualvalues for travel in the direction from B to A. For single table compensation, the fwd xvalues would apply in both direction.

A Bfwd 2fwd 1 fwd 3

rev 2 rev 3rev 1Increment Size

Page 262: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 262

The offset value is the position of point A relative to axis zero position.

Axis Position

-ve 0 +ve

Parameters:axisNo specifies the axis on which the position is to be set or returned.

0 <= axisNo < MAX_AXES.

offset sets the distance between the leadscrew and the axis zero position.

MIN_FLOAT <= offset <= MAX_FLOAT.

Restrictions:None.

Default:The default value is 0.

Example:setHOME (2, 0); /* Home axis in a negative direction */do { getIDLE (2, &isidle);} while (!isidle); /* Wait for move to complete */setPOS (2, -50); /* Set axis position to -50 */setPrecisionOffset (2, -50.0); /* If axis is at point A of */ /* leadscrew then the offset is -50.0 */

See Also:

PrecisionIncrement, PrecisionMode, PrecisionTable, BacklashMode

A B Offset value is negative

Offset value is positive A B

Page 263: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 263

PrecisionTablePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setPrecisionTable (__uint8 axisNo, float *forwardTable, float *reverseTable);

Description:Leadscrew compensation allows for a precision table, supplied by the leadscrewmanufacturer, to be given to NextMove so that it will automatically compensate forpositional inaccuracies along the length of the leadscrew.

The data is specified in an array where the values are the actual positions relative to the endof the leadscrew. The first element of the array specifies the number of elements in theprecision table.

The array single contains the compensation data. There are 10 points in the table and thevalues are the measured positions along the leadscrew.

For dual table compensation, two tables would be defined, one for forward travel and onefor reverse travel.

Given a leadscrew defined as:

where fwd x are the actual values for travel in direction from A to B and rev x are the actualvalues for travel in the direction from B to A. For single table compensation, the fwd xvalues would apply in both direction.

If only one table is being defined, then the reverse table is specified is NULL. Whether oneor two tables are used depends on the mode set with PrecisionMode.

Parameters:axisNo specifies the axis on which the position is to be set or returned.

0 <= axisNo < MAX_AXES.

forwardtable and reversetable are arrarys containing positional information about theleadscrew.

A Bfwd 2fwd 1 fwd 3

rev 2 rev 3rev 1Increment Size

Page 264: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 264

Restrictions:None.

Example:A axis has a leadscrew for which bi-directional data is available. The leadscrew starts atposition 100 and is laid such that travel in the forward direction (from A to B) results in anegative change in axis position.

float forward[11] = {10, 1.01, 2.01, 3.00, 4.00, 5.01, 6.00, 6.99, 8.00, 9.01, 10.00 };float reverse[11] = {10, 1.00, 2.01, 3.01, 4.01, 5.00, 6.00, 6.98, 7.99, 9.00, 10.00 };

setPrecisionTable (0, &forward[0], &reverse[0]);setPrecisionIncrement (0, -1); /* Increment size is 1 in -ve direction. */setPrecisionOffset (0, 100); /* Point A is at position 100 */setPrecisionMode (0, lsDUAL_TABLE); /* Dual table operation. */

See also:

PrecisionIncrement, PrecisionMode, PrecisionOffset, BacklashMode

PreHomePositionPC BX Scaled Default Range❏ ❏ ❏ 0.0 -8388607.0 - 8388607.0

Prototype:__int16 getPreHomePosition (__uint8 axisNo, float *position);

Description:Axis position is measured in user units from the last datum point. When an axis homes, theposition is automatically set to zero. The PreHomePosition function returns the axisposition as it was prior to it be zeroed. This is useful for checking for slip or lost steps.

Parameters:axisNo specifies the axis on which the ramp factor is to be set or returned.

0 <= axisNo < MAX_AXES.

position is the axis position at the point of datum.

MIN_FLOAT <= position <= MAX_FLOAT

Restrictions:None.

Page 265: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 265

Default:None.

Example:/*----------------------------------------------------------------------*//* Datum stepper axis 4 to measure any lost steps. *//*----------------------------------------------------------------------*/__uint8 idle;float lostSteps;

setHOME (4, hmPOSITIVE_SWITCH);do { getIDLE (4, &idle);} while (!idle);

getPreHomePosition (4, lostSteps);

See Also:

HOME, POS

PreScalePC BX Scaled Default Range❏ ❏ - 1 1, 2, 4, 8, 16, 32, 64, 128

Prototype:__int16 getPreScale (__uint8 axisNo, __uint8 *factor)__int16 setPreScale (__uint8 axisNo, __uint8 factor)

Description:The PRESCALE keyword is used to scale down the encoder input. PRESCALE modifies thenumber of encoder counts seen by the controller by the factor specified by the PRESCALEvalue.

For example, if a 1000 line encoder is used, giving 4000 counts per revolution, aPRESCALE value of 2 is equivalent to using a 500 line encoder. The controller will nowonly see 2000 counts per revolution.

PRESCALE will affect both the axis position (read using the POS keyword) and the encoderposition (read using the ENCODER keyword).

PRESCALE is useful to increase the positional range of the axis where it is not possible tochange the encoder.

As PRESCALE changes the number of encoder counts seen by the servo loop it may benecessary to re-tune axes once the PRESCALE function has been applied.

Page 266: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 266

Parameters:axisNo specifies the axis.

0 <= axisNo < MAX_AXES.

factor specifies the PRESCALE factor:

Restrictions:Prescale is a prescaler for encoders and can only be used on axis with encoders.

Example:setPreScale (0, 4);

Sets the PRESCALE value on axis 0 to be 4, this will increase the position range by a factorof 4.

__uint8 preScaleFactor;...getPreScale (0, &preScaleFactor);

Gets the current PRESCALE factor for axis 0.

See also:

Encoder, POS

PulsePC BX Scaled Default Range❏ - - 0 0 - 1

Prototype:__int16 setPulse (__uint8 axisNo, __uint8 state);

Description:Each stepper axis has a pulse, direction and boost output. The boost output is always underdirect user control with the Boost function. The Pulse function allows the user to controlthe state of stepper’s pulse output. The axis must be configured as cfOFF to be able to usethe Pulse function.

Using the Pulse function will stop a frequency output previously setup with the FREQfunction.

The pulse outputs provided by a stepper NextMove expansion board can also be controlled.A stepper axis direction output can be directly controlled with the StepDirection function.

Page 267: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 267

Parameters:axisNo specifies the stepper axis.

0 <= axisNo < MAX_AXES.

state specifies the state of the output:

0 - output inactive.1 - output active.

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Turn the stepper pulse output on *//*----------------------------------------------------------------------*/setCONFIG (6, cfOFF);setPulse (6, 1);

See Also:

Boost, CONFIG, FREQ, OUT, OUTx, StepDirection

PWMOnTimePC BX Scaled Default Range❏ - 1000 -16000 - 16000

Prototype:__int16 getPWMOnTime (__uint8 axisNo, __int16 *onTime);__int16 setPWMOnTime (__uint8 axisNo, __int16 onTime);

Description:The four stepper axes can be configured as PWM or stepper outputs. Configuring one axisas PWM will change all axes currently configured as stepper into PWM. Once in PWMmode, the frequency and duty cycle of the pulse train can be controlled.

The PWMOnTime function controls the duty cycle or mark space ratio of the pulse train. Itspecifies the amount of time that the output is on (active) in 125 ns ticks. A negative valuesets the stepper axis direction pin low.

The PWM period is set with the PWMPeriod function.

Page 268: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 268

Parameters:axisNo specifies the stepper axis.

0 <= axisNo < MAX_AXES.

onTime specifies the duty cycle in 125 ns ticks.

-16000 <= onTime < 16000

Restrictions:None.

Default:The default duty cycle is 1000, 125 microseconds.

Example:/*----------------------------------------------------------------------*//* Set up a pulse train that is active for 187.5 µµµµs and inactive for *//* 312.5 µµµµs. *//*----------------------------------------------------------------------*/setCONFIG (7, cfPWM);setPWMPeriod (4000);setPWMOnTime (7, 1500);

See Also:

Boost, CONFIG, FREQ, OUT, OUTx, Pulse, PWMPeriod, StepDirection

PWMPeriodPC BX Scaled Default Range❏ - 2000 1000 - 16000

Prototype:__int16 getPWMPeriod (__uint16 *ticks);__int16 setPWMPeriod (__uint16 ticks);

Description:The four stepper axes can be configured as PWM or stepper outputs. Configuring one axisas PWM will change all axes currently configured as stepper into PWM. Once in PWMmode, the frequency and duty cycle of the pulse train can be controlled.

The period is defined as the number of 125 ns ticks. The four PWM outputs must share thesame PWM period. This will default to 250 microseconds (4KHz). The PWM period canbe set or read back with the following functions:

The PWM duty cycle is set with the PWMOnTime function.

Page 269: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 269

Parameters:ticks specifies the period in 125 ns ticks.

1000 <= ticks < 16000

Restrictions:None.

Default:The default period cycle is 2000, 250 microseconds.

Example:/*----------------------------------------------------------------------*//* Set up a pulse train that is active for 187.5 µµµµs and inactive for *//* 312.5 µµµµs. *//*----------------------------------------------------------------------*/setCONFIG (7, cfPWM);setPWMPeriod (4000);setPWMOnTime (7, 1500);

See Also:

Boost, CONFIG, FREQ, OUT, OUTx, Pulse, PWMOnTime, StepDirection

Page 270: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 270

RAMPPC BX Scaled Default Range❏ ❏ - 0 0 - 100

Prototype:__int16 getRAMP (__uint8 axisNo, float *rampFactor)__int16 setRAMP (__uint8 axisNo, float rampFactor)

Description:Sets or returns the 'smoothness' of the velocity profile applied to positional moves on axisaxisNo. The velocity profile of positional moves is trapezoidal, specified by the acceleration(ACCEL), deceleration (DECEL), speed (SPEED) and move distance. The normally linearacceleration and deceleration ramps may be smoothed to approximate 'S' ramps. The degreeof smoothing is controlled by RAMP. High values produce a very rounded profile whilst avalue of zero results in a true trapezoid.

Parameters:axisNo specifies the axis on which the ramp factor is to be set or returned.

0 <= axisNo < MAX_AXES.

rampFactor controls how rounded the acceleration / deceleration ramps are.

0 <= rampFactor <= 100

Restrictions:The ramp factor only applies to positional moves. It has no effect on JOG, HOME, FLYmoves etc. For positional moves the ramp factor may not be changed during motion. Inmulti-axis moves the ramp factor on the master axis will be applied.

Ramping is only applied to moves loaded without FEEDRATEMODE enabled.

Default:By default ramp factor is set to zero (no 'S' ramping).

Example:/*----------------------------------------------------------------------*//* Define velocity profile for moves that have axis #6 as their master *//* axis. *//*----------------------------------------------------------------------*/setACCEL (6, 1000); /* acceleration rate of 1 m/s2 */setDECEL (6, 2000); /* deceleration rate of 2 m/s2 */setSPEED (6, 150); /* slew speed of 150 mm/s */setRAMP (6, 5); /* moderately smooth 'S' ramp */

Page 271: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 271

See Also:

ACCEL, CIRCLEA, CIRCLER, DECEL, MOVEA, MOVER, SPEED, VECTORA,VECTORR

ReadKeyPC BX Scaled Default Range❏ ❏ - 0 0 - 255

Prototype:__int16 getReadKey (__int16 keypad, __uint8 *pChar)

Description:NextMove has support for up to four CAN KeypadNodes. The KeypadNode function isused to specify the node identifier and the channel of the KeypadNode. The KeypadNodemust previously have been added to the CAN bus using NodeType.

When keys are pressed on the keypad, they are stored by NextMove in a 8 byte receivebuffer. The characters can be read with the tGetChar function.

ReadKey is used to read the ASCII value of the key currently being depressed. If no key isbeing pressed, zero will be returned. Characters are not removed from the receive buffer.

Parameters:port specifies the communications port the keypad is using:

Value Constant Meaning

8 tmLCD1 Keypad 116 tmLCD2 Keypad 232 tmLCD3 Keypad 364 tmLCD4 Keypad 4

pChar is the ASCII character code of the key currently being pressed on the keypad.

Restrictions:ReadKey can only be used on a live keypad node that has been assigned a terminal channelusing the command Keypadnode.

See also:

KeypadNode, NodeType, NodeLive

Page 272: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 272

RemoteBaudPC BX Scaled Default Range❏ ❏ - 125 10, 20, 50, 125, 250, 500, 800,

1000

Prototype:__int16 setRemoteBaud (__uint16 baud)

Description:All devices that communicate using the CAN network must be configured to use the samebaud rate.

The baud rate that a remote node is using is set with the RemoteBaud function whilst thenode is in configuration mode. To put a node in configuration mode, it must be powered onwith jumpers 4 and 5 in the link position. Because of the CAN messaging involved, thenode must be connected directly to NextMove, with no other nodes on the network.

To put a node back in normal operation mode, it must be powered on with jumpers 4 and 5removed.

If the remote node is successfully configured the local baud rate is changed to match and theremote node will store the new baud rate in non-volatile memory for use on subsequentpower-ups. Note that the controller will always power up with the default baud rate of 125kBit/s.

The baud rate is specified in kBit/s and the following are valid:

10 kBit/s, 20 kBit/s, 50 kBit/s, 125 kBit/s, 250 kBit/s, 500 kBit/s, 800 kBit/s and 1000kBit/s.

The length of CAN cabling determines the maximum suitable baud rate. See the ‘ioNodeReference Guide’ for details.

NextMove must have its CANBaud set to 125 kBit/s to configure at remote nodes baudrate. The CANBaud must be set to 125 kBit/s after each call to RemoteBaud as the

baud rate will be automatically changed to the new remote baud rate.

The identifier that a remote node uses is set with the RemoteNode function.

Parameters:baud specifies the baud rate in kBit/s. The following are valid:

10 kBit/s, 20 kBit/s, 50 kBit/s, 125 kBit/s, 250 kBit/s, 500 kBit/s, 800 kBit/s and 1000kBit/s.

Page 273: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 273

Restrictions:The node must be in configuration mode.

Default:The default baud rate is 125 kBit/s.

Example:/*----------------------------------------------------------------------*//* Set remote CAN node to communicate at 1000 kBit/s *//*----------------------------------------------------------------------*/setCANBaud (125) /* NextMove must be at 125 kBit/s */setRemoteNode = 30 /* Set remote node to be known as identifier 30 */setRemoteBaud = 1000 /* Set remote node to use 1000 kBit/s */

See also:

CANBaud, NodeType, RemoteNode

RemoteDebouncePC BX Scaled Default Range❏ ❏ - Depends on node type

Prototype:__int16 getRemoteDebounce (__uint8 node, __uint16 *milliseconds)__int16 setRemoteDebounce (__uint8 node, __uint16 milliseconds)

Description:Remote nodes scan the digital input channels periodically. An input is considered to havechanged if the same new state has been read for a number of consecutive samples. TheRemoteDebounce function specifies the number of milliseconds that the new input statemust be present for in order to see the new state.

InputNode 8 accepts the following debounce times:

2 ms, 4 ms, 6 ms, 8 ms and 10 ms.

The debounce time is stored in non-volatile memory for use on subsequent power-ups.

IONode 24/24 accepts the following debounce times:

4 ms, 8 ms, 12 ms, 16 ms, 20 ms, 24 ms, 28 ms and 32 ms.

The debounce time is not stored and will return to its default value of 4 ms on each powerup.

Page 274: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 274

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

Restrictions:All inputs on a node have the same debounce time. Only applicable to InputNode 8 andIONode 24/24.

Default:The default varies according to node type.

Example:/*----------------------------------------------------------------------*//* Configure input node 4 to recognise inputs that are steady for 6 ms *//*----------------------------------------------------------------------*/setRemoteDebounce (4, 6);

See Also:

NodeType, RemoteInputActiveLevel, RemoteIN, RemoteINx

RemoteEStopPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 getRemoteEStop (__uint8 nodeID, __uint8 *state);__int16 setRemoteEStop (__uint8 nodeID, __uint8 state);

Description:IONode 24/24 has an emergency stop state. When in emergency stop, all digital outputs areturned off and any attempt to write to the digital outputs result in an synchronous error,erREMOTE_ESTOP_ACTIVE. The RemoteEStop function is used to activate anddeactivate the emergency stop state.

If the node misses a CAN guard message, i.e. goes dead, then the emergency state will beactivated.

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

Page 275: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 275

1 <= node <= 63

state specifies the state of the emergency stop condition.

0 - EStop inactive.1 - EStop active.

Restrictions:Only applicable to IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*//* If Estop is active then clear it. *//*----------------------------------------------------------------------*/__uint8 state;

getRemoteEStop (4, &state);if (state) setRemoteEStop (4, 0);

See Also:

CANSTATUS, NodeType, RemoteOUT, RemoteOutputError, RemoteReset

RemoteINPC BX Scaled Default Range❏ ❏ - Depends on node type

Prototype:__int16 getRemoteIN (__uint8 node, __uint32 *pattern)

Description:If an input changes on a remote node then the node generates an event to inform NextMove.The RemoteIN function is used to read the current state of the inputs reported by a remotenode.

The active state of each input may be configured using the functionRemoteInputActiveLevel, and the debounce time of the inputs configured withRemoteDebounce.

An InputNode 8 has 8 digital input channels and an IONode 24/24 has 24 digital inputchannels.

Page 276: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 276

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= axisNo <= 6

pattern is a bit map representation of the current state of the inputs.

Restrictions:Only applicable to InputNode 8 and IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*//* Read the inputs on node 1 *//*----------------------------------------------------------------------*/__uint32 inputsNode1;

getRemoteIN (1, &inputsNode1);

See Also:

NodeType, RemoteDebounce, RemoteInputActiveLevel, RemoteINx,RemoteOUT

RemoteINxPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 getRemoteINx (__uint8 node, __uint8 channel, __uint8 *state)

Description:If an input changes on a remote node then the node generates an event to inform NextMove.The RemoteINx function is used to read the current state of an input channel on a remotenode.

The active state of each input may be configured using the functionRemoteInputActiveLevel, and the debounce time of the inputs configured withRemoteDebounce.

An InputNode 8 has 8 digital input channels and an IONode 24/24 has 24 digital inputchannels.

Page 277: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 277

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

channel identifies the input channel on the node.

state is the current state of the input. 1 if the input is active, 0 otherwise.

Restrictions:Only applicable to InputNode 8 and IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*//* Read the input 6 on node 2 *//*----------------------------------------------------------------------*/__uint8 input;

getRemoteINx (2, 6, &input);

See Also:

NodeType, RemoteDebounce, RemoteInputActiveLevel, RemoteIN,RemoteOUT

RemoteInputActiveLevelPC BX Scaled Default Range❏ ❏ - Depends on node type

PPrototype:__int16 getRemoteInputActiveLevel (__uint8 node, __uint32 *pattern)__int16 setRemoteInputActiveLevel (__uint8 node, __uint32 pattern)

Description:Remote CAN nodes that have digital inputs may have these inputs configured to be ‘active’when ON or ‘active’ when OFF. In this context, ON means that the channel is conducting,OFF means that the channel is non-conducting. Normally, inputs are considered activewhen ON. In some circumstances it may be more appropriate that the sense of the channelis inverted.

Page 278: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 278

The RemoteInputActiveLevel is used to selectively configure individual input channels tobe active when ON or OFF. A bit pattern is used and if a bit is ‘1’ then the correspondinginput is considered to be active when ON. If a bit is ‘0’ then the corresponding input isconsidered to be active when OFF.

InputNode 8 has 8 digital input channels. The valid range for RemoteInputActiveLevel is0 - 255. The active levels are stored in non-volatile memory for use on subsequent power-ups.

IONode 24/24 has 24 digital input channels. The valid range for RemoteInputActiveLevelis 0 - 16777215. The active levels are not stored and will return to its default value of allinputs active when ON, 16777215, on each power up.

The debounce period for digital inputs is set with the RemoteDebounce function.

Parameters:node is an expression that identifies the node on the bus. This is the node ID that was storedin the node during its static configuration.

1 <= node <= 63

pattern is a bit pattern in which each bit position corresponds to an I/O channel. A ‘1’ in abit position means that the I/O channel is active when ON. A ‘0’ in a bit position means thatthe I/O channel is active when OFF.

Restrictions:Only applicable to InputNode 8 and IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*//* Configure input node 4 to have inputs 0-2 as active off and inputs *//* 3-7 as active on. *//*----------------------------------------------------------------------*/setRemoteInputActiveLevel (4, 0xF8);

See Also:

NodeType, RemoteDebounce, RemoteIN, RemoteINx, RemoteOUT

Page 279: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 279

RemoteNodePC BX Scaled Default Range❏ ❏ - 1 - 63

Prototype:__int16 setRemoteNode (__uint8 ID)

Description:CAN nodes are referenced on the CAN bus using a unique number called the node ID. Thenode must be told what its node ID is in order to receive messages sent to it. This issupposed to be a once only configuration task.

The node ID that a remote node is using is set with the RemoteNode function whilst thenode is in configuration mode. To put a node in configuration mode, it must be powered onwith jumpers 4 and 5 in the link position. Because of the CAN messaging involved, thenode must be connected directly to NextMove, with no other nodes on the network.

To put a node back in normal operation mode, it must be powered on with jumpers 4 and 5removed.

If the remote node is successfully configured the ID is changed and the remote node willstore the ID in non-volatile memory for use on subsequent power-ups.

NextMove must have its CANBaud set to 125 kBit/s to configure at remote nodes ID.

The baud rate that a remote node uses is set with the RemoteBaud function.

Parameters:node is an expression that identifies the node on the bus. This will be the node ID that willbe stored in the node.

1 <= node <= 63

Restrictions:The node must be configuration mode.

Default:None.

Example:/*----------------------------------------------------------------------*//* Configure a RelayNode as node 11 with a bit rate of 500 Kbits/s *//*----------------------------------------------------------------------*/setCANBaud (125);

Page 280: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 280

setRemoteNode (11);setRemoteBaud (500);

See Also:

CANBaud, NodeType, RemoteBaud

RemoteOUTPC BX Scaled Default Range❏ ❏ - Depends on node type

Prototype:__int16 getRemoteOUT (__uint8 node, __uint32 *pattern)__int16 setRemoteOUT (__uint8 node, __uint32 pattern)

Description:The digital output channels on a remote CAN node are controlled with the RemoteOUTfunction.

An OutputNode 8 and a RelayNode 8 both have 8 digital output channels. An IONode24/24 has 24 digital output channels.

The digital outputs on OutputNode 8 and IONode 24/24 are over current and short circuitprotected. An error will be generated which can be read with the CANSTATUS function.To clear an output error on an OutputNode 8, the outputs must be written to. To clear anoutput error on an IONode 24/24, the RemoteOutputError function is used.

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

pattern is a bit map representation of the state of the outputs.

Restrictions:Only applicable to OutputNode 8, RelayNode 8 and IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*/

Page 281: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 281

/* Set the outputs on RelayNode 12 to be in the pattern 11011001 *//*----------------------------------------------------------------------*/setRemoteOUT (12, 0xD9);

See Also:

CANSTATUS, NodeType, RemoteEStop, RemoteIN, RemoteOutputError,RemoteOUTx

RemoteOutputErrorPC BX Scaled Default Range❏ ❏ - 0 0 - 16777215

PPrototype:__int16 getRemoteOutputError (__uint8 nodeID, __uint32 *data);__int16 setRemoteOutputError (__uint8 nodeID, __uint32 data);

Description:The digital outputs on a IONode 24/24 are over current and short circuit protected. If anoutput error is signalled (read using the CANSTATUS function), then theRemoteOutputError function can be read to see which outputs are in error. The outputsare arranged in three banks of eight outputs. If one output in a bank goes into error, then alloutputs in that bank are turned off.

To clear the output error, a value of 0 is written to RemoteOutputError.

When in the emergency stop state, all digital outputs are turned off. See the RemoteEStopfunction.

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

data specifies a bit pattern of outputs that are in error.

0 <= data <= 16777215

Restrictions:Only applicable to IONode 24/24.

Default:None.

Page 282: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 282

Example:/*----------------------------------------------------------------------*//* Clear output errors if they exist. *//*----------------------------------------------------------------------*/__uint32 data;

getRemoteOutputError (4, &data);if (data) { setRemoteOutputError (4, 0);}

See Also:

CANSTATUS, NodeType, RemoteEStop, RemoteIN, RemoteOUT, RemoteReset,RemoteStatus

RemoteOUTxPC BX Scaled Default Range❏ ❏ - - 0 - 1

PPrototype:__int16 getRemoteOUTx (__uint8 node, __uint8 channel, __uint8 *state)__int16 setRemoteOUTx (__uint8 node, __uint8 channel, __uint8 state)

Description:Individual digital output channels on a remote CAN node are controlled with theRemoteOUTx function.

An OutputNode 8 and a RelayNode 8 both have 8 digital output channels. An IONode24/24 has 24 digital output channels.

The digital outputs on OutputNode 8 and IONode 24/24 are over current and short circuitprotected. An error will be generated which can be read with the CANSTATUS function.To clear an output error on an OutputNode 8, the outputs must be written to. To clear anoutput error on an IONode 24/24, the RemoteOutputError function is used.

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

channel specifies the digital output channel.

state is the current state of the output. 1 if the input is active, 0 otherwise.

Page 283: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 283

Restrictions:Only applicable to OutputNode 8, RelayNode 8 and IONode 24/24.

Default:None.

Example:/*----------------------------------------------------------------------*//* Toggle output 4 on output node 7 *//*----------------------------------------------------------------------*/__uint8 state;

getRemoteOUTx (7, 4, &state);setRemoteOUTx (7, 4, !state);

See Also:

CANSTATUS, NodeType, RemoteEStop, RemoteIN, RemoteOUT,RemoteOutputError

RemoteResetPC BX Scaled Default Range❏ ❏ - - -

PPrototype:__int16 remoteReset (__uint8 node)

Description:The RemoteReset function can be used to cause an IONode 24/24 to perform a completesoftware reset. This has the effect of turning off all digital outputs and clearing any errors.

Once reset, the node will generate two event messages with the _error bit set.

The RemoteStatus function can be used to clear errors on a IONode 24/24.

Parameters:node identifies the node on the bus to be reset. This is the node ID that was stored in thenode during its static configuration.

1 <= node <= 63

Restrictions:Only applicable to IONode 24/24.

Page 284: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 284

Default:None.

Example:/*----------------------------------------------------------------------*//* Reset node 9 *//*----------------------------------------------------------------------*/remoteReset (9);

See Also:

CANSTATUS, NodeType, RemoteStatus

RemoteSetupPC BX Scaled Default Range❏ ❏ - Node Number : 1 - 63

CAN baud : 10, 20, 50, 125, 250,500, 800, 1000

Prototype:__int16 getRemoteSetup (TRemoteSetup *RemoteSetupInfo)__int16 setRemoteSetup (__uint8 newID, __uint16 newBitRate)

Description:This command will display the current configuration for the node and then prompt the userthrough the process of setting up a remote node. It is designed to replace the RemoteNodeand RemoteBaud functions although both of these are still available to use.

CAN nodes are referenced on the CAN bus using a unique number called the node ID. Thenode must be told what its node ID is in order to receive messages sent to it. This issupposed to be a once only configuration task.

The node ID and baud rate that a remote node is using can be set with RemoteSetup whilstthe node is in configuration mode. To put a node in configuration mode, it must be poweredon with jumpers 4 and 5 in the link position. Because of the CAN messaging involved, thenode must be connected directly to NextMove, with no other nodes on the network.

To put a node back in normal operation mode, it must be powered on with jumpers 4 and 5removed.

If the remote node is successfully configured, the ID and baud rate is changed and theremote node will store the them in non-volatile memory for use on subsequent power-ups.Note that the controller will always power up with the default baud rate of 125 kBit/s.

Page 285: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 285

NextMove must have its CANBAUD set to 125 kBit/s to configure a remote node. TheREMOTESETUP keyword automatically changes the baud rate to 125 kBit/s for

configuration and then sets it to the new remote baud rate on completion.

All devices that communicate using the CAN network must be configured to use the samebaud rate.

The baud rate is specified in kBit/s and the following are valid:

10 kBit/s, 20 kBit/s, 50 kBit/s, 125 kBit/s, 250 kBit/s, 500 kBit/s, 800 kBit/s and 1000kBit/s.

The length of CAN cabling determines the maximum suitable baud rate. See the ‘ioNodeReference Guide’ for details.

Parameters:getRemoteSetup fills in the below structure.

typedef struct { __uint32 Type; __uint32 NodeNumber; __uint32 CANBaudRate; __uint8 SerialNumber[lenSERIAL_NUMBER_STRING]; __uint8 FirmwareVersion[lenFIRMWARE_VERSION_STRING];} TRemoteSetup;

Although CANBaudRate is part of the structure, it must be noted that it cannot be read fromthe remote node, only written to. As a result of this ‘0’ will always be passed back in thestructure CANBaudRate component when using getRemoteSetup().

setRemoteSetup

newID is the node number, this identifies the node on the bus.

1 <= newID <= 63

newBitRate is the baud rate the node is to operate at. It is specified in kBit/s and thefollowing are valid bit rates:

10, 20, 50, 125, 250, 500, 800 and 1000.

Restrictions:The node to be setup must be powered up in setup mode i.e jumpers 4 and 5 connected.

Example:TRemoteSetup node_info;.getRemoteSetup(&node_info);

Page 286: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 286

This will fill in a variable node_info with the data about the remote CAN node.setRemoteSetup (5, 125);

This will set the remote CAN node to use ID 5 and to communicate at 125 kBit/s.

See also:

CANBaud, NodeType, RemoteBaud, RemoteNode

RemoteStatusPC BX Scaled Default Range❏ ❏ - - 0 - 127

Prototype:__int16 getRemoteStatus (__uint8 nodeID, __uint8 *data);__int16 setRemoteStatus (__uint8 nodeID, __uint8 data);

Description:Each remote node maintains a status register. The RemoteStatus function can be used toread the status from a remote node. RemoteStatus returns a bit pattern as follows:

Bit Constant Description

0 btABERR Abnormal bus errors. The node is experiencing an abnormalrate of failed transmissions and receptions.

1 btBUSOFF Bus off. The node has gone into the ‘bus-off’ state because of ahigh rate of failed transmissions and receptions.

2 btOVER Receive or transmit overrun. CAN messages are arriving morefrequently than they can be serviced or are not beingsuccessfully transmitted.

3 btDEAD The node is dead. The node is no longer receiving node guardmessages from NextMove.

4 btLIVE The node is live. The node is receiving node guard messagesfrom NextMove. This is the normal healthy state of a node.

5 Reserved.6 btRNERR The node has an error condition. See below.

The meaning of btRNERR bit depends on the node type.

For IONode 24/24, btRNERR indicates that there is an output driver error. TheRemoteOutputError function returns information about which outputs are in error.

For all other nodes, btRNERR indicates two things.

Page 287: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 287

1. There is an output driver error. A write to the outputs will cause the output driver tobe reset and the error removed.

2. The error count is active. When a node does not receive guard messages fromNextMove, a counter increments and the nodes LED will flash red. Whencommunications is re-established, the LED will continue to flash red until thecounter decrements to a low level and the error is cleared.

The when a node has a change of status, it will generate a message that NextMove will placein its CAN event/error queue. This can be accessed with the CANSTATUS andSTATUSNODE functions.

If a node has btABERR, btBUSOFF, btOVER, btDEAD or btRNERR bits active, it will flashits LED red. Once the problem is removed, an InputNode 8, OutputNode 8 and RelayNode8 will clear the error and stop flashing its LED red once its counter has decremented. (See2. above).

The status register for an IONode 24/24 must be cleared manually by writing 0 to theRemoteStatus function. This will cause the node to generate a new event message with itscurrent status.

Parameters:node identifies the node on the bus. This is the node ID that was stored in the node duringits static configuration.

1 <= node <= 63

status is the status entry from the event/error queue.

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Clear any errors on an IONode 24/24, node 55 *//*----------------------------------------------------------------------*/__uint8 status;

getRemoteStatus (55, &status);if (status != btRNERR) setRemoteStatus (55, 0);

Page 288: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 288

See Also:

CANSTATUS, NodeType, remoteReset, STATUSNODE

RESETPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 RESET (__uint8 axisNo)

Description:Clears any asynchronous axis errors on the specified axis and sets the measured position tozero. The default axis enable output is activated. The relay output will be energised if noaxis is in error.

Parameters:axisNo specifies the axis to be reset.

0 <= axisNo < MAX_AXES.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* User supplied error handler. Simply reset all axes. *//*----------------------------------------------------------------------*/void myErrorHandler (void){ __uint8 ax;

for (ax=0; ax<cnMAX_AXES; ax++) RESET (ax); /* reset all axes */}

See Also:

CANCEL, CONFIG, DEFAULT, EnableOutput

Page 289: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 289

ReverseLimitSwitchInputPC BX Scaled Default Range❏ ❏ - - 0 - 23 PC

0 - 15 BX

Prototype:__int16 getReverseLimitSwitchInput (__uint8 axisNo, __int16 *inputChannel)__int16 setReverseLimitSwitchInput (__uint8 axisNo, __int16 inputChannel)

Description:Sets or returns the user digital input channel configured to be the reverse end of travel limitswitch input. Each axis may be configured to have its own limit switch input, share an inputwith any number of other axes or have no limit switch input. When a limit switch becomesactive the action taken depends upon the mode selected by HardwareLimitMode.

Parameters:axisNo specifies the axis on which the reverse limit switch input is to be set or returned.

0 <= axisNo < MAX_AXES.

inputChannel specifies the user digital input that is connected to the reverse limit switch.

-1 <= inputChannel < numberDigitalInputs

-1 : axisNo has no reverse limit switch.

Restrictions:None.

Default:There are no default limit switch assignments.

Example:/*----------------------------------------------------------------------*//* Disable all limit switch inputs. *//*----------------------------------------------------------------------*/void disableAllLimits (void){ __uint8 ax;

for (ax=0; ax<cnMAX_AXES; ax++) { setForwardLimitSwitchInput (ax, -1); /* no forward limit switch */ setReverseLimitSwitchInput (ax, -1); /* no reverse limit switch */ }}

Page 290: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 290

See Also:

AsyncError, ErrorMask, ForwardLimitSwitchLimit, ForwardSoftwareLimit,HardwareLimitMode, ReverseSoftwareLimit

ReverseSoftwareLimitPC BX Scaled Default Range❏ ❏ ❏ -8388607.0 -8388607.0 - 8388607.0

Prototype:__int16 getReverseSoftwareLimit (__uint8 axisNo, float *reverseLimit)__int16 setReverseSoftwareLimit (__uint8 axisNo, float reverseLimit)

Description:Sets or returns the maximum reverse limit of travel on axis axisNo. Each axis may beconfigured to have a maximum and minimum limit of travel. If an axis moves beyond theselimit positions, an asynchronous axis error will be generated. The user defined error handlerwill be called if it is defined and enabled (see ErrorMask). If the error is not handled bythe user then default action will be taken according to the mode set withSoftwareLimitMode.

Parameters:axisNo specifies the axis on which the reverse limit is to be set or returned.

0 <= axisNo < MAX_AXES.

reverseLimit is the least positive position, in user units, that axisNo may achieve before asoftware limit condition is reported.

MIN_FLOAT <= reverseLimit <= MAX_FLOAT

Restrictions:None.

Default:The default reverse software limit position is MIN_FLOAT.

Example:/*----------------------------------------------------------------------*//* if axis #0 has hit its reverse software limit, set elsewhere in the *//* program, check the interference of axis #1. If axis #1 is clear *//* expand the software limit on axis #0. *//*----------------------------------------------------------------------*/void checkSoftwareLimits (void)

Page 291: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 291

{ status = 0; getAxisStatus ( 0 , &status ); If ( status & erFWD_SOFT_LIMIT) { getPOS (1, &position) if (position > 1564.3) setForwardSoftwareLimit (0, 1000); }}

See Also:

AsyncError, ErrorMask, ForwardLimitSwitchLimit, ForwardSoftwareLimit,ReverseLimitSwitchInput, SoftwareLimitMode

RTSCTSPC BX Scaled Default Range

❏ 0 0,1

Prototype:__int16 getRTSCTS (__uint8 FAR *handshaking);__int16 setRTSCTS (__uint8 handshaking);

Description:The RTSCTS keyword is used to enable or disable hardware handshaking on the RS232channel. Setting this to 1 enables the RTS/CTS checking, by default the RS232 channel onthe NextMove BX does not use hardware handshaking.

If the hardware handshaking is enabled then the device that the RS232 port is connected tomust also use RTS/CTS and the cable must be wired to support this protocol.

Parameters:handshaking specifies whether the RTSCTS is enabled or disabled, valid values are 0 or 1.

Restrictions:Only applies to the RS232 port

Default:The factory default is 0 (RTSCTS disabled). However when this is set the value is stored inEEPROM and will be restored at power up.

Example:setRTSCTS(1);

Enables RTS/CTS on the RS232 channel.

Page 292: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 292

See Also:

None.

Page 293: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 293

SCALEPC BX Scaled Default Range❏ ❏ 1 -8388607.0 - 8388607.0

Prototype:__int16 getSCALE (__uint8 axisNo, float *scaleFactor)__int16 setSCALE (__uint8 axisNo, float scaleFactor)

Description:Sets or returns the scale factor on axis axisNo. The scale factor is used to convert betweenthe minimum resolvable unit (encoder edges or steps) and user units. The scale factor isusually one of the first axis parameters to be set within a program.

Parameters:axisNo specifies the axis on which the scale factor is to be set or returned.

0 <= axisNo < MAX_AXES.

scaleFactor specifies the number of encoder edges or steps per user unit.

0 < scaleFactor <= MAX_FLOAT

Restrictions:The scale factor cannot be changed whilst an axis is in motion.

Default:After power up or a board reset, the scale factor is set to one, ie: all motion variables areprogrammed in encoder edges or steps.

Example:/*----------------------------------------------------------------------*//* Set the axis parameters for axis #0. *//*----------------------------------------------------------------------*/void configureAxis0 (void){ setSCALE (0, 1007.56); /* there are 1007.56 encoder edges per mm */ setSPEED (0, 125); /* slew speed is 125 mm/s */ setACCEL (0, 1000); /* acceleration rate is 1 m/s2 */ setDECEL (0, 2000); /* deceleration rate is 2 m/s2 */ setRAMP (0, 5); /* moderately smooth 'S' ramp */ setGAIN (0, 1.7); /* proportional gain of 1.7 */}

See Also:

DEFAULT

Page 294: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 294

SerialBaudPC BX Scaled Default Range

❏ 9600 0 - 38400

Prototype:__int16 getSerialBaud (__int16 port, __int32 *Baud )__int16 setSerialBaud (__int16 port, __int32 Baud )

Description:NextMove BX supports both an RS232 and RS485 serial port. This keyword allows thebaud rates of these ports to be changed. The setting is recorded in EEPROM and restored toits previous setting on power up.

Parameters:port specifies the port whose baud rate is to be set.

Value Constant Meaning

1 tmRS232 RS232 port2 tmRS485 RS485 port

baud specifies the baud rate the port is to be set up for.

Baud 50 75 110 134 150 200 300 600 1050

RS232RS485

Baud 1200 1800 2000 2400 4800 7200 9600 19200 38400

RS232RS485

Restrictions:This command only applies to the RS232 and RS485 ports.

Default:The default factory setting is 9600 for both the RS232 and the RS485 ports. If these arechanged the new setting will be retained after power cycling the unit.

Example:setSerialBaud ( tmRS232, 9600 );

Page 295: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 295

Sets the RS232 baud rate to 9600.

See Also:

SerialNode

SerialNodePC BX Scaled Default Range

❏ - -1 0 - 15

Prototype:__int16 getSerialNode (__int16 port, __int8 *node)__int16 setSerialNode (__int16 port, __int8 node)

Description:NextMove BX supports both an RS232 and RS485 serial port. The RS485 port can be usedin a multi-drop configuration, but before it can used on the bus, it’s node number must beset. This is achieved with the SerialNode function.

The node number is stored in EEPROM. The node number will be restored on power up.To gain access to the RS485 port use the $ syntax. If the node number is set to zero then theRS485 port will automatically be enabled on boot up. See the ‘MINT ProgrammersManual’ for details on multi-drop RS485.

It is recommended that MINT is used to set up the node number of the RS485 port. Onceset, it is stored in EEPROM and will be restored on power up.

Note: The RS485 port is inaccessible until the node number is set.

Parameters:port specifies the port to be setup, this must be tmRS485

node is the node number the RS485 port is to be given

Restrictions:This function only applies to the RS485 port.

Example:setSerialNode (tmRS485, 1); /* Set the node number to 1 */

See Also:

Comms, CommsMode

Page 296: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 296

SERVOCThis function has been replaced with the Torque function.

SERVOFFThis function has been replaced with the Torque function.

SERVONThis function has been replaced with the Torque function.

SoftwareLimitModePC BX Scaled Default Range❏ ❏ - 0 0 - 3

Prototype:__int16 getSoftwareLimitMode (__uint8 axisNo, __uint8 *mode)__int16 setSoftwareLimitMode (__uint8 axisNo, __uint8 mode)

Description:Software position limits can be set on an axis using the ForwardSoftwareLimit andReverseSoftwareLimit functions. When a software limit is exceeded, an error conditionwill exist for the axis.

The default action mode is checked to see if an asynchronous axis error should be generated.If one is, the user supplied error handler will be called if it is defined and enabled (seeErrorMask). This function controls the default action that will be taken if the user suppliederror handler does not clear the error.

Setting the mode to slIGNORE will clear a software limit error.

Parameters:axisNo specifies the axis on which the software switch is to be set or returned.

0 <= axisNo < MAX_AXES.

mode specifies the action that should be taken when a software limit condition occurs. modemay take one of the following values:

Page 297: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 297

Value Constant Meaning

0 slIGNORE Software limit errors are ignored and no errors will begenerated

1 slNORMAL An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to crash stop the axis and any axesinvloved in the move. The axis enable will be removed andthe relay output dropped. The error can be cleared bywriting to the asynchronous error structure directly usingAsyncError or by calling CANCEL or RESET.

2 slCANCEL An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to crash stop the axis and any axesinvloved in the move. The error can be cleared by writingto the asynchronous error structure directly usingAsyncError or by calling CANCEL or RESET.

3 slSTOP An asynchronous axis error will be generated. The usersupplied error handler will be called if it is defined and thecorresponding bit in the error mask is set to enable its call.Default action is to decelerate the axis at the rate set withErrorDeceleration. The error can be cleared by writing tothe asynchronous error structure directly using AsyncErroror by calling CANCEL or RESET.

4 slSMART In this mode, NextMove anticipates a forthcoming softwarelimit error. The forward or reverse software limit becomesa temporary end point for the move in progress. The moveis ramped to zero speed at the current deceleration rate suchthat the axis stops at the software limit. When the axis isstationary, an asynchronous axis error will be generated.The user supplied error handler will be called if it isdefined and the corresponding bit in the error mask is set toenable its call. No default action is taken. The move willcontinue when the software limits are expanded and willcomplete as normal if the software limits permit. The movemay be cancelled prematurely by the user supplied errorhandler calling STOP or CANCEL.

Page 298: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 298

Restrictions:None.

Default:By default software limit mode is set to slIGNORE.

Example:/*----------------------------------------------------------------------*//* Select that software limits on axis #5 do not call the error handler *//* but automatically crash stop the axis but remain enabled. *//*----------------------------------------------------------------------*/getErrorMask (5, &mask);setErrorMask (5, mask & (erFWD_SOFT_LIMIT + erREV_SOFT_LIMIT));setSoftwareLimitMode (0, slCANCEL);

See Also:

AsyncError, DISLIMIT, ENLIMIT, ERROR, ErrorDeceleration, ErrorHandler,ForwardSoftwareLimit, ReverseSoftwareLimit

SPEEDPC BX Scaled Default Range❏ ❏ ❏ 40000 servo

1000 stepper0.0 - 8388607.0

Prototype:__int16 getSPEED (__uint8 axisNo, float *speed)__int16 setSPEED (__uint8 axisNo, float speed)

Description:Sets or returns the maximum move speed in user units / second on axis axisNo. speed is themaximum speed at which an axis or group of axes is permitted to move when executing afinite positional move (CIRCLEA, CIRCLER, MOVEA, MOVER, OFFSET,VECTORA, VECTORR). Whether this speed is achieved during the move depends uponthe acceleration, deceleration and move length.

Parameters:axisNo specifies the axis on which the speed is to be set or returned.

0 <= axisNo < MAX_AXES.

speed is the maximum speed applied to the axis.

0 <= speed < MAX_FLOAT.

Page 299: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 299

Restrictions:speed may be read or written at any time. If speed is changed during execution of apositional move the axis or axes will ramp to the new speed at the current acceleration ordeceleration rate.

Default:Servo axes: 40,000 encoder edges / secondStepper axes: 1,000 steps / second

Example:/*----------------------------------------------------------------------*//* Set the axis parameters for axis #0. *//*----------------------------------------------------------------------*/void configureAxis0 (void){ setSCALE (0, 1007.56); /* there are 1007.56 encoder edges per mm */ setSPEED (0, 125); /* slew speed is 125 mm/s */ setACCEL (0, 1000); /* acceleration rate is 1 m/s2 */ setDECEL (0, 2000); /* deceleration rate is 2 m/s2 */ setRAMP (0, 5); /* moderately smooth 'S' ramp */}

See Also:

ACCEL, DECEL, VEL

SplinePC BX Scaled Default Range❏ ❏ - - 0 - 15

Prototype:__int16 getSpline (__uint8 axisNo, __uint8 *mode)__int16 setSpline (__uint8 axisNo, __uint8 mode)

Description:A spline move provides a means of specifying motion where arbitrary position and velocityinformation needs to be specified in terms of time.

A spline move is created by breaking the motion into a number of segments. Each segmentdefines the how far the axis will travel in a given time duration and optionally the velocityof the axis at the end of that segment. Once these segments have been defined, NextMovewill interpolate between them and ‘fill in’ the missing information, producing a smooth pathas it goes. The user controls the size and accuracy of these segments. The more critical theaxis motion, the more segments that can be defined.

Page 300: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 300

The segment information for a spline move is defined in an array. An array of positions hasto be defined together with optional arrays of velocities and segment durations. The arraysto use are specified with the SplineTable function. Axis positions can be interpreted in oneof three ways:

1. The values represent relative movements. Each value is the relative distance that the axismust move over that segment.

2. The values represent absolute positions within a spline cycle. During a continuousspline, each repetition of the segments is known as a cycle. Each time the cycle starts,the current axis position is considered as zero and the position values are taken asabsolute to that point.

3. The values represent true absolute positions. The value are absolute with reference toactual axis position. The zero position is from when the axis was last reset or homed.

Example:float exampleArray[11] = {10, 2, 4.5, 6, 5.7, 2, 0.1, -3.4, -9.3, -6.1, 0};

setSplineTable (0, &exampleArray[0], null, null);setSpline (0, spABSOLUTE);

The above defines an array of positions and uses SplineTable to specify the name of thearray to use. The parameter specified in the Spline function indicates how the data is to beinterpreted. In the example, the data is to be taken as absolute positions.

When the spline is executed, each segment is processed in turn until the last segment isreached. If the spline has been specified as continuous, then the start segment will beprocessed at completion of the end segment. The start and end segments are set with theSplineStart and SplineEnd functions. The currently executing spline segment number canbe read with SplineIndex function.

The duration of each spline segment is defined with the SplineTime function or using thesegment duration array set in SplineTable. The axis will move the distance given in theposition table over the specified segment duration.

A spline can be performed on a servo or stepper axis. The ACCEL, DECEL and slewspeed parameters (SPEED and FEEDRATE) are not used. Care must taken when definingthe segments as the algorithm used will demand any velocity required to complete thespecified segment, regardless of whether the motor can achieve that motion.

There are three types of spline motion available:

Page 301: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 301

Spline 1

Spline 1 type motion is the default type. A position array must be defined and segmentdurations may be specified with the SplineTime function or with a duration array. Theprofile produced will be continuous in position, velocity, acceleration and jerk (rate ofchange of acceleration). Depending on the requested positions, the profile may not passthrough the points specified in the position array.

Example:/* Position array. First element specifies number of position points */float exampleArray[6] = {5, 1, 2, 10, 2, 0};

setSplineTable (0, &exampleArray[0], null, null); /* Name arrays to use */setSplineTime (0, 1000); /* Segment duration of 1000ms */setSpline (0, spSPLINE_1 + spABSOLUTE); /* Absolute spline 1 */GO (1, 0); /* Start motion */

The profile is shown above. The position curve shows that the axis did not achieve position10 since a spline 1 move is not guaranteed to pass through the specified position points. Theother point to note is the length of the move. A spline 1 move doubles the segment durationspecified for the first and last segments of the profile. This only applies to the start and stopsituation however. If the spline is continuous, then the first and last segments are of the userspecified duration apart from the initial start and final stop situations.

Page 302: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 302

How close the profile comes to position segment point depends on the proximity of thepreceding position. For example, if the position array was modified to:

float exampleArray[6] = {5, 1, 9, 10, 2, 0};

The position profile now almost reaches position 10. The profile may be forced to reach aposition by specifying the same position three times in the position array.

Page 303: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 303

This results in the profile reaching the third repetition of the segment position with zerovelocity.

float exampleArray[6] = {5, 1, 10, 10, 10, 0};

Spline 2

Spline 2 type motion produces a profile that does reach all the position points specified inthe position array but the profile is only continuous in position and velocity. A positionarray must be defined and segment durations may be specified with the SPLINETIMEkeyword or with a duration array.

Example:/* Position array. First element specifies number of position points */float exampleArray[6] = {5, 2, 3, 5, -4, -6};

setSplineTable (0, &exampleArray[0], null, null); /* Name arrays to use */setSplineTime (0, 1000); /* Segment duration of 1000ms */setSpline (0, spSPLINE_2); /* Relative spline 2 */GO (1, 0); /* Start motion */

Page 304: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 304

All position points are reached and each segment takes the specified duration.

PVT

A PVT allows both position and velocity data to be specified for a profile. The profileproduced reaches all the position points specified in the position array at the velocityspecified in the velocity array but the profile is only continuous in position and velocity.The segment durations may be specified with the SplineTime function or with a durationarray.

Example:/* Position array. First element specifies number of position points */float pArray[6] = {5, 2, 5, 6, 2, 0};/* Velocity array. Only the number of segments required */float vArray[5] = {5, 0.5, 0, -5.3, 0};/* Duration array. Only the number of segments required */float tArray[5] = {600, 1000, 2000, 900, 600};

setSplineTable (0, &pArray[0], &vArray[0], &tArray[0]); /* Arrays to use */setSpline (0, spABSOLUTE); /* Absolute PVT */GO (1, 0); /* Start motion */

Page 305: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 305

The profile reaches each requested segment position at the specified velocity. Each segmenttakes the specified duration to complete

The Spline function sets up a spline move using the arrays specified with the SplineTablefunction. The functionality of the spline is controlled with the mode parameter. Oncestarted with GO, the spline executes in the background. It will continue until the splinecomes to a natural end or the move is terminated by the user with STOP, CANCEL orRESET or by an error condition. The axis must be idle before calling Spline and no furthermoves may be loaded.

If a velocity array is specified, then the spline will be a PVT profile, regardless of the settingof bit 3.

A spline move may be stopped with STOP, a stop switch input, an error condition or pausedusing a stop switch input or the Suspend function. In these situations, the spline will rampto a controlled stop over a duration specified with the SplineSuspendTime function. Thisis particularly useful in situations where short segments are running at high velocity sincethe axis would not be able to decelerate in a controlled manner in that duration.

If the axis is allowed to resume from a pause situation, the axis will travel to the currentsegment end position over the SplineSuspendTime duration.

Example:/* Input 3 is the stop switch input. The axis should pause if active */setStopSwitchInput (4, 3); /* Assign input */

Page 306: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 306

setStopSwitchMode (4, 1); /* Pause if switch active */setSplineSuspendTime (4, 2000); /* Ramp to halt over 2000 ms */../* Load spline... */

Reading the Spline will return the mode of the currently executing move. It is oftendesirable to load a continuous spline and then stop it at the end segment after a number ofcycles. To make a continuous spline non-continuous, the Spline function is written to withthe same value but without bit 2 set.

Parameters:axisNo specifies the axis on which the spline move is to be executed.

0 <= axisNo < MAX_AXES

mode specifies the way in which the position parameter is interpreted.

The mode parameter accepts one of the following values:

Value Constant Meaning

0 spSPLINE_1 Use Spline 1 motion1 spABSOLUTE Use the positions specified in the position array as

being absolute within each spline cycle. If this bitis not set, the position will be taken as relativemovements.

2 spT_ABSOLUTE Use the positions specified in the position array asbeing absolute to true motor positions. Bit 0 mustbe set for this to occur.

4 spCONTINUOUS Continuously cycle through the spline, beginnningfrom the start segment when the end segment isreached.

8 spSPLINE_1 Use Spline 2 motion. If this bit is not set then thespline will be a Spline 1 profile.

Restrictions:The spline arrays must have been specified prior to the call to Spline and the axis must beidle and not in error.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Define the SPLINE position table. 10 segments so array size 11 as */

Page 307: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 307

/* first element specifies number of segments *//*----------------------------------------------------------------------*/float positions[11] = {10, 1, 2, 4, 7, 15, 14, 12, 13, 4, 1};/*----------------------------------------------------------------------*//* Define the SPLINE velocity and duration tables. 10 segments so array *//* elements = 10 *//*----------------------------------------------------------------------*/float velocities[10] = {1, 2, 5, 3, 0, 0, -5, -10, -1, 0};float durations[10] = {0.5, 0.5, 0.5, 0.1, 0.1, 0.5, 1, 5, 5, 5};

/*----------------------------------------------------------------------*//* Use the array ‘positions’ as the position table, ‘velocities’ as the *//* velocity information and ‘durations’ as the duration table. *//*----------------------------------------------------------------------*/setSplineTable (0, &positions[0], &velocities[0], durations[0]);

/*----------------------------------------------------------------------*//* Set up the SPLINE to use the position table value as relative and the*//* SPLINE is a single shot. *//*----------------------------------------------------------------------*/setSplineStart (0, 1); /* Start at position 1 in the table */setSplineEnd (0, 10); /* End at position 10 in the table */setSpline (0, spCONTINUOUS); /* PVT motion */GO (1, 0); /* Start the move on axis 0 */

See Also:

Cam, SplineEnd, SplineIndex, SplineStart, SplineSuspendTime, SplineTable,SplineTime

SplineEndPC BX Scaled Default Range❏ ❏ - 1 1 - 65535

Prototype:__int16 getSplineEnd (__uint8 axisNo, __uint16 *segmentNo)__int16 setSplineEnd (__uint8 axisNo, __uint16 segmentNo)

Description:A spline move will continue through the array specified with the SplineTable function untilthe segment set as the end segment is reached. If the spline is continuous then the move willjump to the start segment. The end segment must be within the number of segmentsspecified as the first element in the currently specified position array.

By default the number of segments in a table is given by the first element in the positionarray. If multiple profiles are required, the start and end segments can be used to selectmultiple profiles from within one array.

Page 308: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 308

When the Spline is executed, the start segment is set to 1 and the end segment set to the lastsegment in the table. After the call to Spline, any changes to the start or end segment arebuffered and do not occur until the end segment is reached.

Note that it is assumed that the first element has an array index value of 0, and the segmentvalues start at 1.

Parameters:axisNo specifies the axis for which the SPLINE table end segment is to be set or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

1 <= segmentNo <= Number of segments in table

Restrictions:None.

Default:The default end segment number is 1.

Example:float SplinePositions[21] = {20,10,20,30,40,50,60,70,80,90,100, 100,90,80,70,60,50,40,30,20,10};setSplineTable (0, &SplinePositions[0], NULL, NULL);setSplineStart (0, 10);setSplineEnd (0, 20);setSpline (0, 4);GO (1, 0);

The spline will be based on segments 10 to 20 (values 100 to 10).

See Also:

Spline, SplineIndex, SplineStart, SplineSuspendTime, SplineTable, SplineTime

SplineIndexPC BX Scaled Default Range❏ ❏ - 0 1 - 65535

Prototype:__int16 getSplineIndex (__uint8 axisNo, __uint16 *segmentNo)

Page 309: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 309

Description:Returns the currently executing spline segment number. If a spline move is not in progressthen the last segment number from the last spline move is returned.

Parameters:axisNo specifies the axis to read the index value from. or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

0 <= segmentNo <= Number of segments in table for a SPLINE.

Restrictions:None.

Default:The initial index value is zero.

Example:/*----------------------------------------------------------------------*//* Wait until the index has passed 10 before moving the start segment *//* of a continuous SPLINE from segment 1 to segment 10 *//*----------------------------------------------------------------------*/__int16 index;

do { getSplineIndex (4, &index);} while (index < 11);

setSplineStart (4, 10);

See Also:

Spline, SplineEnd, SplineStart, SplineSuspendTime, SplineTable, SplineTime

SplineSegmentPC BX Scaled Default Range❏ - - -

Prototype:__int16 setSplineSegment (__uint8 axisNo, __uint8 table, __uint16 startSegment, float* segmentArray)

Page 310: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 310

Description:When programming from the host using Immediate Command Mode, it is not possible tomodify a spline profile by changing the array data since the data was passed across DualPort RAM to NextMove. The SplineSegment function allows an array elements to bemodified from the host, even whilst a spline is in progress.

The change will have an immediate effect although if the spline is currently executing thespecified segment, the change will not be seen until the next time that segment is processed.

Parameters:axisNo specifies the axis to modify the data for.

0 <= axisNo < MAX_AXES.

table specifies which table to change:

Value Constant Meaning

0 ssPOS_TABLE Modify the position array data1 ssVEL_TABLE Modify the velocity array data2 ssTIME_TABLE Modify the duration array data

startSegment is the start segment for the modified data.

1 <= startSegment <= Number of segments in table

segmentArray is an array that holds the new data. The first element of this array MUSTspecify the number of data points that are being new table value.

Restrictions:SplineSegment may used in both host and embedded code.

Example:/*----------------------------------------------------------------------*//* Define a cam position array *//*----------------------------------------------------------------------*/float pos[11] = {10, 1, 2, 3, 4, 3, 4, 3, 4, 2, 0};float modify[4] = {3, 5, 10, 5}

/*----------------------------------------------------------------------*//* Load the array for the spline to use *//*----------------------------------------------------------------------*/setSplineTable (3, &pos[0], NULL, NULL);....

/*----------------------------------------------------------------------*//* Use SplineSegment to modify segments 4, 5, and 6 */

Page 311: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 311

/*----------------------------------------------------------------------*/setSplineSegment (3, ssPOS_TABLE, 4, &modify[0]);

This will modify 3 segments starting at segment 4.

See Also:

SplineTable, CamSegment

SplineStartPC BX Scaled Default Range❏ ❏ - 1 1 - 65535

Prototype:__int16 getSplineStart (__uint8 axisNo, __uint16 *segmentNo)__int16 getSplineStart (__uint8 axisNo, __uint16 segmentNo)

Description:A spline move will continue through the array specified with the SplineTable function untilthe segment set as the end segment is reached. If the spline is continuous then the move willjump to the start segment. The start segment must be within the number of segmentsspecified as the first element in the currently specified position array.

By default the number of segments in a table is given by the first element in the positionarray. If multiple profiles are required, the start and end segments can be used to selectmultiple profiles from within one array.

When the Spline is executed, the start segment is set to 1 and the end segment set to the lastsegment in the table. After the call to Spline, any changes to the start or end segment arebuffered and do not occur until the end segment is reached.

Note that it is assumed that the first element has an array index value of 0, and the segmentvalues start at 1.

Parameters:axisNo specifies the axis for which the SPLINE table end segment is to be set or read.

0 <= axisNo < MAX_AXES.

segmentNo is the end segment number.

1 <= segmentNo <= Number of segments in table

Restrictions:None.

Page 312: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 312

Default:The default end segment number is 1.

Example:float SplinePositions[21] = {20,10,20,30,40,50,60,70,80,90,100, 100,90,80,70,60,50,40,30,20,10};setSplineTable (0, &SplinePositions[0], NULL, NULL);setSplineStart (0, 10);setSplineEnd (0, 20);setSpline (0, 4);GO (1, 0);

The spline will be based on segments 10 to 20 (values 100 to 10).

See Also:

Spline, SplineEnd, SplineIndex, SplineSuspendTime, SplineTable, SplineTime

SplineSuspendTimePC BX Scaled Default Range❏ ❏ - 1000 4 - 60000

Prototype:__int16 getSplineSuspendTime (__uint8 axisNo, __uint32 *duration)__int16 setSplineSuspnedTime (__uint8 axisNo, __uint32 duration)

Description:Each spline is executed over a specified time period. For normal operation, the duration isset with a array of durations or with the SplineTime function.

In the event of a controlled stop, e.g. STOP is issued or an asynchronous error modeindicates a controlled stop, then a spline move will ramp to zero speed over the number ofmilliseconds specified with SplineSuspendTime.

When allowed to resume motion, the axis will continue to the current end of segmentposition with a duration of SplineSuspendTime.

The minimum spline segment duration is 4 milliseconds, with a minimum resolution of2ms. The maximum is 60000ms.

Parameters:axisNo specifies the axis on which the suspend duration is to be set.

0 <= axisNo < MAX_AXES

Page 313: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 313

Duration is the length of time in milliseconds that the segment lasts.

4 <= duration <= 60000

Restrictions:None.

Default:The default duration is 1000 milliseconds.

Example:/*----------------------------------------------------------------------*//* Set standard duration to 500ms. Pause duration of 2000ms *//*----------------------------------------------------------------------*/setSplineTime (1, 500);setSplineSuspendTime (1, 2000);

See Also:

SPLINE, SplineEnd, SplineIndex, SplineStart, SplineTable, SplineTime

SplineTablePC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setSplineTable (__uint8 axisNo, float *PosArray, float *VelArray, float *LengthArray)

Description:A Spline move is defined by splitting the motion into segments which form an array of datapoints. The information about these segments are stored in normal user arrays which canhave any name. Three arrays can be defined for a spline move, the position array, velocityarray and duration array.

Each segment of the position array specifies how far and in which direction the slave axiswill move for that segment. The first element of the position array specifies the number ofsegments defined for the spline and the subsequent values define the spline segmentpositions. The values are in user units, as set with the SCALE function and the array canhave any number of segments, (memory space permitting).

Page 314: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 314

When the spline is executed, each segment is processed in turn until the end segment isreached. A single shot spline will stop when the end of the table is reached. A continuousspline will repeat continue at the start segment when the end segment is reached. TheSpline function controls whether the spline is single shot or continuous. The positions inthe array can be interpreted in three ways; relative, absolute to the cycle or true absolute.

The velocity array allows for end of segment velocities to be defined. The velocities aredefined in user units/second. If velocity information is defined, then the spline performs aPVT profile. If the no velocity array is required, then NULL must be passed instead.

Each spline segment is executed over a specified time duration. All segments can be set touse the same duration with SplineTime. Alternatively, an array of segment durations can bedefined. The durations are in milliseconds and are relative, not absolute to the start ofmotion.

The ability to define a duration array allows for critical points on a move to be defined moreeasily. Where the motion is not critical, a large durations can be set so the axis travels alarge distance in only one or two segments. Then where the motion is more important,smaller durations are defined, allowing the segment moves to be smaller and more detailed.The minimum segment duration is 4 milliseconds. If the duration array is not required for aspline then NULL must be passed instead.

The minimum spline segment duration is 4 milliseconds, with a minimum resolution of2ms.

The SplineTable function is used to specify which arrays to use for a spline move on theaxis. The velocity and duration array names are optional. The arrays will be used on allfurther moves on the axis until the next call to SplineTable.

Parameters:axisNo specifies the axis for which the SPLINE tables are being defined.

0 <= axisNo < MAX_AXES

PosArray is the address of the position table.

MIN_FLOAT <= position element <= MAX_FLOAT

VelArray is the address of the velocity table.

MIN_FLOAT <= velocity element <= MAX_FLOAT

LengthArray is the address of the duration table.

4 <= duration element <= 60000

Page 315: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 315

Restrictions:The axis cannot be performing a spline move or a erMOTION_IN_PROGRESS error willresult.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Define a position table to have 10 segments and a velocity table *//* Set these up on axis 0. *//*----------------------------------------------------------------------*/float points[11] = {10, 0.2, 0.3, -0.1, -0.1, 1.22, 3, 4.5, 0.3, 0, 0.1};float speeds[10] = {10, 20, 20, 15, 10, 5, 10, 15, 20, 20};

/*----------------------------------------------------------------------*//* Use ‘points’ as position table and ‘speeds’ as velocity table. No *//* duration table has been defined *//*----------------------------------------------------------------------*/setSplineTable (0, &points[0], &speeds[0], NULL);

See Also:

Spline, SplineEnd, SplineIndex, SplineSuspendTime, SplineStart, SplineTime

SplineTimePC BX Scaled Default Range❏ ❏ - 1000 4 - 60000

Prototype:__int16 getSplineTime (__uint8 axisNo, __uint32 *duration)__int16 setSplineTime (__uint8 axisNo, __uint32 duration)

Description:Each spline segment is executed over a specified time period. Either a global time periodcan be set for all segments or segments can have their durations individually set.

The SplineTime function is used to set the global segment duration, the value beingspecified in milliseconds.

In the event of a controlled stop, e.g. STOP is issued or an asynchronous error modeindicates a controlled stop, then a spline move will ramp to zero speed over the number ofmilliseconds specified with the SplineSuspendTime.

The minimum spline segment duration is 4 milliseconds, with a minimum resolution of2ms. The maximum is 60000ms.

Page 316: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 316

Parameters:axisNo specifies the axis on which the standard duration is to be set.

0 <= axisNo < MAX_AXES

duration is the length of time in seconds that the segment lasts.

4 <= duration <= 60000

Restrictions:None.

Default:The default segment duration is 1000ms.

Example:/*----------------------------------------------------------------------*//* Check the current default duration. If it is less than 0.5 seconds *//* then set it to 2 seconds. *//*----------------------------------------------------------------------*/__int16 checkDuration (__uint8 axis){ float duration; __int16 result;

result = getSplineTime( axis, &duration ); if (result) return; if ( duration < 500 ) { setSplineTime( axis, 2000 ); }}

See Also:

Spline, SplineEnd, SplineIndex, SplineSuspendTime, SplineStart, SplineTable

STATUSNODEPC BX Scaled Default Range❏ ❏ - - -1 - 63

Prototype:__int16 STATUSNODE (__int16 *node)

Description:The CANSTATUS function returns a bit pattern that indicates the cause of an asynchronousCAN error or event relating to a node. The STATUSNODE function is used to read thenode identifier that caused the event or error.

Page 317: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 317

Error and event changes are stored in an internal buffer when they occur. Only when bothCANSTATUS and STATUSNODE functions have been read will an entry be removedfrom the buffer. Therefore, CANSTATUS and STATUSNODE are read as a pair.

STATUSNODE will return the identifier of the node in the range 1 to 63. If the event orerror CANSTATUS described relates to NextMove, then the node number will be reportedas -1.

Parameters:None.

Restrictions:None.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Check for any CAN events or errors: Call a user function *//* reportCANProblem(). *//*----------------------------------------------------------------------*/__uint16 canError;__int16 node;

do { canError = CANSTATUS(); if (canError & 0x58) node = STATUSNODE(); reportCANProblem (canError, node);} while (canError);

See Also:

AsyncError, CANSTATUS, RemoteStatus, SystemError

StepDirectionPC BX Scaled Default Range❏ - - 0 0 - 1

Prototype:__int16 setStepDirection (__uint8 axisNo, __uint8 state);

Page 318: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 318

Description:Each stepper axis has a pulse, direction and boost output. The boost output is always underdirect user control with the Boost function. The StepDirection function allows the user tocontrol the state of stepper’s direction output. The axis must be configured as off to be ableto use the StepDirection function.

Using the StepDirection function will overwrite a frequency direction set previously withthe FREQ function.

The direction outputs provided by a stepper NextMove expansion board can also becontrolled.

Parameters:axisNo specifies the stepper axis.

0 <= axisNo < MAX_AXES.

state specifies the state of the output:

0 - output inactive.1 - output active.

Restrictions:None.

Default:None.

Example:/*----------------------------------------------------------------------*//* Turn the stepper pulse and direction outputs on on axis 7 *//*----------------------------------------------------------------------*/setCONFIG (7, cfOFF);setPulse (7, 1);setStepDirection (7, 1);

See Also:

Boost, CONFIG, FREQ, OUT, OUTx, Pulse

Page 319: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 319

STOPPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 STOP (__uint8 axisNo)

Description:Performs a controlled stop on axis axisNo. Any motion on the axis is ramped to zero speedat the current deceleration rate then cancelled. Move types that do not use the currently setACCEL and DECEL ramps (mdFLY, mdCAM etc.) will crash stop.

Parameters:axisNo specifies the axis on which motion is to be stopped.

0 <= axisNo < MAX_AXES.

Restrictions:None. A multi-axis move (e.g. CIRCLER, VECTORA) may be stopped by calling STOPwith any of the participating axes - you do not have to specify the master axis.

When called from the host in Immediate Command Mode, from Visual Basic, the function isrenamed doSTOP.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Jog axis #2 until an input becomes active, then return to zero. *//*----------------------------------------------------------------------*/setJOG (2, 100); /* start jogging at 100 mm/s */state=0;while (!state) { INx (18, &state); /* wait for input #18 to become active */}STOP (2); /* stop the axis */isidle=0;while (!isidle) { getIDLE (2, &isidle); /* wait for the axis to stop */}setMOVEA (2, 0); /* set up the move to absolute zero */GO (1, 0); /* and trigger it */

See Also:

ABORT, CANCEL, DECEL

Page 320: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 320

STOPSWPC BX Scaled Default Range❏ ❏ - - 0 - 1

Prototype:__int16 getSTOPSW (__uint8 axisNo, __uint8 *state)

Description:Returns the current state of the stop switch input on axis axisNo. The input channel andactive state of the input are both software configurable. Each axis may be configured tohave its own stop switch input, share an input with any number of other axes or have no stopswitch input. The stop switch input is specified with the StopSwitchInput function. Theaction taken when the stop switch is activated is set with the StopSwitchMode function.

Parameters:axisNo specifies the axis on which the stop switch status is to be returned.

0 <= axisNo < MAX_AXES.

state returns the state of the stop input.

0 - the stop switch input is inactive or no input has been specified.1 - the stop switch input is active.

Restrictions:None. The stop switch may be read at any time.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Stop switch handler. Waits for the stop switch on axis #0 to be *//* reset or the condition acknowledged via an input. If the condition *//* is acknowledged any motion is cancelled. *//*----------------------------------------------------------------------*/void myStopSwitchHandler (void){ while (1) { getSTOPSW( 0, &switch); if (switch) break; /* stop switch reset so quit */ INx (20, &state); if (state) { /* input acknowledge so.. */ CANCEL (0); /* cancel any motion before quitting */ break; } }

Page 321: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 321

}

void main (void){ setStopSwitchHandler (myStopSwitchHandler); /* install the handler */}

See Also:

ActiveInputLevel, InputActiveMode, StopSwitchHandler, StopSwitchInput,StopSwitchMode

StopSwitchHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setStopSwitchHandler (TStopSwitchHandler *handler)

Description:Installs a user handler that will be called in response to any active stop switch input. Thestop switch input is specified with the StopSwitchInput function. The motion on the axisand any other axis involved in the move will be halted according to the mode set byStopSwitchMode.

Parameters:handler is the address of the user supplied function that will be called in response to anactive stop input. TStopSwitchHandler is defined in the file MG.H as:

typedef void TStopSwitchHandler (void)

Possible Errors:NextMove will call the function whose address is passed in handler provided that theaddress is non-zero. NextMove does not, and cannot, determine whether the address is valid.

Restrictions:None.

Default:By default there is no user supplied handler.

Example:/*----------------------------------------------------------------------*//* Stop switch handler. Waits for the stop switch on axis #0 to be *//* reset or the condition acknowledged via an input. If the condition */

Page 322: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 322

/* is acknowledged any motion is cancelled. *//*----------------------------------------------------------------------*/void myStopSwitchHandler (void){ while (1) { getSTOPSW( 0, &switch); if (switch) break; /* stop switch reset so quit */ INx (20, &state); if (state) { /* input acknowledge so.. */ CANCEL (0); /* cancel any motion before quitting */ break; } }}

void main (void){ setStopSwitchHandler (myStopSwitchHandler); /* install the handler */}

See Also:

ActiveInputLevel, InputActiveMode, STOPSW, StopSwitchInput,StopSwitchMode

StopSwitchInputPC BX Scaled Default Range❏ ❏ - - 0 -23 PC

0 - 15 BX

Prototype:__int16 getStopSwitchInput (__uint8 axisNo, __int16 *inputChannel)__int16 setStopSwitchInput (__uint8 axisNo, __int16 inputChannel)

Description:Sets or returns the user digital input channel configured to be the stop switch input. Eachaxis may be configured to have its own stop switch input, share an input with any number ofother axes or have no stop switch input. When an axis stop switch input becomes active,action is taken according to the mode set by the StopSwitchMode function. The currentstate of the stop switch input can be checked with the STOPSW function.

Parameters:axisNo specifies the axis on which the stop switch input is to be set or returned.

0 <= axisNo < MAX_AXES.

inputChannel specifies the user digital input that is connected to the stop switch.

-1 <= inputChannel < MAX_INPUTS

Page 323: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 323

-1 : axisNo has no stop switch.

Restrictions:None.

Default:There is no default stop switch input.

Example:/*----------------------------------------------------------------------*//* Disable all stop switch inputs except for axis #3. *//*----------------------------------------------------------------------*/void configureStopSwitchInputs (void){ __uint8 ax;

for (ax=0; ax<MAX_AXES; ax++) setStopSwitchInput (ax, -1); /* disable all stop switch inputs */ setStopSwitchInput (3, 5); /* set stop switch input for axis #3 */}

See Also:

ActiveInputLevel, InputActiveMode, STOPSW, StopSwitchHandler,StopSwitchMode

StopSwitchModePC BX Scaled Default Range❏ ❏ - 0 0 - 3

Prototype:__int16 getStopSwitchMode (__uint8 axisNo, __uint8 *mode)__int16 setStopSwitchMode (__uint8 axisNo, __uint8 mode)

Description:Specify or read back the action to be taken when a stop input becomes active. A digital inputis assigned as an axis stop switch input using the StopSwitchInput function. The user stopswitch handler is called if one is defined. The axis will be brought to a stop according to themode specified.

Parameters:axisNo specifies the axis on which the mode is configured.

0 <= axisNo < MAX_AXES.

Page 324: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 324

mode specifies the action that should be taken when a stop input becomes active. mode maytake one of the following values:

Value Constant Meaning

0 siIGNORE No action, just call the handler if it exists.1 siNORMAL Any motion on axis axisNo is ramped to zero speed at the

current ErrorDeceleration rate. The user defined stop switchhandler is called when motion stops. The motion willresume when the stop input becomes inactive.

2 siSTOP Any motion on axis axisNo is ramped to zero speed at thecurrent ErrorDeceleration rate. The user defined stop switchhandler is called when motion stops and the current movetype is cleared. (Equivalent to issuing a STOP).

3 siCANCEL Any motion on axis axisNo is crash stopped. The userdefined stop switch handler is called.

Restrictions:None.

Default:The default mode is siNORMAL.

Example:/*----------------------------------------------------------------------*//* Set input 3 as the stop input for axis 4. Set mode to siSTOP. *//*----------------------------------------------------------------------*/setStopSwitchInput ( 4, 3);setStopSwitchMode ( 4, siSTOP);

See Also:

STOP, STOPSW, StopSwitchHandler, StopSwitchInput

SuspendPC BX Scaled Default Range❏ ❏ - 0 0 - 1

Prototype:__int16 getSuspend (__uint8 axisNo, __uint8 *state)__int16 setSuspend (__uint8 axisNo, __uint8 state)

Page 325: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 325

Description:The Suspend function can be used to temporarily halt a move. The move will ramp down tozero speed and remain stationary until the move is resumed or cleared. The mode of motionwill continue to show the move type whilst the move has been suspended. Suspend onlyapplies to the following move types:

mdLINEARmdCIRCULARmdSPLINE

The MoveBufferStatus function can be used to read when the move has come to rest due tothe pause.

Parameters:axisNo specifies the axis on which motion is to be suspended.

0 <= axisNo < MAX_AXES.

state specifies if the axis is to suspend or resume motion.

1 : suspend the current move0 : resume the current move

Restrictions:In multi-axis moves, the suspend must be issued on the master axis in order to suspend themove.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* If use remote node 3, input 0 as a switch that controls suspend on *//* axis 0. *//*----------------------------------------------------------------------*/void checkSuspend (void){ __uint8 state;

getRemoteINx (3, 0, &state); setSuspend (0, state);}

See Also:

STOP

Page 326: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 326

SystemErrorPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 getSystemError (TSystemError *systemError)__int16 setSystemError (TSystemError *systemError)

Description:System errors occur when a call to a function fails. This is generally due to passingincorrect parameters to the function or sequencing and configuration problems.

When a system error occurs, the details are written into an internal structure. The ‘get’function copies that internal structure into a users copy so that it can be examined.

Errors can be cleared by the user by writing to the user copy of the error structure. This usercopy is then copied back to the internal structure using the ‘set’ function. It is also possibleto create errors by writing to the system error structure.

Only the first system error to occur is recorded in the structure. Subsequent system errorswill not be detailed until the structure is cleared.

See chapter 3.5 for full details on errors and error handling.

Parameters:systemError is a pointer to the user supplied TSystemError structure into which or fromwhich the data is to be moved.

TSystemError is defined as:typedef struct { __uint32 code; /* the error code */ __int32 data; /* the axis, channel or data involved */ __uint32 id; /* enumeration of the function involved */} TSystemError;

See section 3.5.1.1 for details on possible system error codes.

Restrictions:None.

Default:Not applicable.

Page 327: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 327

Example:/*----------------------------------------------------------------------*//* A user function to check for system errors. Called by the user when *//* thought appropriate. *//*----------------------------------------------------------------------*/void mySysErrHandler (void){ TSystemError sysErr; /* sysErr is users structure */

getSystemError (&sysErr);

if (sysErr.code) { /*------------------------------------------------------------------*/ /* There is a system error. Take action if needed depending on code */ /*------------------------------------------------------------------*/ .......; sysErr.code=0; /* Clear error structure once error handled */ sysErr.data=0; sysErr.id=0; }}

See Also:

AsyncError, AxisStatus, ERROR, ErrorHandler, ErrorMask

Page 328: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 328

tClsPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 tCls (__int16 port, __int8 vt)

Description:Clears the screen on either a VT100 or VT52 compatible display.

cTERM for Windows and NextMove WorkBench are both configured as VT100 terminals.CAN keypads will ignore the vt parameter.

Parameters:port defines the terminal input port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

vt terminal port type

Value Constant Description

1 VT100 VT 100 terminal2 VT52 VT 52 terminal

Possible Errors:tCls will be ignored if the port number is invalid.

Restrictions:None.

Example:tCls( tmRS232, VT100 );

Page 329: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 329

See Also:

tLocateCursor, tPrintf

tGetCharPC BX Scaled Default Range❏ ❏ - -

Prototype:__int16 tGetChar (__int16 port, __int16 *ch)

Description:Returns the next character from the defined terminal input port.

If no character is available, tGetChar returns erTERMINAL_BUFFER_EMPTY and thecharacter parameter is set to -1. This allows two tests for an empty buffer.

do { tGetChar (tmRS232, &ch);} while (ch == -1);while (tGetChar (tmRS485, &ch) == erTERMINAL_BUFFER_EMPTY);

Parameters:port defines the terminal input port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

ch the character read from the port

Possible Errors:tGetChar() shall return any of the following errors:

erSUCCESS Function was successful.erTERMINAL_BUFFER_EMPTY No character was available for reading.erTERMINAL_OUT_OF_RANGE port value was out of range.

erTERMINAL_UNAVAILABLE terminal (port) does not exist on this controller.

Page 330: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 330

Restrictions:None.

Example:int16 getLine( char *buffer ){ int16 i = 0; int16 ch;

do { tGetChar( tmRS232, &ch ); if( ch != -1 ) { *buffer++ = (char) ch; i++; } } while(ch != ‘\n’);

return i;}

See Also:

tGetChar, tPrintf

TIMEPC BX Scaled Default Range❏ ❏ - 0 0 - 4294967295

Prototype:__int16 getTIME (__uint32 *millisecond)__int16 setTIME (__uint32 millisecond)

Description:Accesses the free running 32 bit millisecond tick counter maintained by NextMove. Aninternal register is incremented every 1ms. The counter can be read from and written towithout restriction. It is useful for timing code segments or implementing time-outs withinloops.

Parameters:millisecond is the new time to set counter to.

0 <= millisecond < 4294967295

Restrictions:None.

Page 331: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 331

Default:The counter is zeroed at power up or board reset.

Example:/*----------------------------------------------------------------------*//* Wait for 500ms for input 1 to become active *//*----------------------------------------------------------------------*/__uint32 timeThen;__uint32 timeNow;__uint8 state;

getTIME(&timeThen); /* Read the current tick counter */do { getINx (1, &state); /* Read input 1 */ getTIME(*timeNow); /* Read the current tick counter */} while (!state && (timeNow - timeThen < 500));

See Also:

WAIT

tLocateCursorPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 tLocateCursor (__int16 port, __int8 vt, __int8 column, __int8 row)

Description:Locates the cursor on either a VT100 or VT52 compatible display.

The top left of the screen is defined with co-ordinates 1,1.

cTERM for Windows and NextMove WorkBench are both configured as VT100 terminals.CAN keypads ignore the vt parameter.

1,1

column

row

Page 332: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 332

Parameters:port defines the terminal input port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

vt terminal port type (VT100 or VT52)

column column number to place cursor. Values start at 1.row row number to place the cursor. Values start at 1.

Possible Errors:tLocateCursor will be ignored if the port number is invalid.

Restrictions:None.

Example:tCls( tmRS232, VT100 );

See Also:

tCls, tPrintf

TORQUEPC BX Scaled Default Range❏ ❏ - - -100 - 100

Prototype:__int16 getTORQUE (__uint8 axisNo, float *iMaxPercentage)__int16 setTORQUE (__uint8 axisNo, float iMaxPercentage)

Page 333: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 333

Description:Sets or returns the DAC output voltage as a percentage of the full scale DAC output. Whenoperating in torque mode the DAC output is a motor current or torque demand. The fullscale DAC output represents the peak motor current. Torque mode is cancelled by callingCANCEL, RESET or STOP.

The jog move is capable of blending. This means that the axis does not have to be idlebefore the move is set up. When the jog move is started, the axis will accelerate ordecelerate from the current velocity to the jogSpeed using the current acceleration anddeceleration rates. Blending cannot be performed from the following move types:

mdHOMINGmdCIRCULARmdLINEAR (VECTORA and VECTORR)

Parameters:axisNo specifies the axis on which the torque demand is to be set or returned.

0 <= axisNo < MAX_AXES

iMaxPercentage specifies the open loop torque demand as a percentage of the peak motortorque assuming that the amplifier produces peak current for a 10v demand and that theamplifier is operating in torque mode.

-100 <= iMaxPercentage <= 100

Restrictions:Only applicable to axes configured as cfSERVO. The axis must be idle or be inmdTORQUE. The axis cannot be in error.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Use torque mode to locate an end stop. *//*----------------------------------------------------------------------*/setTORQUE (0, 10); /* set open loop torque to 10% */WAIT (500); /* wait a while for axis to start up */getVEL (0, &velocity);while (velocity > 0) { /* wait until axis has hit end stop */ getVEL (0, &velocity);}CANCEL (0); /* cancel torque mode, start servoing */ZERO (0); /* set new reference position */

Page 334: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 334

See Also:

CURRLIMIT, DAC, DEMAND, JOG, MODE

tPrintfPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 tPrintf (__int16 port, __int16 *length, const char *fStr, …)

Description:Formats the string and transmits it to the defined terminal output port.

tPrintf calls tPutString. tPrintf will transmit the entire string and will wait as necessary ifthe transmit buffer is full. A subset of the printf formatting options are supported. Anadditional parameter is also introduced for printing binary numbers. The format specifiershave the following form:

% [flags] [width] [.prec] [l] type

type:

type Format of output

d signed decimal intu unsigned decimal intX unsigned hexadecimal int displayed in uppercase (ABCDEF)x unsigned hexadecimal int displayed in uppercase (ABCDEF)b unsigned binary intf floating point value of the form [-]dddd.ddddc single characters prints characters until a null terminator is reached% displays the % character

flags:

Flag Format of output

- Left justifies the result, pads on the right with blanks. If not given, right-justifies the result, pads on left with blanks or zeros (if 0 follows -).Example: “%-04d”

+ Signed results always begin with a plus (+) or minus (-)

Page 335: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 335

width:

Width Format of output

n At least n characters are printed. If the output has less than n characters,the output is padded with blanks (right passed if - flag given, left paddedotherwise).

0n At least n characters are printed. If the output value has less than ncharacters, it is filled with on the left with zeros.

* The argument list supplies the width specifier, which must precede theactual argument being formatted.

.prec:

Prec Format of output

.n n decimal places are printed* The argument list supplies the width specifier, which must precede the

actual argument being formatted.

l:Specifies that the decimal number is a long integer.

Parameters:port defines the terminal output port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

length returns the number of characters displayed. Pass NULL (0) if not required.

fStr format string of the form: “Position on axis %d is %f\n\r”

… variable argument list.

Possible Errors:tPrintf will return any of the following errors:

Page 336: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 336

erSUCCESS Function was successful.erTERMINAL_OUT_OF_RANGE port value was out of range.

erTERMINAL_UNAVAILABLE terminal (port) does not exist on this controller.

Restrictions:None.

Example 1:tPrint16f (tmRS232, 0, “Position on axis %d is %f\n\r”, a, p );

See Also:

tGetChar, tPutChar, tPutString

tPutCharPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 tPutChar (__int16 port, __int16 ch)

Description:Transmits the character to the defined terminal output port.

If the buffer is full, tPutChar returns erTERMINAL_BUFFER_FULL.

Note: tPutChar is called by the functions tPutString and tPrintf.

Parameters:port defines the terminal input port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

ch the character to output to the port

Page 337: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 337

Possible Errors:tPutChar will return any of the following errors:

erSUCCESS Function was successful.erTERMINAL_BUFFER_FULL No character was available for reading.

erTERMINAL_OUT_OF_RANGE port value was out of range.erTERMINAL_UNAVAILABLE terminal (port) does not exist on this controller.

Restrictions:None.

Example:tPutChar( tmRS232, ‘*’ );

See Also:

tGetChar, tPrintf, tPutString

tPutStringPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 tPutString (__int16 port, __int16 *length, const char *str)

Description:Transmit the complete string to the defined terminal output port.

tPutString will transmit the entire string and will wait as necessary if the transmit buffer isfull.

Parameters:port defines the terminal input port

Value Port Description

1 tmRS232 RS232 serial port2 tmRS485 RS485 serial port4 tmDPR Dual Port RAM pseudo serial port8 tmLCD1 CAN operator panel 1

16 tmLCD2 CAN operator panel 232 tmLCD3 CAN operator panel 364 tmLCD4 CAN operator panel 4

Page 338: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 338

str the string to output to the port

Possible Errors:tPutString will return any of the following errors:

erSUCCESS Function was successful.erTERMINAL_BUFFER_FULL No character was available for reading.

erTERMINAL_OUT_OF_RANGE port value was out of range.erTERMINAL_UNAVAILABLE terminal (port) does not exist on this controller.

Restrictions:None.

Example:tPutChar( tmRS232, ‘*’ );

See Also:

tGetChar, tPrintf

Page 339: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 339

UIntPC BX Scaled Default Range❏ - - 0 - 65535

Prototype:__int16 getUInt (__int16 address, __uint16 *value)__int16 putUInt (__int16 address, __uint16 value)

Description:Allows an unsigned 16 bit number to be read or written to dual port RAM. Dual port RAMis split into a number of areas for different purposes. There are some areas spare for userdata transfer. One location is used since DPR is 16 bits wide. See the ‘MINT InterfaceLibrary Users Guide’ for details on dual port RAM usage.

Parameters:address specifies the dual port RAM offset.

0 <= address < 0x3FF

value is the value to be written or read from dual port RAM.

Restrictions:Some areas should not be changed manually. See the ‘MINT Interface Library Users Guide’for details on dual port RAM usage.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Write the contents of an array, tolerances[10], to 0x200 *//*----------------------------------------------------------------------*/for (count = 0; count < 10; count++) { putUInt (0x200 + count, tolerances[count]);}

See Also:

Comms, Float, Long, Word

Page 340: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 340

UserInterruptPeriodPC BX Scaled Default Range❏ ❏ - 8 8 - 4294967295

Prototype:__int16 setUserInterruptPeriod (__uint32 quarterMsTicks)

Description:Sets the interval between calls to the user supplied periodic interrupt handler.

Parameters:quarterMsTicks is the number of 250 microsecond intervals between calls.

8 <= quarterMsTicks <= 232-1

Restrictions:None.

Default:By default the user interrupt period is set to 8 * 250ms = 2ms.

Example:/*----------------------------------------------------------------------*//* User periodic interrupt handler. Increments a number of user *//* defined counters. *//*----------------------------------------------------------------------*/void myHandler (void){ __int16 i;

for (i=0; i<20; i++) counter [i]++; /* increment counters */}void main (void){ setUserInterruptHandler (myHandler); /* install the handler */ setUserInterruptPeriod (4000); /* call the handler every second */}

See Also:

UserInterruptHandler

Page 341: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 341

UserInterruptHandlerPC BX Scaled Default Range❏ ❏ - - -

Prototype:__int16 setUserInterruptHandler (TInterruptHandler *handler)

Description:Installs a user handler that will be called at a frequency specified by UserInterruptPeriod.All interface functions are available to the handler. The handler is typically used to monitoror update user program variables on a regular basis.

Parameters:handler is the address of the user supplied function that will be called periodically.TInterruptHandler is defined in the file MG.H as:

typedef void TInterruptHandler (void)

Possible Errors:NextMove will call the function whose address is passed in handler provided that theaddress is non-zero. NextMove does not, and cannot, determine whether the address is valid.

Restrictions:None.

Default:By default there is no user supplied handler.

Example:/*----------------------------------------------------------------------*//* User periodic interrupt handler. Increments a number of user *//* defined counters. *//*----------------------------------------------------------------------*/void myHandler (void){ __int16 i;

for (i=0; i<20; i++) counter [i]++; /* increment counters */}

void main (void){ setUserInterruptHandler (myHandler); /* install the handler */}

Page 342: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 342

See Also:

UserInterruptPeriod

Page 343: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 343

VECTORAPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getVECTORA (__uint8 axisNo, float *targetPosition)__int16 setVECTORA (__uint8 numberOfDataPairs, ...)

Description:Returns the absolute target position, in user units, from axis axisNo.

Sets up a vectored (linearly interpolated) positional move on one or more axes. If only oneaxis is specified VECTORA is the same as MOVEA. After a successful call toVECTORA the first axis specified (the master axis) will have a move pending of typemdLINEAR. The move will not execute until triggered by a call to GO.

The move will continue until the specified vector has been completed unless the move isterminate by the user with STOP, CANCEL or RESET.

Parameters:VECTORA takes a variable number of arguments arranged as data pairs. Each pair consistsof an axis number and an absolute position and must be passed as (__uint8, float).

numberOfDataPairs specifies the number of arguments passed from the caller.

1 <= numberOfDataPairs <= MAX_AXES.

Each axis number specifies the axis to which the following absolute position relates.

0 <= axis number < MAX_AXES.

Each absolute position specifies the target position, in user units, to which the axis isrequired to move.

MIN_FLOAT <= absolute position <= MAX_FLOAT.

targetPosition is the target position of axis axisNo.

MIN_FLOAT <= targetPosition <= MAX_FLOAT.

Restrictions:If the length of the resultant move is zero no move will be generated. VECTORA will waitfor a free slot in all participating axis move buffers. To avoid the call hanging you shouldtest for a free slot prior to calling VECTORA by calling okToLoadMove. Each axisinvolved in the move must be able to move ie: not configured as cfOFF. The axis must beidle or have a move of type mdLINEAR or mdCIRCULAR loaded and not be in error.

Page 344: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 344

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* A number of simple examples to demonstrate the variable argument list*//*----------------------------------------------------------------------*/{ setVECTORA (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, 10.0, /* integer values expressed as floats */ 1, -25.0); /* to satisfy the argument type */ GO (1, 1); /* specify any axis involved to start */}

{ float pos1 = -25; /* same move specified by variables */ float pos3 = 10;

setVECTORA (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, pos3, /* variables are of the correct type */ 1, pos1); /* */ GO (1, 1); /* specify any axis involved to start */}

{ __int16 pos1 = -25; /* same move again but positions are */ __int16 pos3 = 10; /* stored as integers */

setVECTORA (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, (float)pos3, /* cast integers to floats to satisfy */ 1, (float)pos1); /* the argument type */ GO (1, 3); /* specify any axis involved to start */}

See Also:

ACCEL, CIRCLEA, CIRCLER, CONTON, DECEL, GO, IDLE, MOVEA,MoveBufferSize, MOVER, okToLoadMove, RAMP, SPEED, VECTORR

VECTORRPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getVECTORR (__uint8 axisNo, float *targetPosition)__int16 setVECTORR (__uint8 numberOfDataPairs, ...)

Description:Returns the absolute target position, in user units, from axis axisNo.

Page 345: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 345

Sets up a vectored (linearly interpolated) positional move on one or more axes. If only oneaxis is specified VECTORR is the same as MOVER. After a successful call toVECTORR the first axis specified (the master axis) will have a move pending of typemdLINEAR. The move will not execute until triggered by a call to GO.

The move will continue until the specified vector has been completed unless the move isterminate by the user with STOP, CANCEL or RESET.

Parameters:VECTORR takes a variable number of arguments arranged as data pairs. Each pair consistsof an axis number and a relative position and must be passed as (__uint8, float).

numberOfDataPairs specifies the number of arguments passed from the caller.

1 <= numberOfDataPairs <= MAX_AXES.

Each axis number specifies the axis to which the following relative position relates.

0 <= axis number < MAX_AXES.

Each relative position specifies the distance, in user units, by which the axis is required tomove.

MIN_FLOAT <= relative position <= MAX_FLOAT.

targetPosition is the target position of axis axisNo.

MIN_FLOAT <= targetPosition <= MAX_FLOAT.

Restrictions:If the length of the resultant move is zero no move will be generated. setVECTORR willwait for a free slot in all participating axis move buffers. To avoid the call hanging youshould test for a free slot prior to calling setVECTORR by calling okToLoadMove. Eachaxis involved in the move must be able to move ie: not configured as cfOFF. The axis mustbe idle or have a move of type mdLINEAR or mdCIRCULAR loaded and not be in error.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* A number of simple examples to demonstrate the variable argument list*//*----------------------------------------------------------------------*/{ setVECTORR (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, 10.0, /* integer values expressed as floats */ 1, -25.0); /* to satisfy the argument type */ GO (1, 1); /* specify any axis involved to start */

Page 346: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 346

}

{ float pos1 = -25; /* same move specified by variables */ float pos3 = 10;

setVECTORR (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, pos3, /* variables are of the correct type */ 1, pos1); /* */ GO (1, 1); /* specify any axis involved to start */}

{ __int16 pos1 = -25; /* same move again but positions are */ __int16 pos3 = 10; /* stored as integers */

setVECTORR (2, /* 2 data pairs are passed (axes 3 & 1)*/ 3, (float)pos3, /* cast integers to floats to satisfy */ 1, (float)pos1); /* the argument type */ GO (1, 3); /* specify any axis involved to start */}

See Also:

ACCEL, CIRCLEA, CIRCLER, CONTON, DECEL, GO, IDLE, MOVEA,MoveBufferSize, MOVER, okToLoadMove, RAMP, SPEED, VECTORA

VELPC BX Scaled Default Range❏ ❏ ❏ - -8388607.0 - 8388607.0

Prototype:__int16 getVEL (__uint8 axisNo, float *measuredVelocity)

Description:Returns the instantaneous velocity of axis axisNo.

Parameters:axisNo specifies the axis on which the velocity should be returned.

0 <= axisNo < MAX_AXES

measuredVelocity is the axis velocity in user units.

Page 347: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 347

Restrictions:None. Due to quantisation errors typical of any sampled system the value returned by VELis inaccurate at low speeds. VEL returns the change in position measured during the lastsampling period expressed in user units. The minimum value, other than zero, that VEL canreturn equates to an encoder edge frequency of 1 kHz (the sampling frequency). eg: if youprogram in revs and there are 2,000 edges per rev. the minimum non-zero VEL will be +/-30 rpm.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Use torque mode to locate an end stop. *//*----------------------------------------------------------------------*/setTORQUE (0, 10); /* set open loop torque to 10% */WAIT (500); /* wait a while for axis to start up */while (velocity > 1) { getVEL (0, &velocity); /* wait until axis has hit end stop */}CANCEL (0); /* cancel torque mode, start servoing */ZERO (0); /* set new reference position */

See Also:

AuxEncoderVel, EncoderVel, SPEED

Page 348: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 348

WAITPC BX Scaled Default Range❏ ❏ - - 0 - 4294967296

Prototype:__int16 WAIT (__uint32 time)

Description:Pauses program execution for a period of time.

Parameters:time is the period in milliseconds for which the function should wait before returning.

0 <= time <= 232-1

Restrictions:The minimum resolvable time period is 2ms.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Toggle an output at 1 Hz. *//*----------------------------------------------------------------------*/while (1) { setOUTx (6, True); /* activate output */ WAIT (500); /* wait half a second */ setOUTx (6, False); /* deactivate output */ WAIT (500); /* wait half a second */}

See Also:

TIME

WordPC BX Scaled Default Range❏ - - -32767 - 32767

Prototype:__int16 getWord (__int16 address, __int16 *value)__int16 putWord (__int16 address, __int16 value)

Page 349: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 349

Description:Allows a signed 16 bit number to be read or written to dual port RAM. Dual port RAM issplit into a number of areas for different purposes. There are some areas spare for user datatransfer. One location is used since DPR is 16 bits wide. See the ‘MINT Interface LibraryUsers Guide’ for details on dual port RAM usage.

Parameters:address specifies the dual port RAM offset.

0 <= address < 0x3FF

value is the value to be written or read from dual port RAM.

Restrictions:Some areas should not be changed manually. See the ‘MINT Interface Library Users Guide’for details on dual port RAM usage.

Default:Not Applicable.

Example:/*----------------------------------------------------------------------*//* Write the contents of an array, tolerances[10], to 0x200 *//*----------------------------------------------------------------------*/for (count = 0; count < 10; count++) { putWord (0x200 + count, tolerances[count]);}

See Also:

Comms, Float, Long, UInt

Page 350: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 350

ZEROPC BX Scaled Default Range❏ ❏ ❏ -

Prototype:__int16 ZERO (__uint8 axisNo)

Description:Sets the present axis position to zero. Equivalent to calling setPOS (axisNo, 0).

Parameters:axisNo specifies the axis whose position is to be zeroed.

0 <= axisNo < MAX_AXES.

Restrictions:The axis must be idle before calling ZERO.

Default:Not applicable.

Example:/*----------------------------------------------------------------------*//* Use torque mode to locate an end stop. *//*----------------------------------------------------------------------*/setTORQUE (0, 10); /* set open loop torque to 10% */WAIT (500); /* wait a while for axis to start up */getVEL (0, &velocity);while (velocity > 1) { getVEL (0, &velocity);/* wait until axis has hit end stop */}CANCEL (0); /* cancel torque mode, start servoing */ZERO (0); /* set new reference position */

See Also:

IDLE, MODE, POS

ZLatchPC BX Scaled Default Range❏ ❏ - 0 0 - 1

Prototype:__int16 getZLatch (__uint8 latchNo, __uint8 *state)

Page 351: NextMove MINT™ Motion Libraryucc.colorado.edu/baldor-reliance/mn00112-598.pdf · 1.1 Immediate Command Mode The process of using the MML from the host is known as Immediate Command

MML Function Reference

Motion Library Programmers Manual: Issue 3.2 Page 351

Description:Returns whether an active Z pulse has been detected since the Z pulse latch was last cleared.When NextMove detects an active Z pulse the condition is latched. This function may beused to test whether a Z pulse has been latched. The act of reading the latch clears the latch.

Parameters:latchNo specifies the encoder whose Z latch is to be read.

0 <= latchNo < 4 (or 8 if servo expansion board attached)

state describes the state of the latch. 1 if a pulse has been latched, zero otherwise.

Restrictions:None.

Default:The default state is that the latch is clear.

Example:/*----------------------------------------------------------------------*//* A system uses encoders with active low Z pulses. Search for the Z *//* on axis 2. *//*----------------------------------------------------------------------*/__uint8 zFound;

setActiveZLevel (0);setJOG (2, 20);do { getZLatch (2, &zFound);} while(!zFound);STOP(2);

See Also:

ActiveZLevel