Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
Reference: MN00249-003/0598
MINT InterfaceLibrary
Standard & Developer Release
Issue 4.3
MINT Interface Library: Issue 4.3 Page 2
This page left intentionally blank.
MINT Interface Library: Issue 4.3 Page 3
Copyright Baldor Optimised Control Ltd1998.
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]
MINT Interface Library: Issue 4.3 Page 4
This page left intentionally blank.
MINT Interface Library: Issue 4.3 Page 5
Manual Revision History
Issue Date Reference Comments
3.0 Nov 96 MN00XXX-000 Raised from MN00137-0084.0 Apr 97 MN249-000 Support for serial controllers added.
Consistent naming convention adoption forfunctions
4.1 May 97 MN00249-001 Revised to add new standard release examples4.2 Nov 97 MN00249-002 Revised for MIL Version 34.3 May 98 MN00249-003 Updates for MIL v3.1 & MPT v6.1
MINT Interface Library: Issue 4.3 Page 6
This page left intentionally blank.
Contents
MINT Interface Library: Issue 4.3 Page 7
1. Introduction ................................................................. 111.1 Which Functions are Supported on My Controller ? ................12
1.2 Language Support.......................................................................12
2. Communication Basics: Using Handles..................... 152.1 CAN and RS485 Networks. ..........................................................16
2.2 Function Return Codes................................................................18
3. Communicating With NextMove PC.......................... 193.1 Using the Windows NT Device Driver .........................................19
3.2 What is Dual Port RAM (DPR)? ....................................................20
3.3 Loader/Initialisation Routines......................................................20
3.3.1 Using the Loader Routines .......................................................21
3.3.2 Example Programs....................................................................21
3.4 MINT Comms Array ......................................................................22
3.4.1 Example Programs....................................................................23
3.5 MINT Pseudo-Serial Buffer............................................................24
3.5.1 Loading MINT Config & Programs ...........................................24
3.5.2 Preventing Deadlock Situations ..............................................26
3.5.3 Summary of Functions ..............................................................27
3.5.4 Examples....................................................................................27
3.6 Auto-Update Area.......................................................................28
3.6.1 Summary of Functions ..............................................................32
3.6.2 Examples....................................................................................32
3.7 Immediate Command Mode Interface....................................32
Contents
MINT Interface Library: Issue 4.3 Page 8
3.7.1 Using Immediate Command Mode (Non embedded-emulation )..............................................................................................33
3.7.2 Variations for Languages Other Than ‘C’...............................34
3.7.3 Error/Fastpos/User Handlers .....................................................36
3.7.4 Multi-Threading Systems Other Than Windows NT .................36
3.7.5 Example Programs....................................................................37
3.8 Interrupting the Host from NextMove ........................................37
3.8.1 Interrupting the Host from a MINT Program...........................37
3.8.2 Writing and Installing an Interrupt Handler.............................38
3.9 Status/Control Registers ..............................................................38
3.9.1 Data Synchronisation ...............................................................38
3.9.2 Reading the Number of Axes and I/O Supported ................39
3.9.3 Reading MINT Details................................................................39
4. Communicating With Serial Controllers..................... 414.1 The Command Line/File Upload/Download.............................41
4.2 Protected Mode Comms Protocol ............................................41
4.3 MINT328.........................................................................................42
4.4 HPGL..............................................................................................42
4.5 Updating Firmware ......................................................................42
5. Using the Library with Various Languages................. 435.1 Visual Basic 5 & 4 (16 & 32 bit) ....................................................43
5.2 Borland Delphi v2 (32 bit)............................................................43
5.3 Borland C/C++ .............................................................................43
5.4 C/C++ #defines............................................................................43
5.5 C++ ( Developer Edition ) ...........................................................44
Contents
MINT Interface Library: Issue 4.3 Page 9
5.5.1 Files to include in the project...................................................47
5.6 ‘C’..................................................................................................47
5.6.1 Include files................................................................................47
5.6.2 Required #defines.....................................................................48
5.6.3 Files to Include in the Project. .................................................48
6. The Example Programs ............................................... 516.1 AUTOUPDT.....................................................................................51
6.2 AXISTEST.........................................................................................52
6.3 bckgrnd ........................................................................................56
6.4 C31 EMU........................................................................................57
6.5 can................................................................................................57
6.6 COMMS.........................................................................................58
6.7 cpp1..............................................................................................60
6.8 download .....................................................................................60
6.9 euro485 .........................................................................................61
6.10 file_ud............................................................................................61
6.11 icm_test.........................................................................................62
6.12 IOTest.............................................................................................63
6.13 MINT328.........................................................................................64
6.14 TERMINAL ......................................................................................65
6.15 update..........................................................................................65
7. Function Reference..................................................... 67
8. Appendix 1: NextMove PC DPR Map ...................... 1568.1 Overview ....................................................................................156
Contents
MINT Interface Library: Issue 4.3 Page 10
8.2 NextMove PC Address Map .....................................................157
8.2.1 Status / Control Registers .......................................................157
8.2.2 Axis Data..................................................................................161
8.2.3 I/O Data...................................................................................162
8.2.4 Immediate Comand Mode...................................................163
8.2.5 Serial Interface ........................................................................163
8.2.6 Special Functions Registers ....................................................164
9. Appendix 2: Symbolic Constants ............................ 167
10. Appendix 3: Timings.................................................. 17210.1 Basic DPR Access.......................................................................172
10.2 Immediate Command Mode Functions .................................172
Introduction
MINT Interface Library: Issue 4.3 Page 11
1. Introduction _________________________________The MINT Interface Library is a common API (Application Program Interface) for the rangeof MINT based motion controllers. The MINT Interface Library is DOS and Windowsbased with support for Windows 3.11, Windows 95 and Windows NT via a dynamic linklibrary (DLL). A number of development platforms are supported including Visual C++,Borland C++, Borland Delphi and Visual Basic. C++ source code for the library is includedin the Developer Edition.
Features of the library include:
Ability to upload and download MINT programs and configuration files. Ability to interrogate the MINT command line. Updating of new firmware into FLASH or RAM. Support for the MINT Comms Protocol, whereby data can be transferred to anexecuting MINT program by means of a protected datapacket.
Ability to read Dual Port RAM locations on the NextMove PC controller.Support is provided for the following controllers:
NextMove product family: NextMove PC; NextMove BX EuroSystem product family: EuroSystem; EuroStep; SmartStep; EuroServo;SmartSystem; SmartMove
ServoNodeThe MINT Interface Library is supplied as a standard edition and as a developers edition:
Standard Edition: This is supplied with NextMove PC and provides all the necessaryfunctionality to create a host application to communicate with a MINT program running onNextMove PC. Only the DLL for Windows 3.1 (16 bit) and Windows 95 (16 and 32 bit) isincluded.
Developers Edition: Supports all the MINT based Dual Port RAM, serial and CANproducts. Features include:
Immediate Command Mode (ICM) functionality for NextMove PC. This is themechanism for controlling motion directly from the host (see section 3.7 fordetails). For example the host calculates complex 3D vectors and sends thedemand co-ordinates to NextMove as a series of multi-axis vectors in real time,while the MINT program handles I/O.
Full C++ source code. This allows C and C++ programs to be written forWindows and non-Windows (e.g. DOS) targets.
Support for communications with controllers on a CAN network.
Introduction
MINT Interface Library: Issue 4.3 Page 12
A device driver allowing NextMove PC to be used under Windows NT v3.51 or4.0.
A common set of functions (API) is provided for each controller. For example, the functionserialGetChar will read the next character from the MINT command line.downloadMINTFile will download a MINT program or configuration file. Each controllertype is distinguished by a different handle. This an analogous to file handles in C or Basic.
Example (Visual Basic):Dim handle1&, handle2&, error%Const NODE0 = 0Const NODE1 = 1Const COM1 = 1
' Create handles to the controllers and buseshandle1& = createNextMovePCHandle( NODE0, &H330 )handle2& = createServoNodeHandle( NODE1, COM1, 9600, TRUE )
' Perform a move on each controllererror% = downloadMINTFile( handle1&, “test.mnt”, filePROGRAM )error% = downloadMINTFile( handle2&, “test.mnt”, filePROGRAM )
' Free the handlefreeHandle handle1&freeHandle handle2&
As can be seen, the same function call is used, but for different controllers.
1.1 Which Functions are Supported on My Controller ?The MINT Interface Library contains many functions which have no effect on somecontrollers. It is safe to attempt to call any function for any controller: the function willreturn erNOT_SUPPORTED if it cannot be used with that controller. To try and simplifythe process of choosing the right functions for your controller the manual is split into thefollowing general sections:
NextMove PC. This section describes the interface to NextMove PC and gives anoverview of the available functions.
Serial Controllers. This sections gives an overview into communications with serialcontrollers.
Alphabetical Function reference. This details each function and specifies whichcontrollers it can be used with.
1.2 Language SupportThis table shows the languages supported by the standard and developer editions.
Introduction
MINT Interface Library: Issue 4.3 Page 13
Serial Controllers NextMove PCNo Immediate Command
Mode
NextMove PCIncluding Immediate
Command Mode
Delphi 2(Win95 & WinNT Target )
Developer Edition Standard (Win95 Only) &Developer (WinNT &
Win95)
Developer Edition
'C' DLL for Borland C++v4.52(Win95 & WinNT Target)
Developer Edition Standard (Win95 Only) &Developer (WinNT &
Win95)
Developer Edition
'C' DLL for Borland C++v4.52(Win3.1 & DOS Target)
Developer Edition Standard & DeveloperEditions
Developer Edition
'C' DLL for Visual C++v1.52(Win16 & DOS Target)
Developer Edition Standard & DeveloperEditions
Developer Edition
'C' DLL for Visual C++v4.2 & v5.0 (Win95 &WinNT Target)
Developer Edition Standard (Win95 Only) &Developer (WinNT &
Win95)
Developer Edition
C++ Source for BorlandC++ v4.52(Win95 & WinNT Target)
Developer Edition Developer Editions Developer Edition
C++ Source for BorlandC++ v4.52(Win3.1 & DOS Target)
Developer Edition* Developer Edition Developer Edition
C++ Source for Visual C++v1.52(Win3.1 & DOS)
Developer Edition* Developer Edition Developer Edition
C++ Source for Visual C++v4.2 & v5.0(Win95 & WinNT)
Developer Edition Developer Edition Developer Edition
Visual Basic 4 & 5(Win95/WinNT Target)
Developer Edition Standard & DeveloperEditions
Developer Edition
Visual Basic 4(Win3.1 Target)
Developer Edition Standard & DeveloperEditions
Developer Edition
*Requires additional purchase of the Greenleaf Commlib v5.2c to compile for DOS.
Introduction
MINT Interface Library: Issue 4.3 Page 14
This page left intentionally blank.
Communication Basics: Using Handles
MINT Interface Library: Issue 4.3 Page 15
2. Communication Basics: Using Handles________All controllers are referenced in the MINT Interface Library by a handle. This handleallows the library to reference all the information it requires on the controller.
For example, the function COMMSWrite can be called for a NextMove PC or for aEuroSystem. The MINT Interface Library uses at the handle to decide:
how to access the controller i.e. use Dual Port RAM for a NextMove PC, use theserial port for a EuroSystem.
the hardware parameters i.e. address, baud rate, serial port number, CAN/RS485node number.
The following functions are used to create the handles
createEuroSystemHandle create a handle to a EuroSystem connected directlyto the host.
createServoNodeHandle create a handle to a ServoNode connected directlyto the host.
createNextMoveBXHandle create a handle to a NextMove BX connecteddirectly to the host.
createNextMovePCHandle create a handle to a NextMove PC.createRemoteEuroSystemHandle create a handle to a EuroSystem on a CAN or
RS485 network.createRemoteServoNodeHandle create a handle to a ServoNode on a CAN or RS485
network.createRemoteNextMoveBXHandle create a handle to a NextMove BX on an RS485
network.
Example (Visual Basic ):
To write to a COMMS location on a EuroSystem'********************************************************** ' First try to open COM 1 '********************************************************** hController = createEuroSystemHandle(NODE0, COM1, 9600, True)
'********************************************************** ' Test whether the port was successfully opened '********************************************************** isOpen hController, bPortOpen If (bPortOpen) Then
'********************************************************** ' Write 1 to COMMS 10 '********************************************************** COMMSWrite hController, 1, 10
Communication Basics: Using Handles
MINT Interface Library: Issue 4.3 Page 16
End If
'********************************************************** ' Free the handle '********************************************************** freeHandle hController
The reason for this implementation is to allow code written for one controller to be easilyportable to another. For example, to convert the code above to work with a ServoNode,simple change the createEuroSystemHandle function to createServoNodeHandle, or for aNextMove/PC createNextMovePCHandle.
freeHandle should be called for each handle on program termination to free anyresources allocated by createXXXXHandle.
2.1 CAN and RS485 Networks.To create a handle to a controller on a CAN or RS485 network, the following steps aretaken.
1. Create a handle to the node with a physical connection to the host. On a CANnetwork, this will generally be node 0, the busmaster. On an RS485 network this canbe any node.
2. Create a handle for each remote controller, using createRemoteEuroSystemHandle,createRemoteServoNodeHandle or createRemoteNextMoveBXHandle. Thesefunctions take the node number of the remote controller and the handle of thebusmaster / RS485 controller created in step 1.
3. If desired, call the function setAutoNodeSelect (AUTO_SELECT) orsetAutoNodeSelect (NO_AUTO_ SELECT) for the master node. With auto-selectenabled, $X will be sent as required to select the remote controller. By defaultautomatic node selection is enabled on ServoNode and disabled on EuroSystem andNextMove BX.
4. All the handles should be released after use using freeHandle. Free the handlecreated in step 1 last.
Note that the bus master does not have to be the same type of controller as the remote nodese.g. to access a ServoNode connected via CAN to a NextMove/PC callcreateNextMovePCHandle to create a handle to the NextMove/PC and pass the handle tocreateRemoteServoNodeHandle.
Communication Basics: Using Handles
MINT Interface Library: Issue 4.3 Page 17
Example: (Delphi ):
To write to a ServoNode 50 connected via a serial cable, and read from 2 nodes on a CANnetwork.
procedure TForm1.Button3Click(Sender: TObject);var nError: SmallInt; fVal: Single; szError: Array[0..150] of Char;
hBusMaster, hNode1, hNode2: OCHANDLE;
const NODE0 = 0; const NODE1 = 1; const NODE2 = 2; const COM1 = 1;
begin
{*************************************************************************) { Create a handle to the busmaster ( node 0 ) } (*************************************************************************) hBusMaster:= createServoNodeHandle ( NODE0, COM1, 9600, 1 );
{*************************************************************************) { Create a handle to the nodes 1 & 2 on the CAN bus } (*************************************************************************) hNode1:= createRemoteServoNodeHandle ( NODE1, hBusMaster ); hNode2:= createRemoteServoNodeHandle ( NODE2, hBusMaster );
{*************************************************************************) { Write to the comms on node 0 } (*************************************************************************) nError:= COMMSWrite ( hBusMaster, 1, 5.23 ); if ( nError <> erSUCCESS ) then begin getErrorString (szError, nError ); ShowMessage ( szError ); end;
{*************************************************************************) { Read from node 1 ( comms location 10 ) } (*************************************************************************) nError:= COMMSRead ( hNode1, 10, fVal ); if ( nError <> erSUCCESS ) then begin getErrorString (szError, nError ); ShowMessage ( szError ); end;
{*************************************************************************) { Read from node 2 ( comms location 11 ) } (*************************************************************************) nError:= COMMSRead ( hNode2, 11, fVal ); if ( nError <> erSUCCESS ) then begin getErrorString (szError, nError );
Communication Basics: Using Handles
MINT Interface Library: Issue 4.3 Page 18
ShowMessage ( szError ); end;
{*************************************************************************) { Free all handles } (*************************************************************************) freeHandle ( hNode2 ); freeHandle ( hNode1 ); freeHandle ( hBusMaster );
end;
end.
2.2 Function Return CodesAll functions which return an error value, select the code from the list defined in Appendix2: Symbolic Constants. This means, for example, that an error code 10007(erCANNOT_OPEN_FILE) returned from any function will always indicate a problem withthe file the function was using (wrong format or non-existent.) The list of codes is definedas symbolic constants (i.e. #define (‘C’), Global Const (VB), const (Delphi)) for eachsupported language. For ease of use, a text string relating to any error message has beendefined. To receive the error message relating to the code, call getErrorString (see theexample above.)
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 19
3. Communicating With NextMove PC __________There are several methods of communicating with NextMove. The correct method(s) to usewill depend on what functionality is required. In many cases there are more than severalmethods which could equally be used. Note that all of the functions listed in this section aredescribed in detail in Section 7: Function Reference.
3.1 Using the Windows NT Device DriverThe Windows NT device driver is contained in the NT Device Driver subdirectory of theDeveloper Edition CD. To install the device driver, run setup.exe from this directory.When installation has completed, use the configuration utility to specify the address(es) ofany NextMove PC(s) present. The NT Device Driver subdirectory may be copied to a1.44MB floppy disk and distributed freely with any application written with the MINTInterface Library.
Notes:
1. Administrator rights are required to install the device driver, or run theconfiguration utility.
2. This version of the MINT Interface Library is not compatible with olderversions of the device driver. The latest device driver MUST be used.
3. If replacing a previous device driver, run the uninstall program to removethe old device driver and reboot before installing the newer version.
Using Windows NT with NextMove PC provides certain benefits over Windows 95. Thedevice driver provides arbitration between different processes or threads which call thedevice driver. For example, under Windows 95, if one application calls serialGetChar,while another application is calling updateFirmware, the .out file being downloaded will becorrupted, and serialGetChar will return garbage. Under Windows NT, the call toserialGetChar will be stalled until loadApplication completes. The down-side of using NTis that any function calls will have a small time overhead (see Appendix 3: Timings .)
Note: 32 bit applications written using the MINT Interface Library will run under bothWindows 95 and Windows NT with no modification.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 20
3.2 What is Dual Port RAM (DPR)?All communication between NextMove and the host is performed using Dual-Port-RAM(DPR). This is physical block of memory on NextMove which can be accessed by eitherNextMove or the host. Various locations in DPR have been set aside for special purposessuch as sending control codes and passing I/O information. Other locations have been leftfor the user to pass any required information back and forth.
The main features and uses of DPR
Support for loader routines. This allows NextMove applications (similar to a PC’soperating system) to be loaded into NextMove.
Support for the MINT Comms Array. This is a method of asynchronouslyupdating variables in a MINT program from the host.
MINT pseudo serial buffer. This allow communication with the MINT commandline, and MINT program and configuration loading/saving.
Reporting of MINT status. The host can read whether MINT is at the command lineand if not, which line it is executing.
Automatic reporting of motion variables. Every 2 milliseconds NextMove writesvarious motion parameters into DPR - the speed, position, gains of each axis, thestate of I/O, any errors. This can be read at any time by the host. The host can alsouse this area to update NextMove motion variables e.g. speed or gains.
Control of the NextMove by the host (known as Immediate Command Mode ( ICM)). This allows a program running on the host to access any NextMove function.(e.g. MoveAbsolute, setOutput, STOP).
Interrupts. Writing to DPR location 3FF hex on NextMove causes an interrupt tooccur on the host. This can either be used to trap motion errors or to cause userinterrupts.
Flags & control registers. Each NextMove application uses control registers to tellthe host which features it supports. Control registers can also be used tosynchronise communications between NextMove and the host.
User area. There is an area in DPR which has been left to allow NextMove and thehost application to exchange whatever application specific data is required.
3.3 Loader/Initialisation RoutinesNextMove contains a monitor program held on EPROM called the loader which is alwaysresident. The loader is used to download applications (executable files) from the host intothe memory of NextMove. The loader also performs various memory checks at power up.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 21
Routines are available allowing communications with NextMove at the lowest level, beforeany application has been loaded. They include routines to read the version information fromNextMove, and all the routines required to load and run an application.
Use the function resetController() to reset the board, before calling any of thesefunctions. resetController() resets the board, which automatically starts the loader.
The loader functions available are:
Function Description
getControllerVersion returns the board version, read from the loader EPROM.getControllerIdAndMemory returns the board version and memory configuration
read from the loader EPROM.UpdateFirmware(Ex) Loads an application from the hosts disk drive to
NextMove.
3.3.1 Using the Loader RoutinesBefore using any of the loader routines (except updateFirmware(Ex)), call resetController(),to initialise the loader. All three LED’s on NextMove will light, and then the red and orangeLED’s will turn off leaving only the green. The green LED should be on continuously, if itis flashing, the board has not reset. Once the green LED is on, the get… functions can beused to interrogate the board. Once the application has been loaded usingupdateFirmware(Ex) the green LED should begin to flash (the red LED or amber may alsoflash).
3.3.2 Example ProgramsThe following example programs use the loader routines
bckgrnd (NextMove PC) download (EuroSystem) ICMTest (NextMove PC)
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 22
3.4 MINT Comms ArrayThe Comms array is a 99 element MINT array which is mapped to DPR (see Appendix 1 forlocation). This allows floating point data to be transferred between a MINT program and ahost (see MINT for NextMove Programming Guide - Chapter 13 for a full description) Thismethod of communication is the best way of communicating data between a MINT programrunning on NextMove and a host at run time. It can be used for simple data transfer, or as amethod of synchronising events.
Example:
In this example, the host tells the MINT program to execute one of several routines usingComms location 6. Comms location 7 is used first to pass a parameter (in this case whichoutput to set) and then for MINT to return a completion code.
Host:/* Address of NextMove */#define nmADDRESS 0x33C
/* Node number */#define NODE0 0
/* COMMS location uses */#define CONTROL_LOCATION 6#define PARAM_1 7
/* Flags for control location */#define COMPLETED 0.0#define SPECIAL_ROUTINE1 1.0
……OCHANDLE hNextMove = NULL;float fOutput = 1.0;float fControl = SPECIAL_ROUTINE1;
/* Create a handle to NextMove */hNextMove = createNextMovePCHandle ( NODE0, nmADDRESS );if ( NULL == hNextMove ) return;
/* Write the parameter */COMMSWrite ( hNextMove, PARAM_1, &fOutput );
/* Write the control code */COMMSWrite ( hNextMove, CONTROL_LOCATION, &fControl );
/* Wait for MINT to complete */do { COMMSRead (hNextMove, CONTROL_LOCATION, &fControl );} while ( COMPLETED != fControl );
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 23
/* Read the MINT return code */COMMSRead ( hNextMove, PARAM_1, &fErrorCode );
/* Release the resources used by the handle */freeHandle ( hNextMove );
MINT for NextMove:REM COMMS location usesDEFINE control = COMMS (6)DEFINE param1 = COMMS (7)
REM Flags for control locationDEFINE completed = 0DEFINE special_routine1 = 1
REM I/ODEFINE open_gripper = OUT0 = 1DEFINE gripper_fully_open = IN6 = 1DEFINE gripper_error = IN7
……WHILE 1 IF control = …… DO ENDIF … … IF control = special_routine1 DO OUT1 = param1 : REM Use param supplied by top end open_gripper PAUSE gripper_fully_open: REM Wait for an event param1 = gripper_error: REM Data to pass back to host control = completed : REM synchronise with host ENDIF …
ENDW
Note: Comms on NextMove differs from Comms on the EuroSystem range ofcontrollers in that the Comms array is implicitly defined within MINT for NextMove
and does not require the use of the COMMSON keyword.
3.4.1 Example ProgramsThe following example programs use the comms protocol (see section 6 for full details)
axistest (EuroSystem) bckgrnd (NextMove PC)
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 24
3.5 MINT Pseudo-Serial Buffer67 words of DPR are defined as a MINT pseudo-serial receive buffer, and 67 as a MINTpseudo-serial transmit buffer (see section 8.2.5). Both of these are implemented as acircular buffer with 3 control words, leaving 64 words available for transferring characters(one per DPR location). The pseudo - serial buffer provides an interface to the MINTcommand line and is also used in uploading and downloading MINT files.
Uses for the pseudo-serial buffer are as follows:
Using the NextMove WorkBench, or terminal custom control the MINT commandline can be used. This is often used when testing and setting gains and debuggingMINT programs.
Commands can be send directly to the command line from a top end.Example:
serialPutStringTimeout (hNextMove, “MA.0=100:GO.0\n”, 100).
There are several functions for direct access to the pseudo-serial buffer:serialPutChar, serialPutCharTimout, serialGetChar, serialGetCharTimeout.
Debug information can be added to a MINT program e.g. ? MODE.0 . This can beparticularly effective when combined with the function setEcho (eoECHO_ALL +eoOVERWRITE) or the MINT command ECHO =eoECHO_ALL + eoOVERWRITE.This allows the NextMove WorkBench to be opened and the terminal to be used todisplay debug information as required, but will also allow the program to runwithout the terminal (see section 3.5.2 Preventing Deadlock Situations)
MINT programs can be loaded and saved using uploadFile and downloadFile.
3.5.1 Loading MINT Config & ProgramsNextMove’s pseudo serial port is used to upload and download MINT configuration &programs.
Note: The routines uploadMINTFile and downloadMINTFile both set ECHO to thecorrect value and reset it again on exit. There is no need for the user to call setEcho
before calling these routines.
The following code shows an example of a program to load and run a configuration &program file (taken from \examples\download\c\main.c.)
/*-----------------------------------------------------------------------*//* local macro definitions *//*-----------------------------------------------------------------------*/#define pathMINT "\\mint\\apps\\mint.out" /* mint.out */#define pathCONFIG "..\\..\\dummy.cfg" /* config file */
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 25
#define pathPROGRAM "..\\..\\dummy.mnt" /* program file */#define adrNEXTMOVE 0x33C /* NextMove address */#define NODE0 0 /* for readability */#define toONE_SECOND 1000 /* one second */
/*-----------------------------------------------------------------------*//* *//* CheckForError *//* Argument list: *//* *//* szFunc: the function name *//* nError: the return code from the function *//* *//* Return value: *//* The same as nError *//* *//* Description: *//* This function checks the return code of a function and displays an *//* error message as required. *//* *//*-----------------------------------------------------------------------*/__int16 checkForError ( char *szFunc, __int16 nError ){ /*---------------------------------------------------------------------*/ /* Define a string to hold an error message. szMAX_ERROR is defined */ /* in host_def.h ( which is included in host_cif.h */ /*---------------------------------------------------------------------*/ __int8 szError[szMAX_ERROR];
if ( erSUCCESS != nError ){ /*-------------------------------------------------------------------*/ /* The function has failed. Display an error message. */ /*-------------------------------------------------------------------*/ getErrorString ( szError, nError ); printf ( "%s failed code %d: %s\n", szFunc, nError, szError ); }
return nError;}
/*-----------------------------------------------------------------------*//* *//* main *//* Argument list: *//* void *//* *//* Return value: *//* void *//* *//* Description: *//* Downloads mint.out, config & program and runs them. *//* *//*-----------------------------------------------------------------------*/void main ( void ){ OCHANDLE hNextMove;
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 26
/*---------------------------------------------------------------------*/ /* Create a handle to NextMove . */ /*---------------------------------------------------------------------*/ if ( NULL == ( hNextMove = createNextMovePCHandle ( NODE0, adrNEXTMOVE ))){ printf ( "Could not create a handle to NextMove" ); return; }
/*---------------------------------------------------------------------*/ /* Download the application . */ /*---------------------------------------------------------------------*/ if ( erSUCCESS == ( checkForError ( "updateFirmware", updateFirmware ( hNextMove, pathMINT, bdEPROM, tmRAM, FALSE )))){
/*-------------------------------------------------------------------*/ /* Download the configuration file . */ /*-------------------------------------------------------------------*/ if ( erSUCCESS == ( checkForError ( "download config file", downloadMINTFile ( hNextMove, pathCONFIG, fileCONFIG )))){
/*-----------------------------------------------------------------*/ /* Download the program file . */ /*-----------------------------------------------------------------*/ if ( erSUCCESS == ( checkForError ( "download program file", downloadMINTFile ( hNextMove, pathPROGRAM, filePROGRAM )))){
/*---------------------------------------------------------------*/ /* Run the config & program . */ /*---------------------------------------------------------------*/ if( erSUCCESS == checkForError ( "MINTRun", MINTRun ( hNextMove,
toONE_SECOND ))) printf ("Success\n");
} } }
/*---------------------------------------------------------------------*/ /* Free the resources allocated by createNextMovePCHandle */ /*---------------------------------------------------------------------*/ freeHandle ( hNextMove );
/*---------------------------------------------------------------------*/ /* Wait for keypress */ /*---------------------------------------------------------------------*/ printf ("Press any key to exit.\n"); while (!kbhit());}
3.5.2 Preventing Deadlock SituationsIf MINT has a character to write to the pseudo-serial port, it will wait indefinitely until thereis a space in the transmit buffer. MINT prints a banner when it is loaded of length longerthan 64 characters. This means that the serial buffer must be emptied by the top end beforeproceeding. There are several ways of doing this
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 27
Call one of the read functions e.g. serialGetChar until the buffer is emptied. Call downloadMINTFile: this automatically clears the NextMove transmit buffer byreading continually.
Disable the pseudo-serial buffer (or enable buffer overwriting). This is the methodrecommended for applications that do not require the MINT command line (e.g.Immediate Command Mode applications). This also allows PRINT statements to beput in a MINT program for debugging using the NextMove WorkBench, andignored in the release version. There are two methods for this. Specify TRUE for the bEchoOverwrite parameter of updateFirmware /
updateFirmwareEx. This will set the pseudo-serial communications intooverwrite mode. This means that NextMove will overwrite the oldest characterin the buffer as necessary.
. Call setEcho. setEcho (eoALL + eoOVERWRITE) will put NextMove intooverwrite mode and setEcho (eoECHO_OFF) will disable all serialcommunications from NextMove. Note that downloadMINTFile anduploadMINTFile will be unaffected.
3.5.3 Summary of FunctionsRefer to the alphabetical function reference for details
Function Name Description
MINTBreak Sends Ctrl-E to MINT, bypassing the pseudo-serial buffer.
MINTRun Write RUN<ENTER> to the pseudo-serial bufferSerialGetChar Read a char from the pseudo-serial buffer is one
is availableSeriallGetCharTimeout Read a char from the pseudo-serial buffer if one
is available within the given period of time.SerialGetStringFromBufferTimeout Read up to 64 chars from serial buffer into a
stringSerialPutChar Write a char to the psuedo-serial buffer
SerialPutCharTimeout Writes a character, timing out if the pseudo-serialtransmit buffer is full
SerialPutStringTimeout Writes a string, timing out if the pseudo-serialtransmit buffer is full
3.5.4 ExamplesThe following example programs use the pseudo serial buffer (see section 6 for full details)
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 28
axistest (EuroSystem) cpp1 (NextMove PC) ICMTest (NextMove PC) file_ud (NextMove PC , NextMove BX, ServoNode, EuroSystem)
3.6 Auto-Update AreaCertain areas of DPR are used by NextMove to report the current status of various motionvariables. These locations are updated every 2ms by NextMove’s MINT Motion Library(MML). The host can read these values directly from Dual Port Ram using the functionsgetWord, getLong and getFloat as shown in the examples in this section.
It is also possible to pass values for some of the motion variables to NextMove. To do thiswrite the new value to DPR using putWord, putLong, putFloat then call the functionsetAutoUpdateModified to tell NextMove which location has changed (see examples later insection).
Notes:
1. Writing to an AutoUpdate variable has no effect until the functionsetAutoUpdateModified is called.
2. NextMove updates all MG variables every 2 milli-seconds, so it is importantto call setAutoUpdateModified directly after writing a value to anAutoUpdate variable. Otherwise it will be overwritten.
To be able to read and write auto-update values it is necessary to know the address in DualPort RAM of the variable and also the correct data type. Symbolic constants have beendefined for the address in each supported language (e.g. #define in ‘C’, Global Const inVisual Basic). The tables below show the symbolic constant and data type for eachavailable motion variable. All variables can be read and variables with a mark in the ‘Auto-Update Write’ column can also be written to.
The data for each axis is held in a block, with the format as shown in the table below. TheMINT keyword is shown in brackets.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 29
Motion Variable Symbolic Constant foruse with put…/get…
DataType
Units AutoUpdate
Write
Position(POS)
RoPOSITION float user units
Instantaneous Speed(VEL)
RoMEASURED_SPEED float user units/second
Slew Speed(SPEED)
RoDEMAND_SPEED float user units/second
❏
Mode of Motion(MODE)
RoMODE_OF_MOTION integer -
Motion Error(ERROR)
RoMOTION_ERROR integer -
Following Error(FOLERR)
RoFOLLOWING_ERROR float user units
Proportional Gain(GAIN)
RoP_GAIN float - ❏
Velocity FeedbackGain
(KVEL)
roV_GAIN float - ❏
VelocityFeedforward Gain
(KVELFF)
roFF_GAIN float - ❏
Derivative Gain(DGAIN)
roD_GAIN float - ❏
Integral Gain(KINT)
roI_GAIN float - ❏
Integral Range(KINTRANGE)
roI_RANGE float % ❏
Next Mode ofMotion
roNEXT_MODE integer -
DAC Demand Value(DEMAND)
roDAC_VALUE integer analogueunits
Free Spaces in MoveBuffer
(MBFREE)
roFREE_SPACES integer -
Move Identifier(MOVEBUFFERID)
roMOVE_ID integer -
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 30
Motion Variable Symbolic Constant foruse with put…/get…
DataType
Units AutoUpdate
Write
Axis demandposition
roDEMAND_POS float user units
Axis demandvelocity
roDEMAND_VEL float user units/second
The base address for each axis is:
Axis Symbolic Constant
0 roAXIS_01 roAXIS_12 roAXIS_23 roAXIS_34 roAXIS_45 roAXIS_56 roAXIS_67 roAXIS_7
Examples:
To read the following error of the third servo motor (FE.2 in MINT):fFollowingError = getFloat (hController, roAXIS_2 + roFOLLOWING_ERROR)
To set the demand speed of axis 0 (SPEED.0 in MINT) to 100:putFloat (hController, roAXIS_0 + roDEMAND_SPEED, 100.0)setAutoUpdateModified (hController, roAXIS_0 + roDEMAND_SPEED)
The following table shows the location of the I/O information. Associated MINT keywordsare shown in brackets.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 31
Motion Variable Symbolic Constant DataType
Units AutoUpdate
Analog 0(ANALOGUE0)
roANALOG_0 integer analogunits
Analog 1(ANALOGUE1)
roANALOG_1 integer analogunits
Analog 2(ANALOGUE2)
roANALOG_2 integer analogunits
Analog 3(ANALOGUE3)
roANALOG_3 integer analogunits
Analog 4(ANALOGUE4)
roANALOG_4 integer analogunits
Analog 5(ANALOGUE5)
roANALOG_5 integer analogunits
Analog 6(ANALOGUE6)
roANALOG_6 integer analogunits
Analog 7(ANALOGUE7)
roANALOG_7 integer analogunits
Digital Inputs(IN)
roINPUTS integer -
Digital Outputs(OUT)
roOUTPUTS integer - ❏
Stop/Error InputStatus
roMG_STATUS integer -
Boost Outputs(BOOST)
roBOOST integer - ❏
VME auxiliaryencoder position
roMENC_POS float counts
VME auxiliaryencoder velocity
roMENC_VEL float counts
Examples:
To read the value of analogue input0:getWord (hController, roANALOG_0, &nAnalogValue)
To toggle digital output 0:getWord hController , roOUTPUTS, nOutputsnOutputs = nOutputs XOR 1putWord hController, roOUTPUTS, nOutputs
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 32
setAutoUpdateModified hController, roOUTPUTS
3.6.1 Summary of FunctionsThese functions allow all DPR to be accessed directly (as in the examples above.) SeeSection 7: Function Reference for more details.
Function Name Description
getFloat Reads a single precision floating point value from DPRputFloat Writes a single precision floating point value from DPRgetLong Reads a 32bit integer from DPRputLong Writes a 32bit integer to DPRgetWord Reads a 16 bit integer from DPRputWord Writes a 16 bit integer to DPR
3.6.2 ExamplesThe following example programs use the loader routines (see section 6 for full details)
iotest (NextMove PC)
3.7 Immediate Command Mode InterfaceDeveloper Edition Only
The Immediate Command Mode (ICM) isa method of allowing the host to sendmotion commands directly to NextMove,bypassing MINT. It allows direct accessto all the commands available to the MINTMotion Library i.e. all the commandsavailable either in a MINT program or ifyou were writing your own NextMoveapplication (see the NextMove MINTMotion Library Reference). It isparticularly useful if there is a largeamount of processing to do (i.e.calculation of multi-axis paths) as the hostcan do the processing and send thecommands to NextMove. Note that thesefunctions can be used in conjunction witha MINT program. For example a MINT program handles the I/O and the host calculates thepath and sends it to NextMove using setVECTORA().
NextMove
MINT ������������������������������������������������������������������������Host I/F
Terminal/Mailbox
MINT Motion Library
ServoLoop
Profiler x N
x N
������������������������������������������
PC-Front
DeviceDriver
Host
NMDLL
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 33
The Immediate Command Mode interface can also be used for testing applications to becompiled by a C31 compiler and run on NextMove. This ‘C31’ emulation technique isdescribed in 3.7.2.4 Using Immediate Command Mode to Test NextMove Code .
3.7.1 Using Immediate Command Mode (Non embedded-emulation )
Note for upgrading users: Unless built for embedded-emulation, all ICM functions nowtake a handle as the first parameter, so selectBoardHandle is no longer necessary. This
allows multiple NextMove PCs to be referenced by the same program.initialiseNextMove is also now only available for embedded-emulation builds.
The functions available for use with the immediate command mode are described in theNextMove MINT Motion Library Reference. The only difference when usingICM(immediate command mode) is that all functions take an extra parameter: the handle.
e.g. in the NextMove MINT Motion Library Reference the function setMOVEA is declaredas
int setMOVEA (uchar axisNo, float absolutePosition).
A minimum program in Visual Basic to call this function would bedim hNextMove&‘---------------------------------------------------------------------‘ Create a handle to a NextMove PC node 0 at address 0x33C‘---------------------------------------------------------------------hNextMove = createNextMovePCHandle ( 0, &H33C )
‘---------------------------------------------------------------------‘ Perform an absolute move to 100.0 on axis 0 ( note the extra‘ hNextMove parameter not in the declaration above )‘---------------------------------------------------------------------setMOVEA hNextMove, 0, 100.0
‘---------------------------------------------------------------------‘ Release the resources‘---------------------------------------------------------------------freeHandle hNextMove
It is not recommended that the ICM WAIT function is called, as this will ‘hang’ thehost until NextMove has completed its call to the WAIT function. Also it is suggestedthat moves are not sent to NextMove unless there is space in the move buffer for them
(see getMoveBufferFree / okToLoadMove in the NextMove MINT Motion LibraryReference manual). Otherwise, the host will ‘hang’ until a space becomes available in
the move buffer to load the move.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 34
3.7.2 Variations for Languages Other Than ‘C’Some languages do not support some of the features of 'C', such as variable argument lists.The following sections detail the changes.
3.7.2.1 Variable Argument Lists (GO, setVECTORA, setVECTORR)The following functions use variable argument lists under ‘C’
GO setVECTORA setVECTORR
Each of these functions under ‘C’ take a number of arguments which vary depending howmany axes will be used. e.g. to GO on axes 3 and 5, ‘C’ uses GO (2, 3, 5) where the firstnumber is the number of parameters which will follow. For languages which do not supportvariable argument lists a system has been implemented whereby multiple versions of thefunction have been written e.g. GO1 ….. GO8, so the example above would be GO2(3, 5).
3.7.2.2 setCAMTable, setMoveSPLINE, setSplineTableThe declarations for these functions under ‘C’ are as follows:
__int16 setCamTable (unsigned __int8 axisNo, float FAR *PosArray, float FAR *masterArray);
__int16 setSplineTable (unsigned __int8 axisNo, float FAR *PosArray, float FAR *VelArray, float FAR *DurArray);
In setCamTable the LengthArray parameter and in setSplineTable the VelArray andDurArray parameters are all optional. In ‘C’, to specify that you do not wish to use theseparameters, you pass a null pointer. This is not possible in Visual Basic though, so thefollowing amendments have been made (VB only)
ä setCamTable. If you do not wish to use the masterArray parameter, set it to -1 (not 0as specified in the ‘C’ manual)
ä setSplineTable. An extra parameter has been added before the two optionalparameters. This parameter allows the specification of which of the optionalparameters are being used. This parameter is specified by using the splnVELOCITYand splnDURATION constants. If a parameter is not being used, pass any value in it.Note that if you are using the duration but not the velocity, the duration must still bepassed in the correct parameter (i.e. after the unused velocity parameter)
Example:To use both the Duration and Velocity tables
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 35
Dim fPs(0 To 10) As SingleDim fDur(0 To 9) As SingleDim fVel(0 To 9) As SingleDim c As Byte
Rem: Set the positionsfPs(0) = 10fPs(1) = 2: fPs(2) = 4: fPs(3) = 8: fPs(4) = 16: fPs(5) = 32fPs(6) = -32: fPs(7) = -16: fPs(8) = -8: fPs(9) = -4: fPs(10) = -2
Rem: set the durations and velocitiesFor c = 0 To 9 fDur(c) = c + 1 fVel(c) = 9 - cNext
setSplineTable hNextMove, fPs(0), splnDURATION + splnVELOCITY, fVel(0), fDur(0)
setSPLINE hNextMove, cmCONTINUOUS
GO1 hNextMove
Example 2:To use neither optional table
Dim fPs(0 To 10) As Single
REM: Set the positionsfPs(0) = 10fPs(1) = 2: fPs(2) = 4: fPs(3) = 8: fPs(4) = 16: fPs(5) = 32fPs(6) = -32: fPs(7) = -16: fPs(8) = -8: fPs(9) = -4: fPs(10) = -2
setSplineTable hNextMove, fPs(0), 0, 0, 0
setSPLINE hNextMove, cmCONTINUOUS
GO1 hNextMove
3.7.2.3 STOP, IN under Visual BasicThe functions STOP and IN are already used in Visual Basic. The Immediate CommandMode functions have therefore been renamed (in VB only) to doSTOP and getIN. They arefunctionally unchanged.
3.7.2.4 Using Immediate Command Mode to Test NextMove CodeThe MINT Interface Library Developer Edition can be used to debug embedded applicationsby providing the same MINT Motion Library interface as the embedded libraries. Thismeans that code can be compiled and run on the host, using ICM to access the MINT MotionLibrary embedded in MINT on NextMove, then when debugged compiled for the C31 andrun on NextMove.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 36
See the NextMove MINT Motion Library Reference for details on compiling the MINTInterface Library for ‘C31 emulation’
3.7.3 Error/Fastpos/User HandlersIt is possible to install error, fastpos and user handlers in an Immediate Command Modeprogram written in ‘C’ and running under DOS,. This uses the interrupt mechanismdescribed in the section 3.8: Interrupting the Host from NextMove. To install a handler:
Copy the template function pcInterruptHandler from the file DPR_INT.c. andmodify it to trap the required events.
Call the function installDPRHandler, passing the modified pcInterruptHandler as theparameter.
Call the functions setFastposHandler. setErrorHandler and setUserInterruptHandleras required to notify NextMove that these handlers exist.
Call the function removeDPRHandler to release the interrupt on exiting theprogram.
Note that if your MINT program has an equivalent handler e.g. #ONERROR, the ImmediateCommand Mode interrupt will be called first and the MINT handler only called when itreturns.
Note that ICM functions should NOT be called from within interrupt functions. Atbest the result will be unreliable, at worst the host and/or NextMove may crash.
3.7.4 Multi-Threading Systems Other Than Windows NTEach Immediate Command Mode function takes a finite time to complete. Some (e.g.WAIT) can take a reasonably long time to complete. As each Immediate Command Modefunction uses the same area of DPR to pass its parameters, it is not safe to simply interruptan Immediate Command Mode function with another. Therefore, as each ImmediateCommand Mode function begins, it tries to take a ‘token’ which allows it access to DPR andwill lock out all other Immediate Command Mode functions. If this token is not availablethe functions returns erFRONT_ACTIVE. The usual way to ensure that a function completesin a multi-tasking system is therefore
while (myFunction() == erFRONT_ACTIVE);
orwhile ((nError = myFunction()) == erFRONT_ACTIVE);
to store the return code.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 37
i.e. keep re-trying until erFRONT_ACTIVE is not returned.
There are methods for one process to stop a command which is being performed by anotherprocess
ä abortMMLCommand. This function sets a flag which will be seen by the otherprocess when control returns to it. This aborted command will clear the flag andimmediately return erCOMMAND_ABORTED.
ä setMMLEnabled(FALSE). This function sets a flag which will tell all functions toreturn erCOMMAND_ABORTED. This flag can only be cleared by callingsetMMLEnabled(TRUE) to clear it.
ä interruptMMLCommand. This command can be used in an emergency to interrupt anexecuting Immediate Command Mode command. This function should be usedwith extreme caution (preferably not at all !). See the description in thealphabetical function reference.
3.7.5 Example ProgramsThe following example programs use the immediate command mode (see section 6 for fulldetails).
can (NextMove PC) bckgrnd (NextMove PC) icm_test (NextMove PC) io_test (NextMove PC)
3.8 Interrupting the Host from NextMoveNextMove can be configured to cause interrupts on the host by setting jumpers (seeHardware Reference Guide.) A skeleton interrupt handler has been written, along withfunctions to install and remove the handler. The interrupt support functions are all locatedin the file DPR_INT.c.
Note: Interrupt support code is only available in ‘C’ for an MS-DOS target.
3.8.1 Interrupting the Host from a MINT ProgramWriting to the location 0x3FE from NextMove causes an interrupt on the host. This can beimplemented in MINT using the code.
POKE 0x3FE, interrupt_code
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 38
This will call the installed interrupt handler on the host. The actual value written to 0x3FEcan then be read by the host, to determine what action to take. Note that if the ImmediateCommand Mode interface is being used, certain interrupt codes are used by ImmediateCommand Mode to inform the host that an error has occurred. These codes are 0x100 to0x105 and should not be used for user interrupts.
3.8.2 Writing and Installing an Interrupt HandlerTo write an interrupt handler, copy the template handler from DPR_INT.c and modify asrequired. In the middle of the function there is a statement
switch (intCode) { ……
This is where the interrupt_code in the MINT statement earlier can be tested. Add code inthis part of the routine as required.
To install the interrupt handler, call the function installDPRHandler. This will set up theinterrupt vector to the new handler and store the old vector. To restore the previous handler,call removeDPRHandler. This should always be called before the program exits.
3.9 Status/Control RegistersVarious locations in DPR have been set aside to provide support for specific functionality.A full description of the registers is presented in 8.2.6: Special Functions Registers, thefollowing sections cover the support provided by the library.
3.9.1 Data SynchronisationIt may be desirable to prevent NextMove from updating the MML area (see 3.6 Auto-UpdateArea) to a period to allow a ‘snap-shot’ of DPR to be taken. The status and control registersprovide a mechanism for this. It is supported by the function lockDPR. This function canbe used to
request that DPR not be updated by MML inform MG that it can now update MML.
Note that locking DPR can take up to two milliseconds to complete.
Note: lockDPR can also be used to speed up code running on NextMove, as NextMovewill not have to update the MML area of DPR.
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 39
3.9.2 Reading the Number of Axes and I/O SupportedThere are registers on NextMove PC which can be interrogated to find the number of axesand type of I/O supported by the application (see section 8.2.6 Special Functions Registers).In previous versions of the MINT Interface Library there ware functions to return thefunctionality, but in this version, getWord must be used to read directly from the registers asfollows
the number of analogue inputs getWord (hController, roNUM_AIO, &nVar ); nNumberOfAnalogueInputs = HIBYTE ( nVar );
the number of DACs getWord ( hController, roNUM_AIO, &nVar ); nNumberOfDACs = LOBYTE ( nVar );
the number of inputs getWord ( hController, roNUM_DIO, &nVar ); nNumberOfInputs = HIBYTE ( nVar );
the number of outputs getWord ( hController, roNUM_DIO, &nVar ); nNumberOfOutputs = LOBYTE ( nVar );
the number of servo axes getWord ( hController, roNUM_AXES, &nVar ); nNumberOfServoAxes = HIBYTE ( nVar );
the number of stepper axesgetWord ( hController, roNUM_AXES, &nVar );nNumberOfStepperAxes = LOBYTE ( nVar );
3.9.3 Reading MINT DetailsMINT constantly updates registers which can be used to find the following
the MINT line being executed getWord ( hController, roMINT_LINE, &nMINTLine );
the current MINT Error getWord ( hController, roMINT_ERROR, &nMINTError );
whether MINT is at the command line or running getWord ( hController, roMINT_STATUS, &nVar ); bMINTRunning = ( 0 != ( nVar & mkNOT_COMMAND_LINE ));
whether MINT is in the configuration or program buffer getWord ( hController, roMINT_STATUS, &nVar );
Communicating With NextMove PC
MINT Interface Library: Issue 4.3 Page 40
bInProgram = ( 0 != ( nVar & mkPROGRAM ));
whether MINT is executing codegetWord ( hController, roMINT_STATUS, &nVar );bExecutingCode = ( 0 != ( nVar & mkEXECUTING ));
Communicating With Serial Controllers
MINT Interface Library: Issue 4.3 Page 41
4. Communicating With Serial Controllers________This section is an overview of the different methods available on communicating with aserial controller. It is not intended to provide full details: for these see the MINT manual.All the functions listed are explained in depth in Section 7: Function Reference.
4.1 The Command Line/File Upload/DownloadThe basic method of communicating with a serial controller running MINT (not MINT328)is via the command line. Debugging aside, the simplest method of running an application ona serial controller is to download the configuration & program files (usingdownloadMINTFile(Ex)) and then to call MINTRun. This will be enough for manystandalone applications.
Relevant functions (functions required for minimum application in bold):
downloadMINTFile downloadMINTFileEx serialGetChar serialGetCharTimeout serialGetStringTimeout serialPutChar serialPutCharTimeout serialPutStringTimeout MINTBreak MINTRun uploadMINTFile uploadMINTFileEx
4.2 Protected Mode Comms ProtocolThis is the simplest method of synchronising the host and the controller. The protectedmode comms protocol allows a 99 element array to be shared between a MINT programrunning on the controller and the host. Either side can read to or write from the comms area,so it can be used for passing data, or control codes.
Relevant functions (functions required for minimum application in bold):
COMMSAbort COMMSRead
Communicating With Serial Controllers
MINT Interface Library: Issue 4.3 Page 42
COMMSWrite getCOMMSRetries setCOMMSRetries
4.3 MINT328MINT328 is available for the EuroSystem family. It replaces standard MINT (via anEPROM change) and allows the host to send MINT command directly to the controller.There is no command line or configuration/program in a MINT328 controller: all motion hasto be requested from the host.
Relevant functions (functions required for minimum application in bold):
getMINT328Retries MINT328Command MINT328Read MINT328Write setMINT328Retries
4.4 HPGLHPGL is also available on the EuroSystem family. Like MINT328 it replaces standardMINT. Again, like MINT328 all commands are sent from the host.
Relevant functions (functions required for minimum application in bold):
abortDownloadHPGL downloadHPGLFile getHandshakeMode setHandShakeMode
4.5 Updating FirmwareOn the EuroSystem family, changing the firmware involves an EPROM change. OnNextMove BX and ServoNode, new firmware will be supplied in file form, and can bedownloaded by the controller to FLASH where it will be stored (“Update” on cTERM forWindows.) The functions available to perform this in the MINT Interface Library are
updateFirmware updateFirmwareEx
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 43
5. Using the Library with Various Languages _____
5.1 Visual Basic 5 & 4 (16 & 32 bit)To access the MINT Interface Library from Visual Basic include MIL_DEV.bas ( developeredition ) or MIL_STD.bas ( standard edition ) in the project. Do not include both. Whendistributing the application, distribute MIL_DEV.DLL, or MIL_STD.DLL
Important note for serial controllers : In the VB development environment, if you pressthe stop button, the application will stop immediately without freeing any handles.
This will leave the serial port open, and the next time you try to access the port it willbe unavailable. To solve this, call resetHostDLL before createXXXHandle. This will
free any previous handles.
5.2 Borland Delphi v2 (32 bit)To access the MINT Interface Library from Visual Basic include MIL32DEV.pas (developer edition ) or MIL32STD.pas ( standard edition ) in the project. Do not includeboth. When distributing the application, distribute MIL32DEV.DLL or MIL32STD.DLL
5.3 Borland C/C++To link with the DLLs using Borland C, run the IMPLIB utility provided with Borland C onthe relevant DLL, MIL32DEV.DLL or MIL32STD.DLL, and link to the resultant .lib file.
5.4 C/C++ #definesThe following definitions can be used under C or C++. Note that this only applies if youare including the C++ files from the MINT Interface Library Developer edition, as opposedto calling functions from the DLL.
#define Use
_USE_MFC_ If using MFC libraries under Visual C 1.5x_FORCE_SZ_ Only use C style NULL terminated strings under C++. By default,
string classes are used._NO_STD_ Do not use the Standard Template Library under later versions of
Visual C and Borland C for string and file classes ( these are used bydefault )
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 44
5.5 C++ ( Developer Edition )The MINT Interface Library has been tested with Borland C++ 4.5X, Microsoft Visual C++v1.5X, Microsoft Visual C++ 4.2, Microsoft Visual C++ 5.0. By including the source codein the project, C++ classes can be used instead of createXXXHandle .
Example (C++):Taken from \examples\cpp1
/*-----------------------------------------------------------------------*//* macro definitions *//*-----------------------------------------------------------------------*/#define NODE0 0#define COM1 1
/*-----------------------------------------------------------------------*//* lpfnCancel *//* *//* Argument list: *//* *//* Return value: *//* TRUE: user pressed <Ctrl-Z>. Cancel the download *//* *//* Description: *//* This function will be called by the MINT Interface Library to *//* check whether the download should be cancelled. *//* *//*-----------------------------------------------------------------------*/__int8 CALLBACK lpfnCancel ( void ){ __int8 c; if ( kbhit()){ c = getch(); /*-------------------------------------------------------------------*/ /* If the user has pressed <Ctrl-E>, cancel the download */ /*-------------------------------------------------------------------*/ return ( 0x1a == c ); } return FALSE;}
/*-----------------------------------------------------------------------*//* lpfnProgress *//* *//* Argument list: *//* __int16 nLines: the number of lines downloaded so far. *//* *//* Return value: *//* void *//* *//* Description: *//* Each time downloadFileEx downloads a line, it will call this *//* function to allow progress to be displayed. *//* *//*-----------------------------------------------------------------------*/
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 45
void CALLBACK lpfnProgress ( __int16 nLines ){ printf ( "Lines downloaded: %d \r", nLines );}
/*-----------------------------------------------------------------------*//* main *//* *//* Argument list: *//* void *//* *//* Return value: *//* void *//* *//* Description: *//* This routine downloads a MINT file to either a NextMove PC or a *//* EuroSystem ( or EuroSystem family ) *//* *//*-----------------------------------------------------------------------*/void main ( void ){
/*---------------------------------------------------------------------*/ /* We don't know at this point whether we are creating a CNextMovePC */ /* or a CEuroSystem object, so use the CController base class. */ /*---------------------------------------------------------------------*/ CController *pMyController;
/*---------------------------------------------------------------------*/ /* Use a keypress to select which type of controller we will be */ /* using: 'N': NextMove PC, 'E': EuroSystem */ /*---------------------------------------------------------------------*/ printf ("Press 'N' for NextMove or 'E' for EuroSystem\n"); int nCh; while ( nCh = toupper ( getch())){ if (( 'N' == nCh ) || ( 'E' == nCh )) break; }
/*---------------------------------------------------------------------*/ /* Create an object of the correct class */ /*---------------------------------------------------------------------*/ if ( 'N' == nCh ) pMyController = new CNextMovePC ( NODE0, 0x33C ); else pMyController = new CEuroSystem ( NODE0, COM1, 9600, TRUE );
/*---------------------------------------------------------------------*/ /* Download the file */ /* Note that under 'C' as opposed to C++, the function downloadFileEx */ /* would be used instead. */ /* e.g. */ /* hController = createNextMovePCHandle ( NODE0, 0x33C ); */ /* downloadMINTFileEx ( hController, "test.mnt", filePROGRAM, */ /* lpfnCancel, lpfnProgress ); */ /*---------------------------------------------------------------------*/ __int16 nError; __int8 szError[szMAX_ERROR];
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 46
printf ("Downloading file: press Ctrl-Z to quit\n"); nError = pMyController->downloadMINTFile ( "test.mnt", filePROGRAM, lpfnProgress, lpfnCancel );
/*---------------------------------------------------------------------*/ /* Display the result */ /*---------------------------------------------------------------------*/ getErrorString ( szError, nError ); printf ( "\nError %d: %s\n", nError, szError );
/*---------------------------------------------------------------------*/ /* Delete the object. Remember to dereference to the correct class. */ /*---------------------------------------------------------------------*/ if ( 'N' == nCh ) delete ( CNextMovePC * ) pMyController; else delete ( CEuroSystem * ) pMyController;
/*---------------------------------------------------------------------*/ /* Give the user a chance to read the message. */ /*---------------------------------------------------------------------*/ printf ("Press any key to exit\n"); while (!kbhit());}
For each createXXXHandle there is an equivalent class:
createEuroSystemHande : CEuroSystem createNextMoveBXHandle : CNextMoveBX createNextMovePCHandle : CNextMovePC createServoNodeHandleHandle : CServoNode createRemoteServoNodeHandle : CRemoteServoNode createRemoteEuroSystemHandle : CRemoteEuroSytem createRemoteNextMoveBXHandle : CRemoteNextMoveBX
The constructors for these classes all take the same parameters as the relatedcreateXXXFunction.
All these classes are derived from the CController class, so it is safe to deference to aCcontroller class, as in the example above, if the type of controller to be created in decidedat run-time. All the functions available in the MINT Interface Library are available for eachclass, but the hController parameter is not required in C++.
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 47
5.5.1 Files to include in the project.
File Include
base.cpp in all projectscport.cpp if using a serial controller classcportdos.cpp if using a serial controller for a DOS target. Note that the
GreenLeaf Commlib v5.2c must be purchased, and therelevant .lib file included in the project. ( also define _GLF_)
Cport16.cpp if using a serial controller class for a Windows 3.x target.Cport32.cpp if using a serial controller class for a Win95 / WinNT target.Eurosys.cpp if using the CEuroSystem classhost_def.cpp if using getErrorStringnextmove.cpp if using CNextMovePCnm_bx.cpp if using CNextMoveBXnm_mml.cpp if using CNextMovePCnm_mml1.cpp if using CNextMovePCnm_nt.cpp if using CNextMovePC on a 32 bit conpilernmbase.cpp if using CNextMovePCnmstd.cpp if using CNextMovePCrem_euro.cpp if using CRemoteEuroSystemrem_sn.cpp if using CRemoteServoNodeserial.cpp if using a serial controller classservonode.cpp if using CServoNode.
Each of the files above has a related .h include file.
5.6 ‘C’
5.6.1 Include filesInclude host_cif.h (host ‘C’ interface) for all functions except ICM functions. For these,include mg.h ( Developer Edition only ). The functions can ( and must, in Standard Edition) be called from the DLL. In Visual C include the relevant .lib file in the project to call theDLL functions. These can be found in the DLL16 and DLL32 directories. To compile withthe source code ( developer edition only ), read the following sections.
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 48
5.6.2 Required #definesThe ‘C’ interface requires one of the following definitions.
MULTIPLE_CONTROLLERS Always define this, unless creating a C31 emulationproject.
SINGLE_CON Define this if creating a C31 emualtion project. Thisis when the code written will later be compiled with across-compiler and run on the controller.
The following definitions can be used under C or C++. Note that this only applies if youare including the C++ files from the MINT Interface Library Developer edition.
#define Use
_USE_MFC_ If using MFC libraries under Visual C 1.5x_FORCE_SZ_ Only use C style NULL terminated strings under C++. By default,
string classes are used._NO_STD_ Do not use the Standard Template Library under later versions of
Visual C and Borland C for string and file classes ( these are used bydefault. )
5.6.3 Files to Include in the Project.The files base.cpp and host_cif.cpp must be included in all project. The remaining files areoptional, but if they are not used, defines as in the table below will be required,
File Include define if not required
cport.cpp if using a serial controller class -eurosys.cpp if using createEuroSystemHandle _NO_EUROSYSTEM_ or
_NM_PC_ONLY_host_cif.cpp if using ICM functions with
NextMove PC-
host_def.cpp if using getErrorString -nextmove.cpp if using createNextMovePCHandle _NO_NM_PC_nm_bx.cpp if using createNextMoveBXHandle _NO_NEXTMOVE_BX_nm_mml.cpp if using createNextMovePCHandle _NO_NM_PC_nm_mml1.cpp if using createNextMovePCHandle _NO_NM_PC_nm_nt.cpp if using createNextMovePCHandle _NO_NM_PC_nmbase.cpp if using createNextMovePCHandle _NO_NM_PC_nmstd.cpp if using createNextMovePCHandle _NO_NM_PC_
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 49
File Include define if not required
rem_euro.cpp if usingcreateRemoteEuroSystemHandle
_NO_REM_EUROSYSTEM_or _NO_REMOTE_or _NM_PC_ONLY_
rem_sn.cpp if usingcreateRemoteServoNodeHandle
_NO_REMSERVONODE_or_NO_REMOTE_or _NM_PC_ONLY_
rem_bx.cpp If usingcreateRemoteNextMoveBXHandle
-_NO_REMOTE_
serial.cpp if using a serial controller class -servonode.cpp if using createServoNodeHandle. _NO_SERVONODE_ or
_NM_PC_ONLY_
Note: Be sure to set structure alignment to 2 bytes or less in the compiler options ifICM functions are used.
Using the Library with Various Languages
MINT Interface Library: Issue 4.3 Page 50
This page left intentionally blank.
The Example Programs
MINT Interface Library: Issue 4.3 Page 51
6. The Example Programs_______________________There are several example programs installed with the MINT Interface Library. They can befound in the Examples subdirectory.
6.1 AUTOUPDTMINT Interace Library Edition:Standard & Professional
Language:Borland Delphi v2.0
Target:Win95 / WinNT ( Professional Only )
Controller:NextMove PC
Demonstrates: Handle creation / freeing Reading motion variables e.g. position from the auto-update area. Writing to auto-update variables using setAutoUpdateModified Downloading mint.out to NextMove PC using updateFirmware. Checking whether a NextMove is present at a specified address usingisControllerPresent.
The Example Programs
MINT Interface Library: Issue 4.3 Page 52
Description:
The auto-update example uses the auto-update area to allow the user to modify gainswhile viewing speed and position. The 'read' button reads from the auto-update area andthe 'write' button writes any values modified by the user back to NextMove.
Note : by default, this example works with a NextMove PC at address $33C. To use aNextMove at any other address, modify the constant NextMoveAddress.
6.2 AXISTESTMINT Interace Library Edition:Professional
Language:Visual Basic 5 or 4( 16 or 32 bit )
The Example Programs
MINT Interface Library: Issue 4.3 Page 53
Target:Windows 3.x / Win95 / WinNT
Controller:EuroSystem family.
Demonstrates: Handle creation / freeing Protected mode comms protocol. MINT file download.
The Example Programs
MINT Interface Library: Issue 4.3 Page 54
Description:
The axistest example downloads a MINT file to the controller and then uses theprotected mode
The Example Programs
MINT Interface Library: Issue 4.3 Page 55
Description:
The axistest example downloads a MINT file to the controller and then uses the protectedmode comms protocol to display position of the axes and state of the inputs. It also allowsthe user to clear/set the outputs and write to the DAC.
The Example Programs
MINT Interface Library: Issue 4.3 Page 56
6.3 bckgrndMINT Interace Library Edition:Professional
Language:Visual Basic v5 or 4 ( 16 or 32 bit )
Target:Windows 3.x / Win95 / WinNT
Controller:NextMove PC
Description:The bckgrnd example demonstrates how a MINT program can be used to handle I/O while ahost based program is controlling the program path.
Pressing the 'Download MINT' button loads mint.out and the program file onto NextMove.The MINT program monitors input 1. If input1 one is held active, MINT toggles output 1.The comms protocol is used to pass a count of the number of inputs to the top end.Pressing the square or circle button uses Immediate Command Mode to perform a linear orcircular move on axes 0 and 1.
Note:This example has been written for a NextMove PC at address &H33C. To specify aNextMove at a different address, change the constant DEFAULT_ADDRESS infrmmain.frm.
The Example Programs
MINT Interface Library: Issue 4.3 Page 57
6.4 C31 EMUMINT Interace Library Edition:Professional
Language:Borland C++ / MicroSoft Visual C++ v1.5 / MicroSoft Visual C++ v5
Target:DOS / WIN32 console
Controller:NextMove PC
Description:The C31 emulation example shows how to write a NextMove PC program which can run onNextMove after compiling with a C31 compiler, or can be run from the host to aiddebugging.
6.5 canMINT Interace Library Edition:Professional
Language:Borland Delphi v2.0
Target:Win95 / WinNT
Controller:NextMove PC
Description:The can example is an Immediate Command Mode example application. The CAN bus isinitialised and a number of remote nodes added. The nodes inputs and outputs can becontrolled from the check boxes and the CAN error/event queue can be viewed.
This demonstrates
Handle creation / freeing
The Example Programs
MINT Interface Library: Issue 4.3 Page 58
Immediate Command Mode use of MINT Motion Library functions.
Description:This example has been written for a NextMove PC at address &H33C. To specify aNextMove at a different address, change the constant address.
6.6 COMMSMINT Interace Library Edition:Standard & Professional
Language:Visual Basic 5 & 4 ( 16 or 32 Bit )
Target:Windows 3.1, Win 95 / WinNT ( Professional Only )
Controller:NextMove PC
Demonstrates: Handle creation / freeing Downloading & running a MINT file. Using the comms array to communicate with a MINT program running onNextMove PC.
The Example Programs
MINT Interface Library: Issue 4.3 Page 59
Description:
The comms example uses the comms array to communicate commands and values with aMINT program running on NextMove PC. Pressing the 'Download Program File' buttonloads and runs the MINT program. Then the buttons can be used to perform JOGs orMOVEAs on axes 0-4. The position is updated using a timer, and a status line showswhat the controller is doing.This example does not handle errors on NextMove. The next step in this example wouldbe to write a MINT #onerror routine which allows controlled error handling supervisedby the host program.
Notes
1. This example requires (nm)mint.out and a valid config file to have alreadybeen downloaded to the NextMove PC.
The Example Programs
MINT Interface Library: Issue 4.3 Page 60
2. By default, this example works with a NextMove PC at address $33C. Touse a NextMove at any other address, modify the constantNEXTMOVE_ADDRESS.
6.7 cpp1MINT Interace Library Edition:Professional
Language:Microsoft Visual C++ v4.x or v5
Target:Win32 console application ( Win95 / WinNT )
Controller:NextMove PC and EuroSystem
Description:The cpp1 example prompts the user to select either EuroSystem or NextMove PC. It thencreates a C++ object of the correct class and uses it to download a file to the controller.This demonstrates
How the C++ code can be used, removing the need to use handles. How to use the CController base class, and decide at run-time which class type tocreate.
6.8 downloadMINT Interace Library Edition:Professional
Language:Borland C v4.5, Microsoft Visual C++ v4,5
Target:Win32 console application ( Win95 / WinNT )
The Example Programs
MINT Interface Library: Issue 4.3 Page 61
Controller:NextMove PC
Description:The download example loads mint.out and a configuration and program file to NextMovePC. It shows how to use the updateFitrmwareEx and downloadMINTFileEx functions withcallbacks. The callback functions can be used as templates for your own callbacks for usewith the xxxEx functions.
6.9 euro485MINT Interace Library Edition:Professional
Language:Microsoft Visual C++ v4,5
Target:Win32 console application ( Win95 / WinNT )
Controller:2 EuroSystem (or family) 485s on a multi-drop cable.
Description:The euro485 examples download a file to a pair of EuroSystem 485s. There are twoexamples: one with automatic node selection and one without.
6.10 file_udMINT Interace Library Edition:Professional
Language:Microsoft Visual C++ v4,5, Borland 4.5
Target:Win32 console application ( Win95 / WinNT )
The Example Programs
MINT Interface Library: Issue 4.3 Page 62
Controller:EuroSystem, ServoNode, NextMove BX, NextMove PC.
Description:Depending on user input, file_ud will download or upload a MINT file to/from any of thecontrollers listed above. It is a good example of how handles can be used to write code thatis controller independent.
6.11 icm_testMINT Interace Library Edition:Professional
Language:Visual Basic 5 & 4 ( 16 or 32 bit )
Target:Windows 3.1 / Win95 / WinNT
Controller:NextMove PC
Description:The ICM Test example allows several of the immediate command mode functions availableon NextMove to be used. Each of the buttons calls the ICM function named on the button.The address of the NextMove PC can be passed to the program, or the constantDEFAULT_ADDRESS can be modified to the correct address.
The Example Programs
MINT Interface Library: Issue 4.3 Page 63
6.12 IOTestMINT Interace Library Edition:Professional
Language:Visual Basic 5 & 4 ( 16 or 32 bit )
Target:Windows 3.x / Win95 / WinNT
Controller:NextMove PC
The Example Programs
MINT Interface Library: Issue 4.3 Page 64
Description:
This example uses the Immediate Command Mode ( ICM ) to read the state of the inputs andoutputs. It reads from NextMove which inputs are being used for the Home / Limits / Stop/ Error input on each axis. The inputs can then be referenced as input number or axis /input type. The output checkboxes can be used to set or clear the outputs.
The example should be used after configuring the inputs using either ICM or a MINTconfiguration file.
This example has been written for a NextMove PC at address &H3C. For a NextMove at adifferent address modify the constant DEFAULT_ADDRESS in frmmain.frm
6.13 MINT328MINT Interace Library Edition:Professional
Language:Microsoft Visual C++ v4,5, Borland 4.5
Target:Win32 console application
The Example Programs
MINT Interface Library: Issue 4.3 Page 65
Controller:EuroSystem family with a MINT328 EPROM
Description:The MINT328 example demonstrates how to use the MINT328 commands. It is quite small:it simply read the version from the controller and 'counts up' the outputs. It can be usedthough as a framework for a larger MINT328 program.
6.14 TERMINALMINT Interace Library Edition:Standard & Professional
Language:MicroSoft Visual C v5.0
Target:Win95 / WinNT ( Professional Only )
Controller:NextMove PC
Demonstrates: Handle creation / freeing Serial Communications Checking whether a NextMove is present at a specified address usingisControllerPresent.
Description:This example provides a simple terminal to allow communications with the MINT commandline on NextMove PC.
6.15 updateMINT Interace Library Edition:Professional
Language:Microsoft Visual C++ v4,5
The Example Programs
MINT Interface Library: Issue 4.3 Page 66
Target:Win32 console application
Controller:NextMove BX
Description:This example shows how to update the firmware on a NextMove BX. It can be modified towork with NextMove PC or ServoNode by changing the createNextMoveBXHandle tocreateNextMovePCHandle or createServoNodeHandle.
Function Reference
MINT Interface Library: Issue 4.3 Page 67
7. Function Reference __________________________This section lists all functions except Immediate Command Mode functions, in alphabeticalorder. For Immediate Command Mode functions, see the MINT Motion Library manual.Several functions have been renamed as the MINT Serial Toolkit and Host to NextMove/PClibraries have been consolidated. Renamed or removed functions are still included in thedocumentation with references to the replacing function.
Each function will list the controllers it applies to using the following matrix:
NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNodeRemote Remote Remote
No No No Yes No No No
The controllers are:
NextMove BX Standalone NextMove. Communication is via a serial link.NextMove BX Remote This is the same as NextMove BX, but assumes that the unit
is on a multi-drop RS485 link.NextMove PC PC based NextMove controller. Communication is via Dual
Port RAMEuroSystem EuroSystem product family of serial based controllers.
Includes EuroSystem, EuroStep, SmartStep, SmartSystem,SmartMove and EuroServo.
EuroSystem Remote This is the same as EuroSystem, but assumes that the unit ison a multi-drop RS485 link.
ServoNode Single axis integrated drive and controller with support forpeer-to-peer CAN communications.
ServoNode Remote This is the same as ServoNode, but assumes that thecontroller is on a CAN bus link with communication throughthe Network Manager.
Function Reference
MINT Interface Library: Issue 4.3 Page 68
abortDownloadHPGL
Prototype:‘C’ - __int16 abortHPGLDownload ( OCHANDLE hController );VB - abortHPGLDownload% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes No No No
Parameters:hController: Handle to the controller.
Description:This function has been provided to allow a mechanism to abort HPGL downloads underWindows. Every 100 ms downloadHPGL checks to see if abortDownloadHPGL has beencalled and if so, aborts the download. This means that you should call this function and thenwait for downloadHPGL to finish normally. downloadHPGL will return erUSER_ABORT.
Notes:
1. Always make sure downloadHPGL has completed before closing theapplication. Failure to do so can cause application errors. TheQueryUnload routine can be used to control this in Visual Basic.
2. You must call this function and then allow downloadHPGL to complete. i.e.don't sit in a WHILE loop waiting for downloadHPGL to finish as this willnot leave downloadHPGL any processor time.
See also:
downloadHPGL
abortMMLCommand
Prototype: ‘C’ - __int16 abortMMLCommand ( OCHANDLE hController );VB - abortMMLCommand% Lib "host32" (ByVal hController&)
Function Reference
MINT Interface Library: Issue 4.3 Page 69
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
Description:abortMMLCommand causes the currently executing Immediate Command Mode commandto exit as soon as possible. This is mainly for use in multi-tasking systems (Windows).setMMLEnabled is usually a much more useful function. Refer to 3.7.4: Multi-ThreadingSystems
This function is not available in a ‘C31 emulation’ build.
See also:
setMMLEnabled
Function Reference
MINT Interface Library: Issue 4.3 Page 70
boardInResetThis function has been renamed to isControllerInReset
Function Reference
MINT Interface Library: Issue 4.3 Page 71
checkScratchPadRenamed to isControllerPresent
clearOutputThis function has been removed. Instead use putLong (roOUTPUTS, bitPattern), wherebitPattern represent the outputs and bit 12 represents the relay. Then callsetAutoUpdateModified (roOUTPUTS)
See section 3.6: Auto-Update Area for details.
clearSerialError
Prototype:'C' - __int16 clearSerialError ( OCHANDLE hController );VB - clearSerialError% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Description:clearSerialError clears any error associated with the serial (pseudo-serial on NextMove PC)port. This may be a chip error on a serial port or the result of Dual Port RAM corruption onNextMove PC.
Parameters:hController: Handle to the controller (see createXXXXHandle)
clearSerialReceiveBuffer
Prototype:'C' - __int16 clearSerialReceiveBuffer ( OCHANDLE hController );VB - clearSerialReceiveBuffer% Lib "host32" (ByVal hController&)
Function Reference
MINT Interface Library: Issue 4.3 Page 72
Controller:
NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNodeRemote Remote Remote
Yes No Yes Yes No Yes No
Parameters:hController: Handle to the controller (see createXXXXHandle)
Description:clearSerialReceiveBuffer empties the serial (or pseudo-serial) receive buffer.
clearSerialTransmitBuffer
Prototype:'C' - __int16 clearSerialTransmitBuffer ( OCHANDLE hController );VB - clearSerialTransmitBuffer% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller (see createXXXXHandle)
Description:clearSerialReceiveBuffer empties the serial (or pseudo-serial) transmit buffer.
COMMSAbort
Declaration:'C' - __int16 COMMSAbort ( OCHANDLE hController );VB - COMMSAbort% Lib "host32" (ByVal hController&)Delphi - function COMMSAbort ( hController: OCHANDLE ):
SmallInt ; stdcall;
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Function Reference
MINT Interface Library: Issue 4.3 Page 73
Remote Remote RemoteYes Yes No Yes Yes Yes Yes
Parameters:hController: Handle to the controller (see createXXXXHandle)
Description:COMMSAbort breaks a serial controller out of the protected mode communications protocol.This allows the program to be stopped using MINTBreak.
COMMSRead
Prototype:'C' - __int16 COMMSRead ( OCHANDLE hController, __int16 nCOMMSAddress,
float *fValue);VB - COMMSRead% Lib "host32" (ByVal hController&,
ByVal nCOMMSAddress%,ByRef fValue!)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Description:The 99 element MINT protected mode comms array on serial controllers can be written to orread by both the MINT program on the controller and the host. This allows simplecommunications between host and MINT program. For example, the MINT program couldkeep the host informed of its axes positions by writing them to the comms locations, or thehost could tell MINT to start a move by writing to a particular COMMS location. OnNextMove PC this functionality has been emulated, but using Dual Port RAM instead ofprotected mode serial communications. COMMSRead reads the value specified in the MINTCOMMS protocol location nAddress into fValue. Note that on a serial controller, theCOMMS protocol must be initialised with COMMSON, but on a NextMove PC it is alwaysavailable.
See Section 3.4 MINT Comms Array (NextMove PC) Section 4.2Protected Mode CommsProtocol (Serial Controllers) and the MINT manual for more details.
Parameters:hController: Handle to the controller (see createXXXXHandle)
Function Reference
MINT Interface Library: Issue 4.3 Page 74
nAddress: Comms location between 1 and 99.
fValue: Variable to store the read value in.
Example (VB):DIM fValue!if COMMSRead (hController, 22, fValue) MsgBox “Error reading from COMMS location 22”else MsgBox “COMMS location 22 contains “ & fValueendif
See also:
COMMSAbort, COMMSWrite, COMMSWriteMultiple
COMMSWrite
Prototype:'C' - __int16 COMMSWrite ( OCHANDLE hController, __int16 nCOMMSAddress,
float fValue);VB - COMMSWrite% Lib "host32" (ByVal hController&,
ByVal nCOMMSAddress%,ByVal fValue!)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hNextMove: Handle to the controller
nAddress: Comms location between 1 and 99.
fValue: Value to write.
Note for upgrading users. Note that the fValue parameter is now passed by value notreference.
Description:COMMSWrite writes the floating point number to the protected comms location specified.This can then be read in a MINT program by reading from the COMMS array,
Function Reference
MINT Interface Library: Issue 4.3 Page 75
See COMMSRead, Section 3.4 MINT Comms Array (NextMove PC), Section 4.2ProtectedMode Comms Protocol (Serial Controllers) and the MINT manual for more details.
Example(‘C’):if (COMMSWrite (hNextMove, 20, 12.2)) printf (“Error writing %G to location 20\n”, fValue);
See also:
COMMSRead, COMMSWriteMultiple, COMMSAbort
COMMSWriteMultiple
Prototype:'C' - __int16 COMMSWriteMultiple ( OCHANDLE hController,
__int16 nCOMMSAddress, const float FAR fValArray[],
__int16 nArraySize);VB - COMMSWriteMultiple% Lib "host32" (ByVal hController&,
ByVal nCOMMSAddress%, ByRef fValArray!,
ByVal nArraySize%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:nCOMMSAddress: the first comms location to write to.
lpfArray: the array of values to write
nNumberOfValue: the number of values in the array to write.
Description:On a serial controller COMMSWriteMultiple updates several consecutive COMMS locationsusing one data packet. By combining the values in one packet, it reduces overhead. On aNextMove PC the values are simply written one after another.
Function Reference
MINT Interface Library: Issue 4.3 Page 76
Note that the maximum size of the COMMSWriteMultiple ‘data field‘ in a COMMSpacket is 60 characters. The ‘data field‘ is produced by creating a text string
containing the values seperated by commas. For example: to write the values 123.43and 12.76 (to any location), the data part of the packet is “123.43,12.76” i.e. 12
characters + 1 for the NULL terminator. If the packet produced byCOMMSWriteMultiple is longer than 60 characters, it will not be sent, and the
function will return erDATA_TOO_LONG.
Example (Delphi ):var nError: SmallInt; fVal: Single; fArray: Array[0..4] of Single; szError: Array[0..150] of Char;
hBusMaster, hNode1: OCHANDLE;
const NODE0 = 0; const NODE1 = 1; const COM1 = 1;
begin
{*************************************************************************) { Create a handle to the busmaster ( node 0 ) } (*************************************************************************) hBusMaster:= createServoNodeHandle ( NODE0, COM1, 9600, 1 ); {*************************************************************************) { Create a handle to the node 1 on the CAN bus } (*************************************************************************) hNode1:= createRemoteServoNodeHandle ( NODE1, hBusMaster );
{*************************************************************************) { Initialise the array } (*************************************************************************) fArray[0]:=11; fArray[1]:=12; fArray[2]:=13; fArray[3]:=14; fArray[4]:=15;
{*************************************************************************) { Write to the comms array on node 1 } (*************************************************************************) nError:= COMMSWriteMultiple ( hNode1, 1, fArray[0], 5 ); if ( nError <> erSUCCESS ) then begin getErrorString (szError, nError ); ShowMessage ( szError ); end;
{*************************************************************************) { Read from node 1 }
Function Reference
MINT Interface Library: Issue 4.3 Page 77
(*************************************************************************) nError:= COMMSRead ( hNode1, 2, fVal ); if ( nError <> erSUCCESS ) then begin getErrorString (szError, nError ); ShowMessage ( szError ); end;
{*************************************************************************) { Free both handles } (*************************************************************************) freeHandle ( hNode1 ); freeHandle ( hBusMaster );
See also:
COMMSWrite, COMMSRead, COMMSAbort
createEuroSystemHandle
Prototype: ‘C’ - OCHANDLE createEuroSystemHandle ( __int16 nNodeID,
__int16 nComPort,__int32 lBaudRate,__int8 bOpenPort );
VB - createEuroSystemHandle& Lib "host32" (ByVal nNodeID%, ByVal nComPort%,ByVal lBaudRate&,ByVal bOpenPort As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes No No No
Parameters:nNodeId: The CAN or RS485 node number. In most cases this will be 0.
nComPort: The serial port number the controller is connected to.
lBAudRate: The baud rate of the serial port. By default, serial controllers are setto communicate at 9600 baud, but this can be changed using theMINT BAUD keyword on the EuroSystem.
bOpenPort: Whether to open the port immediately. To open the port later, passFALSE to this parameter and call openDevice later.
Function Reference
MINT Interface Library: Issue 4.3 Page 78
Description:createEuroSystemHandle is used to create a handle for use with the other functions. It willcreate a handle to any of the EuroSystem family of controllers (EuroSystem, EuroServo,EuroStep, SmartStep, SmartSystem, SmartMove.)
See Section 2 Communication Basics: Using Handles for more information and an example.
Note: createEuroSystemHandle should only be used to create a handle to oneEuroSystem on an RS485 network. createRemoteEuroSystemHandle should be used to
create handles to the other nodes.
See also:
createNextMovePCHandle, createNextMoveBXHandle, createRemoteNextMoveBXHandle,createServoNodeHandle, createRemoteServoNodeHandle, createRemoteEuroSystemhandle,freeHandle.
createRemoteEuroSystemHandle
Prototype: ‘C’ - OCHANDLE createRemoteEuroSystemHandle( __int16 nNodeID,
OCHANDLE hBusMaster );VB - createRemoteEuroSystemHandle& Lib "host32" (ByVal nNodeID%,
ByVal hBusMaster&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No No Yes No No
Parameters:nNodeId: The CAN or RS485 node number.
hBusMaster: A handle to the controller with a physical connection to the host
Description:createRemoteEuroSystemHandle creates a handle to a ServoNode on an RS485 network.See Section 2.1: CAN and RS485 Networks. for more details and an example.
Function Reference
MINT Interface Library: Issue 4.3 Page 79
See also:
createEuroSystemHandle, createNextMovePCHandle, createNextMoveBXHandle,createRemoteNextMoveBXHandle, createServoNodeHandle,createRemoteServoNodehandle, freeHandle.
createRemoteNextMoveBXHandle
Prototype: ‘C’ - OCHANDLE createRemoteNextMoveBXHandle ( __int16 nNodeID,
OCHANDLE hBusMaster );VB - createRemoteNextMoveBXHandle& Lib "host32" (ByVal nNodeID%,
ByVal hBusMaster&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo Yes No No No No No
Parameters:nNodeId: The RS485 node number.
hBusMaster: A handle to the controller with a physical connection to the host
Description:createRemoteNextMoveBXHandle creates a handle to a NextMove BX on an RS485network. See Section 2.1: CAN and RS485 Networks. for more details and an example.
See also:
createEuroSystemHandle, createNextMovePCHandle, createNextMoveBXHandle,createServoNodeHandle, createRemoteEuroSystemhandle, freeHandle.
createRemoteServoNodeHandle
Prototype: ‘C’ - OCHANDLE createRemoteServoNodeHandle ( __int16 nNodeID,
OCHANDLE hBusMaster );VB - createRemoteServoNodeHandle& Lib "host32" (ByVal nNodeID%,
ByVal hBusMaster&)
Function Reference
MINT Interface Library: Issue 4.3 Page 80
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes No No Yes
Parameters:nNodeId: The CAN or RS485 node number.
hBusMaster: A handle to the controller with a physical connection to the host
Description:createRemoteServoNodeHandle creates a handle to a ServoNode on a CAN or RS485network. See Section 2.1: CAN and RS485 Networks. for more details and an example.
See also:
createEuroSystemHandle, createNextMovePCHandle, createNextMoveBXHandle,createRemoteNextMoveBXHandle, createServoNodeHandle,createRemoteEuroSystemhandle, freeHandle.
createNextMoveHandleRenamed to createNextMovePCHandle
createNextMoveBXHandle
Prototype: ‘C’ - OCHANDLE createNextMoveBXHandle ( __int16 nNodeID,
__int16 nComPort,__int32 lBaudRate,__int8 bOpenPort );
VB - createNextMoveBXHandle& Lib "host32" (ByVal nNodeID%,ByVal nComPort%,ByVal lBaudRate&,ByVal bOpenPort As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No No No No No
Function Reference
MINT Interface Library: Issue 4.3 Page 81
Parameters:nNodeId: The CAN or RS485 node number. In most cases this will be 0.
nComPort: The serial port number the controller is connected to.
lBAudRate: The baud rate of the serial port. By default, serial controllers are setto communicate at 9600 baud, but this can be changed using theMINT BAUD keyword on the NextMove BX.
bOpenPort: Whether to open the port immediately. To open the port later, passFALSE to this parameter and call openDevice later.
Description:createNextMoveBXHandle is used to create a handle to a NextMove BX connected to thehost via a serial cable. See Section 2 Communication Basics: Using Handles for moreinformation and an example.
See also:
createNextMovePCHandle, createEuroSystemHandle, createServoNodeHandle,createRemoteNextMoveBXHandle, createRemoteServoNodeHandle,createRemoteEuroSystemhandle, freeHandle, openDevice
createNextMovePCHandle
Prototype: ‘C’ - OCHANDLE createNextMovePCHandle ( __int16 nNodeID,
__int16 nAddress );VB - createNextMovePCHandle& Lib "host32" (ByVal nNodeID%,
ByVal nAddress%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:nNodeId: The CAN node number (generally 0).
nAddress: The address of the NextMove e.g. 0x33C as set by the DIP switchesand jumper H.
Function Reference
MINT Interface Library: Issue 4.3 Page 82
Description:createNextMovePCHandle creates a handle to a NextMove PC. See Section 2Communication Basics: Using Handles for more information and an example. This functioncan be used under DOS, Windows 3.x, Windows 95 or Windows NT.
See also:
createEuroSystemHandle, createNextMoveBXHandle, createServoNodeHandle,createRemoteNextMoveBXHandle, createRemoteServoNodeHandle,createRemoteEuroSystemhandle, freeHandle.
createServoNodeHandle
Prototype: ‘C’ - OCHANDLE createServoNodeHandle ( __int16 nNodeID,
__int16 nComPort, __int32 lBaudRate,
__int8 bOpenPort );VB - createServoNodeHandle& Lib "host32.dll" (ByVal nNodeID%,
ByVal nComPort%,ByVal lBaudRate&,ByVal bOpenPort As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No No No Yes No
Parameters:nNodeId: The CAN or RS485 node number. In most cases this will be 0.
nComPort: The serial port number the controller is connected to.
lBAudRate: The baud rate of the serial port. By default, serial controllers are setto communicate at 9600 baud, but this can be changed using theMINT BAUD keyword on the ServoNode.
bOpenPort: Whether to open the port immediately. To open the port later, passFALSE to this parameter and call openDevice later.
Function Reference
MINT Interface Library: Issue 4.3 Page 83
Description:createServoNodeHandle is used to create a handle to a ServoNode connected to the host viaa serial cable. See Section 2 Communication Basics: Using Handles for more informationand an example. To create a handle to a ServoNode on a CAN network, see Section 2.1:CAN and RS485 Networks.
See also:
createNextMovePCHandle, createEuroSystemHandle, createNextMoveBXHandle,createRemoteServoNodeHandle, createRemoteNextMoveBXHandle,createRemoteEuroSystemhandle, freeHandle.
downloadFileRenamed to downloadMINTFile
downloadHPGL
Prototype:‘C’ - __int16 downloadHPGL ( OCHANDLE hController,
const __int8 FAR *szFilename );VB - downloadHPGL% Lib "host32" (ByVal hController&,
ByVal szFilename$)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes No No No
Parameters:hController: Handle to the controller
szFilename: The name of the file to download.
Description:This function downloads an HPGL file to a controller. Because HPGL files can be verylarge and slow, this function processes the Windows message queue as it runs so that theabortDownloadHPGL function can be used to terminate the download if necessary. As themessage queue is still being processed, you must be sure that the user is not allowed to closethe application while downloadHPGL is in progress.
Function Reference
MINT Interface Library: Issue 4.3 Page 84
Notes:
1. Always make sure downloadHPGL has completed before closing theapplication. Failure to do so can cause application errors. TheQueryUnload routine can be used to control this in Visual Basic.
2. Use setHandshakeMode (mdRTS_CTS) to enable RTS/CTS handshaking andprevent buffer overrun.
See also:
abortDownloadHPGL, setHandShakeMode
downloadMINTFile
Prototype:'C' - __int16 downloadMINTFile ( OCHANDLE hController, const __int8 FAR
*szFilename, __int16 nFileType );VB - downloadMINTFile% Lib "host32" (ByVal hController&, ByVal
szFilename$, ByVal nFileType%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
szFileName: File name to download.
nType: Specifies file type
filePROGRAM Program file.
fileCONFIG Configuration File.
fileARRAY Array File.
These identifiers are defined for each supported language.
Description:downloadMINTFile is used to load a MINT file from the host to the controller.
Function Reference
MINT Interface Library: Issue 4.3 Page 85
Example (‘C’):if (downloadMINTFile (hController, “c:\\MINT\\myprog.mnt”, filePROGRAM”)) printf (“File load error”);
See also:
downloadMINTFileEx, uploadMINTFile
Function Reference
MINT Interface Library: Issue 4.3 Page 86
downloadMINTFileEx
Note that under C++, this function is called downloadMINTFile.
Prototype:'C' - __int16 downloadMINTFileEx (
OCHANDLE hController,const __int8 FAR *szFilename,__int16 nFileType,
void (CALLBACK *lpfnProgress)(__int16 NumLines), __int8 (CALLBACK *lpfnCancel) ( void ));C++ - __int16 downloadMINTFile( const str_cls FAR &sFilename, __int16 nFileType, void (CALLBACK *lpfnProgress)(__int16 nNumLines)=NULL, __int8 (CALLBACK *lpfnCancel) ( void )=NULL);VB - Not supported under Visual Basic.Delphi - Not supported under Delphi.
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hNextMove: Handle to the controller.
szFileName: File name to download.
nType: Specifies file type
filePROGRAM Program file.
fileCONFIG Configuration File.
fileARRAY Array File.
These identifiers are defined for each supported language.
Description:
Note that using NextMove PC under Windows NT the progress and cancel functionswill not be called.
Function Reference
MINT Interface Library: Issue 4.3 Page 87
downloadMINTFileEx provides the same functionality as downloadMINTFile, but callsoptional cancel and progress functions. The cancel function must have the prototype as inthe example below(__int8 CALLBACK myFunction(void)). If you want to stop thedownload return TRUE from the function, otherwise return FALSE. The progress functionmust also have the same prototype as the function lpfnProgress in the example (voidCALLBACK myFunction(__int16 nLines)). This function is called after each line isdownloaded, to provide user feedback. If one of the functions is not required, pass NULL asthe parameter.
Example (C++) : taken from \examples\cpp1/*-----------------------------------------------------------------------*//* macro definitions *//*-----------------------------------------------------------------------*/#define NODE0 0#define COM1 1
/*-----------------------------------------------------------------------*//* lpfnCancel *//* *//* Argument list: *//* *//* Return value: *//* TRUE: user pressed <Ctrl-Z>. Cancel the download *//* *//* Description: *//* This function will be called by the MINT Interface Library to *//* check whether the download should be cancelled. *//* *//*-----------------------------------------------------------------------*/__int8 CALLBACK lpfnCancel ( void ){ __int8 c; if ( kbhit()){ c = getch(); /*-------------------------------------------------------------------*/ /* If the user has pressed <Ctrl-E>, cancel the download */ /*-------------------------------------------------------------------*/ return ( 0x1a == c ); } return FALSE;}
/*-----------------------------------------------------------------------*//* lpfnProgress *//* *//* Argument list: *//* __int16 nLines: the number of lines downloaded so far. *//* *//* Return value: *//* void *//* *//* Description: *//* Each time downloadFileEx downloads a line, it will call this *//* function to allow progress to be displayed. */
Function Reference
MINT Interface Library: Issue 4.3 Page 88
/* *//*-----------------------------------------------------------------------*/void CALLBACK lpfnProgress ( __int16 nLines ){ printf ( "Lines downloaded: %d \r", nLines );}
/*-----------------------------------------------------------------------*//* main *//* *//* Argument list: *//* void *//* *//* Return value: *//* void *//* *//* Description: *//* This routine downloads a MINT file to either a NextMove PC or a *//* EuroSystem ( or EuroSystem family ) *//* *//*-----------------------------------------------------------------------*/void main ( void ){
/*---------------------------------------------------------------------*/ /* We don't know at this point whether we are creating a CNextMovePC */ /* or a CEuroSystem object, so use the CController base class. */ /*---------------------------------------------------------------------*/ CController *pMyController;
/*---------------------------------------------------------------------*/ /* Use a keypress to select which type of controller we will be */ /* using: 'N': NextMove PC, 'E': EuroSystem */ /*---------------------------------------------------------------------*/ printf ("Press 'N' for NextMove or 'E' for EuroSystem\n"); int nCh; while ( nCh = toupper ( getch())){ if (( 'N' == nCh ) || ( 'E' == nCh )) break; }
/*---------------------------------------------------------------------*/ /* Create an object of the correct class */ /*---------------------------------------------------------------------*/ if ( 'N' == nCh ) pMyController = new CNextMovePC ( NODE0, 0x33C ); else pMyController = new CEuroSystem ( NODE0, COM1, 9600, TRUE );
/*---------------------------------------------------------------------*/ /* Download the file */ /* Note that under 'C' as opposed to C++, the function downloadFileEx */ /* would be used instead. */ /* e.g. */ /* hController = createNextMovePCHandle ( NODE0, 0x33C ); */ /* downloadMINTFileEx ( hController, "test.mnt", filePROGRAM, */ /* lpfnCancel, lpfnProgress ); */ /*---------------------------------------------------------------------*/
Function Reference
MINT Interface Library: Issue 4.3 Page 89
__int16 nError; __int8 szError[szMAX_ERROR]; printf ("Downloading file: press Ctrl-Z to quit\n"); nError = pMyController->downloadMINTFile ( "test.mnt", filePROGRAM, lpfnProgress, lpfnCancel );
/*---------------------------------------------------------------------*/ /* Display the result */ /*---------------------------------------------------------------------*/ getErrorString ( szError, nError ); printf ( "\nError %d: %s\n", nError, szError );
/*---------------------------------------------------------------------*/ /* Delete the object. Remember to dereference to the correct class. */ /*---------------------------------------------------------------------*/ if ( 'N' == nCh ) delete ( CNextMovePC * ) pMyController; else delete ( CEuroSystem * ) pMyController;
/*---------------------------------------------------------------------*/ /* Give the user a chance to read the message. */ /*---------------------------------------------------------------------*/ printf ("Press any key to exit\n"); while (!kbhit());}
See also:
downloadMINTFile, uploadMINTFile, uploadMINTFileEx.
Function Reference
MINT Interface Library: Issue 4.3 Page 90
freeHandle
Prototype:‘C’ - void freeHandle ( OCHANDLE pController );VB - freeHandle Lib "host32" (ByVal pController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Description:Free any resources allocated by createXXXHandle. It should be called for each handlecreated.
Parameters:hController: Handle to the controller,
Returns:No return code
See also:
createEuroSystemHandle, createServoNodeHandle, createNextMovePCHandle
Function Reference
MINT Interface Library: Issue 4.3 Page 91
getAAABuild
Prototype: ‘C’ - __int16 getAAABuild (OCHANDLE hController,
unsigned __int32 FAR *lpulBuild);
VB - getAAABuild% Lib "host32" (ByVal hController&,ByRef buildVersion&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller.
lpulBuild: The build number will be returned in this.
Description:Each version of the MINT Interface Library can only communicate with one version ofMINT. To make sure the versions match, each version of MINT has a build numberembedded in it. To return the build number call getAAABuild. The build number returnedby MINT should then be compared with
ä the value returned by getDLLBuild if calling Immediate Command Mode functionsfrom a DLL.
ä the value mgBUILD contained in mg.h if compiling the ‘C++’ source, and not using aDLL.
Notes:
1. initialiseNextMove calls this function after downloading the application, soas long as the return code from initialiseNextMove is checked, there is noneed to call getAAABuild after initialiseNextMove.
2. getAAABuild is only required if Immediate Command Mode functions are tobe used. All other MINT Interface Library versions should work with allMINT versions.
Function Reference
MINT Interface Library: Issue 4.3 Page 92
Example (‘C’): if ( erSUCCESS == getAAABuild (hController, &ulBuild)){ error (“getAAABuild failed”); } else if (ulBuild != mgBUILD) error ("Build check failed");
getAnalogueInput This function has been removed. Instead use getWord (roANALOG_X)
getAutoNodeSelect
Prototype: 'C' - __int16 getAutoNodeSelect ( OCHANDLE hController, __int8 FAR
*bEnabled ); VB - getAutoNodeSelect% Lib "host32" (ByVal hController&, ByRef bEnabled)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
bEnabled:: To return whether auto node select is enabled
Description: On controllers acting as busmaster on a CAN network or a member of a RS485network, sending $X(X) directs serial traffic to a specific controller. When auto nodeselection is enabled, the MINT Interface Library will automatically send the dollarsyntax. Calling getAutoNodeSelect will return whether automatic node selection isenabled.
See setAutoNodeSelect for an example on the use of automatic node selection.
See also:
setAutoNodeSelect
Function Reference
MINT Interface Library: Issue 4.3 Page 93
getBoardId This function has been removed. The Id can be read using getControllerIdAndMemory
getBoardVersion This function has been replaced by getControllerVersion
getCOMMSRetries
Prototype: 'C' - __int16 getCOMMSRetries ( OCHANDLE hController, __int16 FAR
*nRetries ); VB - getCOMMSRetries% Lib "host32" (ByVal hController&, ByRef nRetries%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No Yes No Yes No
Parameters:hController: Handle to the controller
lpnRetries: To return the number of retries on failure of a protected modecomms. communication.
Description: The function setCOMMSRetries can be used to automatically retransmit a failedprotected mode communication a number of times (default = 0). getCOMMSRetriesreturns this value.
See also:
MINT328Command, MINT328Read, MINT328Write
Function Reference
MINT Interface Library: Issue 4.3 Page 94
getControllerAddress
Prototype: 'C' - __int16 getControllerAddress ( OCHANDLE hController, __int16 FAR *lpnAddress ); VB - getControllerAddress% Lib "host32" (ByVal hController&, ByRef lpnAddress&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
lpAddress: The address.
Description: getControllerAddress returns the address which was passed tocreateNextMovePCHandle.
See also:
createNextMovePCHandle
getControllerIdAndMemory
Prototype: ‘C’ - __int16 getControllerIdAndMemory (OCHANDLE hNextMove, __int16 *id, TMemMapArray *map, unsigned __int32 * userStart)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Function Reference
MINT Interface Library: Issue 4.3 Page 95
Description: Returns the type, start and end addresses of each block of memory, the first free RAMlocation that may be used by user programs and the loader product code (0 & 1) in*map, *userStart and *id.
This function is primarily used to assist the user when writing applications using thefull suite of ‘C’ functions for NextMove.
Note that the board must be in reset before getControllerIdAndMemory can be called.
Example (‘C’): __int16 id; unsigned __int32 userStart; TMemMapArray map; if(getIdAndMemory(hNextMove, &id, &map, &userStart) == erSUCCESS) { printf(“\tBlock\tStart\tFinish\n”); for(x = 0; x < cnMAX_MEM_BLOCKS; x++) { switch(map[x].type) { case 0: printf(“\tNONE\n”); break; case 1: printf(“\tRAM\t%06lX\t%06lX\n”, map[i].start, map[i].end); break; case 2: printf(“\tFLASH\t%06lX\t%06lX\n”, map[i].start, map[i].end); break; } } }
Example output: Block Start Finish FLASH 400000 41FFFF NONE NONE RAM 460000 47FFFF
See also:
getControllerVersion, getSoftwareVersion
Function Reference
MINT Interface Library: Issue 4.3 Page 96
getControllerVersion
Prototype: ‘C’ - __int16 getControllerVersion ( OCHANDLE hController, __int8 FAR *szVersion ); VB - getControllerVersion% Lib "host32" (ByVal hController&, ByVal szVersion$)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hNextMove: Handle to the controller
szVersion: Return string
Description: Returns a string from the boot loader indicating the hardware version. The controllermust be in software reset (i.e. call resetController) before this function can be called.
Example (‘C’): getControllerVersion(hNextMove, version); printf(“Hardware: %s\n”, version);
See also:
resetController, getIdandMemory
getDLLBuild
Prototype: ‘C’ - __int32 getDLLBuild ( void ); VB - getDLLBuild& Lib "host32" ()
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo Yes No No No No No
Function Reference
MINT Interface Library: Issue 4.3 Page 97
Parameters:none
Returns:The build number embedded in the Immediate Command Mode DLL.
Description: Each version of the MINT Interface Library can only communicate with the ImmediateCommand Mode functions of one version of MINT. To make sure the versions match,each version of MINT has a build number embedded in it. To return the build numbercall getAAABuild. The build number returned by MINT should then be compared withthe value returned by getDLLBuild if calling Immediate Command Mode functionsfrom a DLL.
See also:
getAAABuild
getEcho
Prototype: ‘C’ - __int16 getEcho ( OCHANDLE hController, __int16 FAR *nEcho ); VB - getEcho% Lib "host32" (ByVal hController&, ByRef nEcho%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
nEcho: Variable to return the value of ECHO in.
Description: Reads the value of the MINT ECHO keyword from Dual Port RAM. See Section 3.5:MINT Pseudo-Serial Buffer.
See also:
setEcho
Function Reference
MINT Interface Library: Issue 4.3 Page 98
getErrorString
Prototype: ‘C’ - __int16 getErrorString (__int8 FAR *szError, __int16 nErrorCode); VB - getErrorString% Lib "host16" (ByVal szError$, ByVal nError%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:szError: The error string.
nError: The error code to return a string for.
Description: All functions return an error code from the list in host_def.h / host.bas. Instead oflooking the meaning of the error code up in the manual (see section 9: Appendix 2:Symbolic Constants) the function getErrorString can be called. This will return a stringrelating to the code.
Note for ‘C’ / C++ users. getErrorString is prototyped in host_def.h
For Example: to download MINT.out to a NextMove PC. Dim hController& Dim nError% Dim szError As String * 255 '------------------------------------------------------------ ' Create a handle to the controller '------------------------------------------------------------ hController = createNextMovePCHandle(0, &H33C) '------------------------------------------------------------ ' Download MINT '------------------------------------------------------------ nError = updateFirmware(hController, "mint.out", bdEPROM, tmRAM, True) '------------------------------------------------------------ ' Display success / failure message '------------------------------------------------------------ getErrorString szError$, nError% MsgBox szError$ '------------------------------------------------------------
Function Reference
MINT Interface Library: Issue 4.3 Page 99
' Free resources '------------------------------------------------------------ freeHandle hController
getFloat
Prototype: ‘C’ - __int16 getFloat ( OCHANDLE hController, __int16 nAddress, float FAR *fValue ); VB - getFloat% Lib "host32" (ByVal hController&, ByVal nAddress%, ByRef fValue!)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hNextMove: Handle to the controller
nDPROffset: DPR Address to read from
Description: Returns a floating point number from the location specified by nAddress. See 3.6:Auto-Update Area for details on how to read motion variables directly from DPR.
Example (‘C’): getFloat ( hController, roAXIS1 + roMEASURED_SPEED, &fValue ); printf (“Speed of axis 1: %f “, fValue );
See also:
putFloat, getWord, getLong
getHandshakeMode
Prototype: ‘C’ - __int16 getHandshakeMode ( OCHANDLE hController, __int16 FAR *lpnHandshakeMode ); VB - getHandshakeMode% Lib "host32" (ByVal hController&, ByRef lpnHandshakeMode%)
Function Reference
MINT Interface Library: Issue 4.3 Page 100
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No Yes No Yes No
Parameters:hController: Handle to the controller
lpnHandshakeMode: The handshake mode in use. Currently this will be either 0(no handshaking) or mdRTS_CTS. More codes may beadded in future.
Description: By default, no hardware handshaking is enabled on any serial controller. CallingsetHandshakeMode (mdRTS_CTS) will use RTS/CTS handshaking. This is ofparticular use when downloading HPGL files to a EuroSystem, but can also be enabledfor NextMove BX if buffer overrun is suspected. getHandshakeMode returns thecurrent handshaking scheme.
See also:
setHandshakeMode, downloadHPGLFile
getIdAndMemory This function has been replaced by getControllerIdAndMemory
getIdleMessageProcessingEnabled
Prototype: 'C' - __int16 getIdleMessageProcessingEnabled ( OCHANDLE hController, __int8 FAR *bEnabled ); VB - getIdleMessageProcessingEnabled% Lib "host32" (ByVal hController&, ByRef bEnabled As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Function Reference
MINT Interface Library: Issue 4.3 Page 101
Parameters:hController: Handle to the controller
bEnabled:: To return whether idle message processing is enabled
Description: Use this function to find whether idle message processing is enabled (default isdisabled.) See setIdleMessageProcessingEnabled for more details.
See also:
setIdleMessageProcessingEnabled
getLong
Prototype: ‘C’ - __int16 getLong ( OCHANDLE hController, __int16 nAddress, __int32 FAR *lValue ); VB - getLong% Lib "host32" (ByVal hController&, ByVal nAddress%, ByRef lValue&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hNextMove: Handle to the controller
nAddress: DPR Address to read from
lValue: The value read from DPR.
Returns: Returns the value found at nAddress as a 32 bit signed long. This will be used mostoften for reading auto-update variables from DPR (See 3.6: Auto-Update Area fordetails)
Example (VB): Private Sub Command1_Click() Dim hNextMove&, lInputs& '---------------------------------------------------------------------- ' Create a handle to the NextMove PC
Function Reference
MINT Interface Library: Issue 4.3 Page 102
'---------------------------------------------------------------------- hNextMove = createNextMovePCHandle(0, &H33C) '---------------------------------------------------------------------- ' Read the inputs '---------------------------------------------------------------------- getLong hNextMove, roINPUTS, lInputs& '---------------------------------------------------------------------- ' Mask off input 0 '---------------------------------------------------------------------- If (lInputs And 1) = 1 Then MsgBox "Input 0: On" Else MsgBox "Input 0: Off" End If '---------------------------------------------------------------------- ' Release the resources '---------------------------------------------------------------------- freeHandle hNextMove End Sub
See also:
putLong, getFloat, getWord
getMINT328Retries
Prototype: 'C' - __int16 getMINT328Retries ( OCHANDLE hController, __int16 FAR *nRetries ); VB - getMINT328Retries% Lib "host32" (ByVal hController&, ByRef nRetries%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No Yes No No No
Parameters:hController: Handle to the controller
lpnRetries: To return the number of retries on failure of a MINT328communication.
Function Reference
MINT Interface Library: Issue 4.3 Page 103
Description: The function setMINT328Retries can be used to automatically retransmit a failedMINT328 communication a number of times (default = 0). getMINT328Retries returnsthis value.
See also:
MINT328Command, MINT328Read, MINT328Write
getMMLEnabled
Prototype: ‘C’ - __int16 getMMLEnabled ( OCHANDLE hController, __int8 FAR *bEnabled ); VB - getMMLEnabled% Lib "host32" (ByVal hController&, ByRef bEnabled As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the NextMove.
bEnabled: Will be set by the function to TRUE (enabled) / FALSE (disabled)
Description: Calling setMMLEnabled (FALSE) will cause all Immediate Command Mode functionsto return immediately with a code of erFRONT_DISABLED. Use getMMLEnabled tofind the current state of this flag.
This function is not available in a ‘C31 emulation’ build.
See also:
abortMMLCommand, setMMLEnabled
getNumAnalogueInputs This function has been removed. Instead use getWord (…., roNUM_AIO)
Function Reference
MINT Interface Library: Issue 4.3 Page 104
getNumDigitalInputs This function has been removed. Instead use getWord (…., roNUM_DIO)
e.g, getWord ( hController, roNUM_DIO, &nVar ); nNumberOfInputs = HIBYTE ( nVar );
getNumServoAxes This axis has been removed. Instead use getWord (…, roAXIS_MIX.). This will returnthe number of stepper axes in the low byte and the number of servo axes in the highbyte.
getNumStepperAxes This axis has been removed. Instead use getWord (…, roAXIS_MIX.). This will returnthe number of stepper axes in the low byte and the number of servo axes in the highbyte.
getPCFrontEnabled This function has been renamed to getMMLEnabled.
getPortNumber
Prototype: ‘C’ - __int16 getPortNumber ( OCHANDLE hController, __int16 FAR *nPortNumber ); VB - getPortNumber% Lib "host32" (ByVal hController&, ByRef nPortNumber%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes No Yes Yes Yes Yes
Function Reference
MINT Interface Library: Issue 4.3 Page 105
Parameters:hController: Handle to the controller
nPortNumnber: The COM port number
Description: Returns the COM port the controller is using. Note that this will return the COM portnumber even if the port is not available. Use isOpen to find out if the port can be used.
See also:
isOpen, getPortSpeed
getPortSpeed
Prototype: ‘C’ - __int16 getPortSpeed ( OCHANDLE hController, __int32 FAR *lPortSpeed ); VB - getPortSpeed% Lib "host32" (ByVal hController&, ByRef lPortSpeed&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes No Yes Yes Yes Yes
Parameters:hController: Handle to the controller
lPortSpeed: The baud rate specified for the port.
Description: Returns the baud rate specified for the serial port. port the controller is using. Note thatthis will return the speed even if the port is not available. Use isOpen to find out if theport can be used.
See also:
isOpen, getPortNumber
Function Reference
MINT Interface Library: Issue 4.3 Page 106
getUintToLong
Prototype: VB - getUintToLong% Lib "host32" (ByVal hController&, ByVal nAddress%, ByRef lplValue&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hNextMove: Handle to the controller
nDPROffset: DPR Address to read from
lplValue: The value read from DPR.
Description: Visual Basic cannot handle unsigned data types. getUintToLong allows a 16 bit word tobe read from DPR and help in a long: otherwise very large positive numbers would beused as negative numbers by VB.
See also:
getWord, putWord, getLong, getFloat
getUpDownloadRetries
Prototype: 'C' - __int16 getUpDownLoadRetries ( OCHANDLE hController, __int16 FAR *lpnRetries ); VB - getUpDownLoadRetries% Lib "host32" (ByVal hController&, ByRef lpnRetries%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Function Reference
MINT Interface Library: Issue 4.3 Page 107
Parameters:hController: Handle to the controller
lpnRetries: To return the number of retries on upload or download failure.
Description: When a MINT file is uploaded or downloaded using uploadMINTFile ordownloadMINTFile a CRC check is performed to detect corruption. The default actionin this case is for the function to return with a failure code, but callingsetUpDownloadRetries will cause the function to retry a number of times.getUpDownloadRetries is used to determine what this retry number is (default = 0).
See also:
setUpDownloadRetries, downloadMINTFile, uploadMINTFile
getVBFloat This function has been removed. Use getFloat instead.
getWord
Prototype: ‘C’ - __int16 getWord ( OCHANDLE lpController, __int16 nAddress, __int16 FAR *lpnValue ) VB - getWord% Lib "host32" (ByVal hController&, ByVal nAddress%, ByRef nValue!)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller.
nDPROffset: DPR Address to read from
lpnValue: The data read from DPR.
Function Reference
MINT Interface Library: Issue 4.3 Page 108
Returns: Reads a 16 bit signed integer from DPR. In Visual Basic, use getUintToLong to readunsigned 16 bit integers.
See also:
getWord, putWord, getLong, getUintToLong
Function Reference
MINT Interface Library: Issue 4.3 Page 109
isControllerInReset
Prototype: 'C' - __int16 isControllerInReset( OCHANDLE hController, __int8 FAR
*lpbInReset ); VB - isControllerInReset% Lib "host32" (ByVal hController&, ByRef
lpbInReset As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
lpbInReset: Whether the controller is in reset.
Description: This function attempts to detect whether a NextMove PC is held in software reset.Note that this functions cannot be entirely relied upon: if lpbInReset is set to FALSE,the controller is definitely NOT in reset, but if it is set to TRUE, the controller may alsonot be in reset.
See also:
getControllerId, getControllerIdAbdMemory, getControllerVersion
isControllerPresent
Prototype: 'C' - __int16 isControllerPresent ( OCHANDLE hController ); VB - isControllerPresent% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
Function Reference
MINT Interface Library: Issue 4.3 Page 110
lpbInReset: Whether the controller is present..
Description: createNextMovePCHandle doesn’t check whether there is a NextMove PC presentwhen it creates the handle. Calling isControllerPresent will perform somecommunications with NextMove, to determine whether it is present.
See also:
createNextMovePCHandle
installDPRHandler
Prototype: ‘C’ - int installDPRHandler (int intNo, TIntHandler* handler) VB - NOT AVAILABLE UNDER WINDOWS
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hNextMove: Interrupt number
handler: Handler to install
Description: This function installs a handler which will be called each time the interrupt numberinterruptNo occurs. See 3.8.2 Writing and Installing an Interrupt Handler
Note that this function is not available under Windows.
Notes Ensure the correct jumper is in place for the interrupt.
Returns:0 interrupt number out of range.
1 the function completed successfully
Function Reference
MINT Interface Library: Issue 4.3 Page 111
See also:
removeDPRHandler
interruptCommand This function has been renamed to interruptMMLCommand.
interruptMMLCommand
Prototype: ‘C’ - __int8 interruptMMLCommand ( OCHANDLE hController ); VB - interruptMMLCommand Lib "host32" (ByVal hController&) As Byte
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes Yes Yes No No
Parameters:hController: Handle to the NextMove.
Description: This function interrupts the currently executing Immediate Command Mode command,allowing a new command to be called. This function will leave the function itinterrupts in an undefined state, so only use this function for emergency stops etc.
This function is not available in a ‘C31 emulation’ build.
Returns:0 no Immediate Command Mode function was taking place
1 an Immediate Command Mode function was interrupted. The function it interruptedmay or may not have completed.
See also:
abortMMLCommand, setPCFrontEnabled
Function Reference
MINT Interface Library: Issue 4.3 Page 112
invertOutput This function has been removed. Use getWord (… , roINPUTS). Invert the required bitand call putWord (roINPUTS, xx) followed by setAutoUpdateVariableModified(roINPUTS).
See also:
getFloat
isOpen
Prototype: ‘C’ - __int16 isOpen ( OCHANDLE hController, __int8 FAR *lpbOpen ); VB - isOpen% Lib "host32" (ByVal hController&, ByRef lpbOpen As Byte)
Parameters:hController: Handle to the controller
lpbOpen: Set to TRUE if the device is open.
Description: To find out whether it was possible to access the hardware required to communicatewith the controller, call isOpen. IsOpen will set lpbOpen to
TRUE: the host hardware is available. FALSE: the hardware required is not available. This can mean
NextMove PC on an NT host: the device driver has not been installed, or theconfiguration utility has not been used to install a NextMove PC at this address.
Any serial controller: another program is using the serial port, or the serial port doesnot exist.
Any serial controller: closeDevice has been called to free serial port, orcreateXXXHandle was called with the bOpenPort parameter set to FALSE. In both ofthese cases, calling openDevice will attempt to take control of the serial port.
See also:
openDevice, closeDevice
Function Reference
MINT Interface Library: Issue 4.3 Page 113
loadApplication This function has been removed. On NextMove PC the function updateFirmware hasthe same functionality as the combined old NextMove functions.
resetNextMove loadApplication runApplication setEcho
lineExecutingThis function has been removed. Use getWord (…, adMINT_LINE_NUMBER).
Function Reference
MINT Interface Library: Issue 4.3 Page 114
markAsInterruptedThis function has been removed
MINT328Command
Prototype:‘C’ - __int16 MINT328Command ( OCHANDLE hController,
__int16 axes, const __int8 FAR *keyword );
VB - MINT328Command% Lib "host32" (ByVal hController&,ByVal nAxes%,ByVal szKeyword$)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes Yes No No
Parameters:hController: Handle to the controller.
nAxes: The axis number to act on. See include files for predefinedconstants.
szKeyword: The MINT™ keyword. The MINT328 version of all MINTkeywords can be found in the MINT manual.
Description:Constructs and sends a MINT328 command to a serial controller with a MINT328 EPROM.
See also:
MINT328Read, MINT328Write, getMINT328Retries, setMINT328Retries
Function Reference
MINT Interface Library: Issue 4.3 Page 115
MINT328Read
Prototype:‘C’ - __int16 MINT328Read ( OCHANDLE hController,
__int16 axes,const __int8 FAR *keyword,__int8 FAR *szData );
VB - MINT328Read% Lib "host32" (ByVal hController&,ByVal nAxes%,ByVal szKeyword$,ByVal szData$)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes Yes No No
Parameters:hController: Handle to the controller.
nAxes: The axis number to act on. See include files for predefinedconstants.
szKeyword : The MINT™ keyword. The MINT328 version of all MINTkeywords can be found in the MINT manual.
szData: The value read from the MINT™ keyword.
Description:Uses MINT328 to read from a MINT keyword.
Example (‘C’ ): examples\mint328#include "host_cif.h"
void main ( void ){ __int8 bOpen; __int8 szValue[5]; __int8 szData[255]; __int16 nError; __int16 nFailures; __int16 nOutputValue; OCHANDLE hController;
/*---------------------------------------------------------------------*/ /* Create a handle to a EuroSystem: Node 0, COM1. 9600 baud */ /*---------------------------------------------------------------------*/ hController = createEuroSystemHandle ( 0, 1, 9600, TRUE );
Function Reference
MINT Interface Library: Issue 4.3 Page 116
if ( NULL == hController ){ printf ( "Could not create handle to controller"); return; }
/*---------------------------------------------------------------------*/ /* Check if we have taken control of the serial port. */ /*---------------------------------------------------------------------*/ isOpen ( hController, &bOpen ); if ( FALSE == bOpen ){ printf ("Could not access serial port: port may already be in use"); /*-------------------------------------------------------------------*/ /* Remember to release the resources. */ /*-------------------------------------------------------------------*/ freeHandle ( hController ); }
/*---------------------------------------------------------------------*/ /* Find version number */ /*---------------------------------------------------------------------*/ nError = MINT328Read ( hController, 0, "VN", szData ); if ( erSUCCESS == nError ){ printf ( "Version: %s\n", szData ); } else { printf ( "Failed to read the version string" ); freeHandle( hController ); return; }
/*---------------------------------------------------------------------*/ /* Toggle the outputs until a key is pressed. */ /*---------------------------------------------------------------------*/ nFailures = 0; nOutputValue = 0; printf ("Press any key to exit\n"); while ( !kbhit()){ /*-------------------------------------------------------------------*/ /* Construct the string */ /*-------------------------------------------------------------------*/ sprintf ( szValue, "%d", nOutputValue ++ ); if ( 255 == nOutputValue ) nOutputValue = 0; /*-------------------------------------------------------------------*/ /* Send the command */ /*-------------------------------------------------------------------*/ if ( erSUCCESS != MINT328Write ( hController, 0, "OT", szValue )) printf ( "\rFailures: %d\r", ++nFailures ); }
/*---------------------------------------------------------------------*/ /* Free any resources. */ /*---------------------------------------------------------------------*/ freeHandle ( hController ); return;
}
Function Reference
MINT Interface Library: Issue 4.3 Page 117
See also:
MINT328Command, MINT328Write, getMINT328Retries, setMINT328Retries
See example:MINT328
MINT328Write
Prototype:‘C’ - __int16 MINT328Write ( OCHANDLE hController,
__int16 nAxes,const __int8 FAR *keyword,const __int8 FAR *data );
VB - MINT328Write% Lib "host32" (ByVal hController&,ByVal nAxes%,ByVal szKeyword$,ByVal szData$)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes Yes No No
Parameters:hController: Handle to the controller.
nAxes: The axis number to act on. See include files for predefined constants.
szKeyword: The MINT328 keyword
szData: The data to be written.
Description:Constructs and sends a MINT328 write packet to a controller with a MINT328 EPROM.
See also:
MINT328Command, MINT328Read, getMINT328Retries, setMINT328Retries
See example:MINT328.
Function Reference
MINT Interface Library: Issue 4.3 Page 118
MINTBreak
Prototype: ‘C’ - __int16 MINTBreak ( OCHANDLE hController );VB - MINTBreak% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller.
Description:Send 'Ctr'l-E' to break a MINT program. On NextMove PC MINTBreak is processedimmediately as opposed to going through the pseudo-serial buffer, so will act faster thanserialPutChar (hController, 5)
MINTErrorThis function has been removed. Instead, use getWord (….., roMINT_ERR , …..).
MINTExecuting
Prototype: ‘C’ - __int16 MINTExecuting ( OCHANDLE hController,
__int8 FAR *lpbExecuting);VB - MINTExecuting% Lib "host32" (ByVal hController&,
ByRef lpbExecuting As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes Yes No No No
Function Reference
MINT Interface Library: Issue 4.3 Page 119
Parameters:hNextMove: Handle to the controller
lpbExecuting: Set to TRUE if MINT is executing: either at the command line or in aprogram.
Function Reference
MINT Interface Library: Issue 4.3 Page 120
MINTRun
Prototype: ‘C’ - __int16 MINTRun ( OCHANDLE hController, __int32 lTimeout );VB - MINTRun% Lib "host32" (ByVal hController&, ByVal lTimeout&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
lTimeout: Time to wait for space in the transmit buffer if necessary.
Description:Writes “RUN<ENTER> to the MINT pseudo-serial buffer.
See also:
serialPutStringTimeout
Function Reference
MINT Interface Library: Issue 4.3 Page 121
nmGetCharThis function has been removed. serialGetChar can be used instead, but note thatserialGetChar will return immediately is the buffer is empty as opposed to nmGetCharwhich would wait for a buffer.
nmGetCharFromBufferThis function has been renamed to serialGetChar.
nmGetCharTimeoutThis function has been renamed to serialGetCharTimeout.
nmGetStringFromBufferThis function has been renamed to serialGetStringTimeout.
nmPutCharThis function has been renamed to serialPutChar.
nmPutRunThis function has been renamed to MINTRun.
nmRXDBufferEmptyThis function has been removed. Use serialGetChar which will report if the serial receivebuffer is empty.
Function Reference
MINT Interface Library: Issue 4.3 Page 122
nmTXDBufferFullThis function has been removed. Use serialPutChar which will report if the serial transmitbuffer is full.
Function Reference
MINT Interface Library: Issue 4.3 Page 123
openDevice
Prototype: ‘C’ - __int16 openDevice ( OCHANDLE lpController );VB - openDevice% Lib "host32" (ByVal hController&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
Description:openDevice attempts to establish a link with the hardware specified in createXXXDevice.By using closeDevice and openDevice, serial ports can be shared with other applicationswithout the need to call createXXXXHandle / freeHandle repeatedly.
See also:
closeDevice
Function Reference
MINT Interface Library: Issue 4.3 Page 124
programBufferThis function has been removed. On NextMove use getWord (…., roMINT_STATUS). ANDthe value with mkPROGRAM. If the result is 0 MINT is in the configuration buffer,otherwise it is in the program buffer.
putFloat
Prototype: ‘C’ - __int16 putFloat ( OCHANDLE hController, __int16 nAddress,
float fValue );VB - putFloat% Lib "host32" (ByVal hController&, ByVal nAddress%,
ByVal fValue!)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
nAddress: DPR Address to write to
fValue: Floating point value to write
Description:Writes fVal to the address specified by nAddress. This will be used most often for writingto auto-update variables (See 3.6: Auto-Update Area for details)
Example (VB):Private Sub Command1_Click()Dim hNextMove&, lInputs&
'---------------------------------------------------------------------- ' Create a file handle '---------------------------------------------------------------------- hNextMove = createNextMovePCHandle(0, &H33C)
'---------------------------------------------------------------------- ' Write to the proportional gain auto-update variable '---------------------------------------------------------------------- putFloat hNextMove, roAXIS_0 + roP_GAIN, 0.5 setAutoUpdateModified hNextMove, roAXIS_0 + roP_GAIN
Function Reference
MINT Interface Library: Issue 4.3 Page 125
'---------------------------------------------------------------------- ' Release the resources '---------------------------------------------------------------------- freeHandle hNextMove
End Sub
See also:
getFloat, putWord, putLong,
putLong
Prototype: ‘C’ - __int16 putLong ( OCHANDLE hController, __int16 nAddress,
__int32 lLong );VB - Declare Function putLong% Lib "host32" (ByVal hController&,
ByVal nAddress%, ByVal lLong&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
nAddress: DPR Address to write to.
lLong: 32 bit integer value to write.
Description:Writes lLong to the address specified by nAddress. There are no auto-update locations thattake a 32 bit integer, so this function is really only of use to people wishing to pass data to aC31 application they have written.
See also:
getLong, putWord, putFloat,
putVBFloatThis function is not required under VB 4 or greater, and has been removed.
Function Reference
MINT Interface Library: Issue 4.3 Page 126
putWord
Prototype: ‘C’ - __int16 putWord ( OCHANDLE hController, __int16 nAddress,
__int16 nWord );VB - putWord% Lib "host32" (ByVal hController&, ByVal nAddress%,
ByVal nWord%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
nAddress: DPR Address to write to
nWord: 16 bit integer value to write.
Description:Writes the 16 bit integer to the DPR address specified by nAddress. This will be used mostoften for writing to auto-update variables (See 3.6: Auto-Update Area for details)
Example (‘C’):#define NODE0 0#define nmADDRESS 0x33C/*-----------------------------------------------------------------------*//* Routine to toggle the relay on NextMove PC using the auto-update area.*//* In this example, the number of digital outputs is read from DPR. *//* This is not usually necessary as the number of digital outputs is *//* currently fixed at 12 on NextMove PC. *//*-----------------------------------------------------------------------*/void CTemp2Dlg::OnButton2(){ /*---------------------------------------------------------------------*/ /* Create a handle to the NextMove PC */ /*---------------------------------------------------------------------*/ OCHANDLE hNextMove = createNextMovePCHandle ( NODE0, nmADDRESS );
/*---------------------------------------------------------------------*/ /* Find out how many outputs there are. This is necessary because */ /* the outputs are stored in a word as follows */ /* Bit in word Output */ /* 0 : Out0 */ /* 1 : Out1 */ /* 2 : Out2 */ /* .. : .... */ /* X : OutX */
Function Reference
MINT Interface Library: Issue 4.3 Page 127
/* numOutputs -1: OutMax */ /* numOutputs : Relay */ /* The number of digital outputs is stored in the low byte of the */ /* roNUM_DIO word in DPR. */ /*---------------------------------------------------------------------*/ __int16 nNumberOfDigitalOutputs; VERIFY ( erSUCCESS == getWord ( hNextMove, roNUM_DIO, &nNumberOfDigitalOutputs)); nNumberOfDigitalOutputs = LOBYTE ( nNumberOfDigitalOutputs );
/*---------------------------------------------------------------------*/ /* Read the current state of the outputs */ /*---------------------------------------------------------------------*/ __int16 nStateOfDigitalOutputs; VERIFY ( erSUCCESS == getWord ( hNextMove, roOUTPUTS, &nStateOfDigitalOutputs));
/*---------------------------------------------------------------------*/ /* Toggle the relay bit */ /*---------------------------------------------------------------------*/ nStateOfDigitalOutputs ^= (__int16)( 1 << nNumberOfDigitalOutputs );
/*---------------------------------------------------------------------*/ /* Write the new value to the auto-update variable. */ /* Remember to call setAutoUpdateModified */ /*---------------------------------------------------------------------*/ VERIFY ( erSUCCESS == putWord ( hNextMove, roOUTPUTS, nStateOfDigitalOutputs)); VERIFY ( erSUCCESS == setAutoUpdateModified ( hNextMove, roOUTPUTS ));
/*---------------------------------------------------------------------*/ /* Release the resources. */ /*---------------------------------------------------------------------*/ freeHandle ( hNextMove );}
See also:
getFloat, putFloat, putLong,
Function Reference
MINT Interface Library: Issue 4.3 Page 128
removeDPRHandler
Prototype: ‘C’ - int removeDPRHandler (int intNo)VB - NOT AVAILABLE UNDER WINDOWS
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:intNo: The interrupt number to remove the handler for.
Description:Removes the DPR interrupt handler installed using installDPRHandler() and restores the oldhandler.
Note this function operates under DOS only.
See also:
installDPRHandler
resetBoardThis function has been renamed to resetController Note that the new functionupdateFirmware has the same functionality as the combined old NextMove functions.
resetNextMove loadApplication runApplication setEcho
Function Reference
MINT Interface Library: Issue 4.3 Page 129
resetController
Prototype: ‘C’ - __int16 resetController ( OCHANDLE hController,
__int8 cBootDevice );VB - resetController% Lib "host32" (ByVal hController&,
ByVal cBootDevice As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller (see createNextMovePCHandle)
nBootDev: bdEPROM C31 boot loader pulls code from EPROM.
bdFLASH C31 boot loader pulls code from FLASH EPROM.
bdSERIAL C31 boot loader pulls code from the serial port.
Currently the only valid option for NextMove PC is bdEPROM.
Description:Performs a software reset on NextMove. Once NextMove is in software reset, functionssuch as getControllerIdAndMemory can be used.
See also:
getControllerIdAndMemory, getControllerVersion
resetHostDLL
Prototype: ‘C’ - n/aVB - Declare Sub resetHostDLL Lib "host32" ()
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes Yes No Yes Yes
Function Reference
MINT Interface Library: Issue 4.3 Page 130
Parameters:none
Description:In Visual Basic, it is possible to stop an application in the development environment usingthe stop button. When this happens, the DLL is kept in memory, any serial ports whichwere open stay open. The next time the application is run, the serial port is not available asit has been held open. To solve this either
close and re-open Visual Basic : this unloads the DLL, and will make the portavailable.
call resetHostDLL before createXXXHandle. This will free any resources held bythe DLL.
See example:examples\axisttest.
runApplicationThis function has been removed. On NextMove PC the function updateFirmware has thesame functionality as the combined old NextMove functions.
resetNextMove loadApplication runApplication setEcho
Function Reference
MINT Interface Library: Issue 4.3 Page 131
selectBoardHandleThis function has been renamed to selectGlobalController.
Note for upgrading users. selectGloablController acts in a different way to the replacedselectBoardHandle. selectGlobalController only acts on Immediate Command Mode
commands. If NULL is passed as the OCHANDLE parameter to any non ImmediateCommand Mode function the handle specified by selectGlobalHandle will NOT be used.
selectGlobalController
Prototype:'C' - OCHANDLE selectGlobalController ( OCHANDLE hController );VB - n/aDelphi - n/a
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No C31 emulation No No No No
Parameters:hController: The controller to use for the C31 emulation program
Description:selectGlobalController is used to select the controller to be used for a C31 emulationprogram. The handle should first be created with createNextMove PC.selectGlobalController must be used before any Immediate Command Mode functions,including getAAABuild and initialiseNextMove. See the MINT Motion Library ReferenceGuide for details on writing a C31 emulation program.
Function Reference
MINT Interface Library: Issue 4.3 Page 132
See also:
createNextMovePCHandle, freeHandle. setProgramPath
selectHostTypeThis function has been removed. The parameters passed to the createXXXXXHandle specifyall required host and controller parameters.
selectNextMoveTypeThis function has been removed. The parameters passed to the createXXXXXHandle specifyall required host and controller parameters.
serialGetChar
Prototype: ‘C’ - __int16 serialGetChar ( OCHANDLE hController,
__int16 FAR *pnChar );VB - serialGetChar% Lib "host32" (ByVal hController&, ByRef nChar%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
pnChar: The character read from the serial port / pseudo-serial buffer.
Description:serialGetChar reads a character from the serial port, or pseudo-serial buffer on NextMovePC. If no character is available the function returns immediately with an error code oferRECEIVE_BUFFER_EMPTY.
See also:
serialGetCharTimeout, serialGetStringTimeout, serialPutChar, serialPutStringTimeout
Function Reference
MINT Interface Library: Issue 4.3 Page 133
serialGetCharTimeout
Prototype: ‘C’ - __int16 serialGetCharTimeout ( OCHANDLE hController,
__int16 FAR *pnChar, __int32 lTimeout );VB - serialGetCharTimeout% Lib "host32" (ByVal hController&,
ByRef pnChar%, ByVal lTimeout&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
pnChar: The character read from the serial port / pseudo-serial buffer.
lTimeout: The period of time to wait for a character in milliseconds.Remember that this will be limited by the resolution of the clockavailable to the host (55 ms on a PC.)
Description:serialGetCharTimout waits for up to lTimeout milliseconds for a character to arrive from theserial port, or pseudo-serial buffer on NextMove PC. If no character is available after thistime the function returns with an error code of erRECEIVE_BUFFER_EMPTY.
See also:
serialGetChar, serialGetStringTimeout, serialPutChar, serialPutStringTimeout
serialGetStringTimeout
Prototype: ‘C’ - __int16 serialGetStringTimeout ( OCHANDLE hController,
__int8 FAR *szBuffer,__int16 nBufferSize,__int16 nTerminator,__int32 lTimeout,__int16 FAR *pnNumberRead );
Function Reference
MINT Interface Library: Issue 4.3 Page 134
VB - serialGetStringTimeout% Lib "host32" (ByVal hController&,ByVal szBuffer$,ByVal nBufferSize%,ByVal nTerminator%,ByVal lTimeout&,ByRef pnNumberRead%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No No Yes No No No
NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNodeRemote Remote
Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
szBuffer: The string allocated to return the characters in.
nBufferSize: The size of the buffer. The function will read at maximum one lesscharacter than nBufferSize as the final byte is used for the NULLterminator.
nTerminator: If this character is received the function will return witherSUCCESS.
lTimeout: The period of time to wait for a character in milliseconds.Remember that this will be limited by the resolution of the clockavailable to the host (55 ms on a PC.)
pnNumberRead: This parameter allows the function to return how many characterswere read.
Description:serialGetStringTimeout reads a string from the buffer. It contains several conditions whichcan cause it to exit.
nBufferSize - 1 characters read: the function will return erSUCCESS andpnNumberRead will be set to nBufferSize -1.
nTerminator received: the function will return erSUCCESS. pnNumber read willreturn the number of characters read.
lTimeout exceeded: the function will return erRECEIVE_BUFFER_EMPTY andpnNumberRead will contain the number of characters read before the timeoutoccurred. Note that the timing period starts at function entry, so the time period isto read the whole string, not between each character.
Function Reference
MINT Interface Library: Issue 4.3 Page 135
See also:
serialGetChar, serialGetCharTimeout, serialPutChar, serialPutStringTimeout
serialPutChar
Prototype: ‘C’ - __int16 serialPutChar ( OCHANDLE hController, __int16 nChar );VB - serialPutChar% Lib "host32" (ByVal hController&, ByVal nChar%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
nChar: Character to output
Description:Writes nChar to the serial port / pseudo-serial buffer. If the transmit buffer is full, thefunction will return erTRANSMIT_BUFFER_FULL
Note: In order for terminate program execution, the MINTBreak function should beused and not serialPutChar(..,05).
Example (‘C’):__int8 szCommand[] = “jg.1 = 50”;__int16 n=0;while (szCommand[n]) { while (serialPutChar (hController, szCommand[n]) != erTRANSMIT_BUFFER_FULL); n ++;}
See also:
MINTBreak, MINTRun, serialPutStringTimeout, serialGetChar
Function Reference
MINT Interface Library: Issue 4.3 Page 136
serialPutCharTimeout
Prototype: ‘C’ - __int16 serialPutCharTimeout ( OCHANDLE hController,
__int16 nChar,__int32 lTimeout );
VB - serialPutCharTimeout% Lib "host32" (ByVal hController&,ByVal nChar%,
ByVal lTimeout&)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
nChar: Character to output
lTimeout: The timeout in milliseconds.
Description:Writes nChar to the serial port / pseudo-serial buffer. If the transmit buffer is full, thefunction will wait for up to lTimeout milliseconds before returningerTRANSMIT_BUFFER_FULL.
See also:
MINTBreak, MINTRun, serialPutChar, serialGetChar
serialPutStringTimeout
Prototype: ‘C’ - __int16 serialPutStringTimeout ( OCHANDLE hController, const
__int8 FAR *szString,__int32 lTimeout );
VB - serialPutStringTimeout% Lib "host32" (ByVal hController&,ByVal szString$,ByVal lTimeout&)
Function Reference
MINT Interface Library: Issue 4.3 Page 137
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
szString: The string to write
lTimeout: The timeout in milliseconds.
Description:serialPutStringTimeout writes the string to the serial port / pseudo-serial buffer. If it cannotwrite the string within lTimeout milliseconds it returns erTRANSMIT_BUFFER_FULL.Note that if this happens there is not way of telling how many characters from the stringwere written before the timeout. If this information is necessary it may be better to callserialPutCharTimeout repeatedly for each character in the string.
See also:
MINTBreak, MINTRun, serialPutChar, serialPutCharTimeout
setAutoNodeSelect
Prototype:'C' - __int16 setAutoNodeSelect ( OCHANDLE hController,
__int8 bEnable );VB - setAutoNodeSelect% Lib "host32" (ByVal hController&,
ByVal bEnabled%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
bEnable: TRUE/FALSE to enable or disable the feature.
Function Reference
MINT Interface Library: Issue 4.3 Page 138
Description:On controllers acting as busmaster on a CAN network or a member of a RS485 network,sending $X(X) directs serial traffic to a specific controller. When auto node selection isenabled, the MINT Interface Library will automatically send the dollar syntax.
By default, auto dollar select is enabled on ServoNode, and disabled on all other controllers.
Example 1:Using auto-node select (\examples\euro485\auto)
/*-----------------------------------------------------------------------*//* Example program to download a MINT file to three EuroSystem/485 *//* controllers on an RS485 network. *//*-----------------------------------------------------------------------*/#include "host_cif.h"
#define COM1 1#define NODE0 0#define NODE1 1#define NODE2 2
void main( void ){ /*---------------------------------------------------------------------*/ /* Create a handle to node 0 */ /*---------------------------------------------------------------------*/ OCHANDLE hRS485Node0 = createEuroSystemHandle ( NODE0, COM1, 9600, TRUE );
/*---------------------------------------------------------------------*/ /* Create a handle to the other 2 nodes */ /*---------------------------------------------------------------------*/ OCHANDLE hRS485Node1 = createRemoteEuroSystemHandle ( NODE1, hRS485Node0 ); OCHANDLE hRS485Node2 = createRemoteEuroSystemHandle ( NODE2, hRS485Node0 );
/*---------------------------------------------------------------------*/ /* Enable auto node selection. */ /*---------------------------------------------------------------------*/ setAutoNodeSelect ( hRS485Node0, TRUE );
/*---------------------------------------------------------------------*/ /* Download the same file to all 3 controllers */ /*---------------------------------------------------------------------*/ downloadMINTFile ( hRS485Node0, "dummy.mnt", filePROGRAM ); downloadMINTFile ( hRS485Node1, "dummy.mnt", filePROGRAM ); downloadMINTFile ( hRS485Node2, "dummy.mnt", filePROGRAM );
/*---------------------------------------------------------------------*/ /* Free the resources. */ /*---------------------------------------------------------------------*/ freeHandle ( hRS485Node2 ); freeHandle ( hRS485Node1 ); freeHandle ( hRS485Node0 );
}
Function Reference
MINT Interface Library: Issue 4.3 Page 139
Example 2:Not using auto-node select (\examples\euro485\no_auto)
#include "host_cif.h"
#define COM1 1#define NODE0 0#define NODE1 1#define NODE2 2#define toDOLLAR 1000 /* one second */
void main( void ){ /*---------------------------------------------------------------------*/ /* Create a handle to node 0 */ /*---------------------------------------------------------------------*/ OCHANDLE hRS485Node0 = createEuroSystemHandle ( NODE0, COM1, 9600, TRUE );
/*---------------------------------------------------------------------*/ /* Create a handle to the other 2 nodes */ /*---------------------------------------------------------------------*/ OCHANDLE hRS485Node1 = createRemoteEuroSystemHandle ( NODE1, hRS485Node0 ); OCHANDLE hRS485Node2 = createRemoteEuroSystemHandle ( NODE2, hRS485Node0 );
/*---------------------------------------------------------------------*/ /* Download the same file to all 3 controllers, sending $X as */ /*---------------------------------------------------------------------*/ serialPutStringTimeout ( hRS485Node0, "$0", toDOLLAR ); downloadMINTFile ( hRS485Node0, "dummy.mnt", filePROGRAM ); serialPutStringTimeout ( hRS485Node0, "$1", toDOLLAR ); downloadMINTFile ( hRS485Node1, "dummy.mnt", filePROGRAM ); serialPutStringTimeout ( hRS485Node0, "$2", toDOLLAR ); downloadMINTFile ( hRS485Node2, "dummy.mnt", filePROGRAM );
/*---------------------------------------------------------------------*/ /* Free the resources. */ /*---------------------------------------------------------------------*/ freeHandle ( hRS485Node2 ); freeHandle ( hRS485Node1 ); freeHandle ( hRS485Node0 );
}
See also:
getAutoNodeSelect
setAutoUpdateModified
Prototype: ‘C’ - __int16 setAutoUpdateModified ( OCHANDLE lpController,
__int16 nVariable );
Function Reference
MINT Interface Library: Issue 4.3 Page 140
VB - setAutoUpdateModified% Lib "host32" (ByVal hController&,ByVal nVariable%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the controller
nDPROffset: The address of the auto-update variable which has been modified.
Description:After writing a value to an auto-update variable e.g. GAIN, call setAutoUpdateModified toforce NextMove to read this value, and use it. See 3.6: Auto-Update Area.
See putFloat, putLong for more examples
Example (VB):‘-----------------------------------------------------‘ Read the current value‘-----------------------------------------------------getWord hController , roOUTPUTS, nOutputs
‘-----------------------------------------------------‘ XOR bit 0‘-----------------------------------------------------nOutputs = nOutputs XOR 1
‘-----------------------------------------------------‘ Write back to DPR and call setAutoUpdateModified‘-----------------------------------------------------putWord hController, roOUTPUTS, nOutputssetAutoUpdateModified hController, roOUTPUTS
See also:
putWord, putLong, putFloat
setCOMMSRetries
Prototype:'C' - __int16 setCOMMSRetries ( OCHANDLE hController,
__int16 nRetries );VB - setCOMMSRetries% Lib "host32" (ByVal hController&,
ByVal nRetries%)
Function Reference
MINT Interface Library: Issue 4.3 Page 141
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes No Yes No No No
Parameters:hController: Handle to the controller
nRetries: The number of retries on failure of a protected mode communication beforeaborting
Description:The function setCOMMSRetries can be used to automatically retransmit a failed protectedmode communication packet a number of times (default = 0).
See also:
COMMSRead, COMMSWrite, getCOMMSRetries
setEcho
Prototype:‘C’ - __int16 setEcho(OCHANDLE hController, __int16 nNewValue)VB - setEcho% lib "nmdll" (ByVal hController &, ByVal nNewValue%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No Yes No No No No
Parameters:hController: Handle to the NextMove PC
nNewValue: New value for echo.
Description:Writes the value of the MINT ECHO keyword using Dual Port RAM. There is no need tocall setAutoUpdateModified after calling this function. See Section 3.5: MINT Pseudo-SerialBuffer for more information on how this function can be used.
Function Reference
MINT Interface Library: Issue 4.3 Page 142
Note for upgrading users. setEcho is now part of the updateFirmware command.There is no need to call setEcho after loading mint.out to a NextMove/PC to prevent
pseudo-serial deadlock.
See also:
getEcho
setHandshakeMode
Prototype:‘C’ - __int16 setHandshakeMode ( OCHANDLE hController,
__int16 nHandshakeMode );VB - setHandshakeMode% Lib "host32" (ByVal hController&,
ByVal nHandshakeMode%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No Yes No Yes No
Parameters:hController: Handle to the controller
nHandshakeMode: The handshake mode to use. Currently this should be either 0 (nohandshaking) or mdRTS_CTS. More codes may be added in future.
Description:By default, hardware handshaking is only enabled on NextMove BX. CallingsetHandShakeMode (mdRTS_CTS) will use RTS/CTS handshaking. getHandshakeModereturns the current handshaking scheme.
See also:
getHandshakeMode, downloadHPGLFile
setIdleMessageProcessingEnabled
Windows Only
Function Reference
MINT Interface Library: Issue 4.3 Page 143
Prototype:'C' - __int16 setIdleMessageProcessingEnabled ( OCHANDLE hController,
__int8 bEnabled );VB - setIdleMessageProcessingEnabled% Lib "host32"
(ByVal hController&, ByVal bEnabled%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hController: Handle to the controller
bEnabled: To set whether idle message processing is enabled (TRUE/FALSE). Bydefault, message processing is disabled.
Description:Calling setIdleMessageProcessingEnabled(TRUE) will cause certain functions to processthe Windows message queue while they are waiting for an event. This may make theapplication more responsive, but must be used with care: read all of this description beforeusing the function.
serialGetXXXTimeout, If there is no character / not enough characters in the receivebuffer, the serialGetXXXTimeout functions will process the message queue untileither the completion .
serialPutXXXTimeout, If there is not enough space in the transmit buffer thefunctions will process the message queue until space becomes available or thefunction times out.
All Immediate Command Mode functions. All Immediate Command Mode functionswrite to NextMove and then wait for NextMove to say that the function has beencompleted. If setIdleMessageProcessingEnabled(TRUE) has been called, Windowsmessages will be processed during this time.
Dangers of using setIdleMessageProcessingEnabled(TRUE):Although an application with message processing enabled may run more smoothly, caremust be taken to prevent unwelcome side-effects.
For example
Function Reference
MINT Interface Library: Issue 4.3 Page 144
A Visual Basic program with 2 buttons. One button calls the Immediate Command ModesetMOVEA function, and another calls the Immediate Command Mode setOUT function.With message processing disabled, if the user presses the setMOVEA button, the applicationwill not allow him to do anything (e.g. press the other button, resize a Window, select amenu option) in that application until setMOVEA completes. This can take some time, ifNextMove’s move buffer was full and NextMove was executing a long move. To make theuser interface smoother, setIdleMessageProcessingEnabled(TRUE) could be called. Thiswould then allow the user to use the resize windows etc, but would also allow him to pressthe setOUT button. The setOUT call will fail with a code of erFRONT_ACTIVE as it is notpossible to call two Immediate Command Mode functions at once. In this case, a solutionwould have been to disable the setOUT button until the setMOVEA call completed.
A particular problem with Visual Basic is that timers will be called during ImmediateCommand Mode functions with idle processing enabled. If you must use a timer containingan Immediate Command Mode function, be sure to disable the timer before calling theImmediate Command Mode function. Otherwise the timer may be re-entered (i.e. be calleda second time before the first is finished)
See also:
getIdleMessageProcessingEnabled
setMINT328Retries
Prototype:'C' - __int16 setMINT328Retries ( OCHANDLE hController,
__int16 nRetries );VB - setMINT328Retries% Lib"host32"(ByVal hController&,
ByVal nRetries%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No No Yes No No No
Parameters:hController: Handle to the controller
nRetries: The number of retries on failure of a MINT328 communication beforeaborting
Function Reference
MINT Interface Library: Issue 4.3 Page 145
Description:The function setMINT328Retries can be used to automatically retransmit a failed MINT328communication a number of times (default = 0).
See also:
MINT328Command, MINT328Read, MINT328Write
setMMLEnabled
Prototype: ‘C’ - __int16 setMMLEnabled ( OCHANDLE hController, __int8 bEnabled );VB - setMMLEnabled Lib "host32" (ByVal hController&,
ByVal bEnable As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo Yes No No No No No
Parameters:hController: Handle to the NextMove.
bEnabled: TRUE: enable Immediate Command Mode commands,
FALSE: disable Immediate Command Mode
Description:Calling setMMLEnabled (FALSE) will cause all Immediate Command Mode functions toreturn immediately with a code of erFRONT_DISABLED. This is particularly useful in aWindows program. In the “Application Close” handler, disabling the Immediate CommandMode interface will cause any ‘backed-up’ Immediate Command Mode commands to exitimmediately. Otherwise, the Immediate Command Mode commands behind a button forexample will continue to be processed after the application has ‘visually’ closed.
This function is not available in a ‘C31 emulation’ build.
See also:
abortMMLCommand, setMMLEnabled
Function Reference
MINT Interface Library: Issue 4.3 Page 146
setOutputThis function has been removed. Instead use putWord (….., roOUTPUTS, X). For acontroller with X outputs the lower X bits specify the state of the outputs and the X’th bitspecifies the state of the relay. E.g. to set output 2 and the relay active, and turn of the otheroutputs on a NextMove/PC with 12 outputs.
REM set bits 2 and 12putWord ( hController, roOUTPUTS, &H804 )
Note that the number of outputs can be read from NextMove PC using getWord to read fromroNUM_DIO.
setProgramPath
Prototype:'C' - __int16 setProgramPath ( const __int8 FAR *szPath);VB - n/aDelphi - n/a
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteNo No C31 emulation No No No No
Parameters:hController: The application file (e.g. MINT.out) to use for the C31 emulation
program
Description:setProgramPath should be called to specify the application which will be loaded ontoNextMove before calling initialiseNextMove. See the MINT Motion Library ReferenceGuide for details on writing a C31 emulation program..
See also:
createNextMovePCHandle, freeHandle. selectGlobalController
Function Reference
MINT Interface Library: Issue 4.3 Page 147
setPCFrontEnabledThis function has been renamed to setMMLEnabled.
setUpDownloadRetries
Prototype:'C' - __int16 setUpDownLoadRetries ( OCHANDLE hController,
__int16 nRetries );VB - setUpDownLoadRetries% Lib "host32" ( ByVal hController&,
ByVal nRetries%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
nRetries: The number of retries on upload or download failure.
Description:When a MINT file is uploaded or downloaded using uploadMINTFile ordownloadMINTFile a CRC check is performed to detect corruption. The default action inthis case is for the function to return with a failure code, but calling setUpDownloadRetrieswill cause the function to retry a number of times (default = 0).
See also:
getUpDownloadRetries, downloadMINTFile, uploadMINTFile
Function Reference
MINT Interface Library: Issue 4.3 Page 148
updateFirmware
Prototype:'C' - __int16 updateFirmware ( OCHANDLE hController,
const __int8 FAR *szFileName,__int8 cBootDevice,__int8 cTarget,__int8 bEchoOverwrite);
VB - updateFirmware% Lib "host32" ( ByVal hController&,ByVal szFilename$,ByVal cBootDevice As Byte,ByVal cTarget As Byte,ByVal bEchoOverwrite As Byte)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
szFilename: The firmware file
NextMove BX, ServoNode 34, 51 :*.hex ServoNode 50 :*.h02 NextMove PC :*.out
cBootDevice: Specifies the device to boot from on NextMove PC. Currently this shouldalways be set to bdEPROM. On all other controllers this parameter is notused and can be set to anything.
cTarget: Specifies the type of memory to load the firmware into on NextMove PC.Currently this should always be set to tmRAM. On all other controllers thisparameter is not used and can be set to anything.
bEchoOverwrite: Setting this to TRUE will have the same effect as calling setECHO(eoALL + eoOVERWRITE) on NextMove PC. See setECHO orSection 3.5.2: Preventing Deadlock Situations for an explanation.On all other controllers this parameter is not used and can be set toanything.
Function Reference
MINT Interface Library: Issue 4.3 Page 149
Description:updateFirmware allows new firmware (e.g. MINT) to be downloaded to NextMove PC,ServoNode and NextMove BX. This is the same as “Update” on cTerm for Windows, or“Download Application” on the NextMove WorkBench. On ServoNode and NextMove BXthe new firmware will be stored in FLASH, but on NextMove PC it will be stored in RAM,and will require updating again after the controller has been reset. Note that if programmingin ‘C’ or ‘C++’, it is preferable to use the function updateFirmwareEx, as the progresscallback function allows the user to be prompted as to when they must power-cycle thecontroller (ServoNode and NextMove BX only)
Note for upgrading users: calling this function for NextMove PC has the same effect ascalling resetBoard, loadApplication, runApplication, setEcho in older library versions.
See also:
updateFirmwareEx
updateFirmwareEx
Prototype:'C' - __int16 updateFirmwareEx ( OCHANDLE hController,
const __int8 FAR *szFileName,__int8 cBootDevice,__int8 cTarget,__int8 bEchoOverwrite,
void (CALLBACK * lpfnProgress)( __int16 nMessage, float fPercentCompleted ), __int8 (CALLBACK * lpfnCancel) ( void ) );
VB - Not available under VB
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes No Yes Yes No Yes No
Parameters:hController: Handle to the controller
Function Reference
MINT Interface Library: Issue 4.3 Page 150
szFilename: The firmware file
NextMove BX, ServoNode 34, 51 :*.hex ServoNode 50 :*.h02 NextMove PC :*.out
cBootDevice: Specifies the device to boot from on NextMove PC. Currently this shouldalways be set to bdEPROM. On all other controllers this parameter is notused and can be set to anything.
cTarget: Specifies the type of memory to load the firmware into on NextMove PC.Currently this should always be set to tmRAM. On all other controllers thisparameter is not used and can be set to anything.
bEchoOverwrite: Setting this to TRUE will have the same effect as calling setECHO(eoALL + eoOVERWRITE) on NextMove PC. See setECHO orSection 3.5.2: Preventing Deadlock Situations for an explanation.On all other controllers this parameter is not used and can be set toanything.
lpfnProgress: This is a user supplied progress function. It should be copied from theexample below. It can be used to prompt the user to power cycle, or to keepthem informed of progress.
lpfnCancel: This is the user supplied cancel function. To abort the download, returnTRUE from this function, otherwise return FALSE.
Description:This function acts the same as updateFirmware, but has two optional callback functions asdescribed above. If one of these parameters is not required, pass NULL.
Notes:
1. Under Windows NT the callback functions will not be called if updatingNextMove PC
2. Under C++, this function is called updateFirmware, with the final twoparameters defaulting to NULL.
Example (C++ ): taken from \examples\update/*-----------------------------------------------------------------------*//* lpfnCancel */
Function Reference
MINT Interface Library: Issue 4.3 Page 151
/* *//* Function: *//* This function is called by updateFirmwareEx ( 'C' ) or *//* updateFirmware ( C++ ) to allow the user to cancel the update. This*//* example aborts the update if the user presses a key. *//* Argument list: *//* void - *//* Return value: *//* __int8 CALLBACK *//*-----------------------------------------------------------------------*/__int8 CALLBACK lpfnCancel ( void ){ if ( kbhit()){ return TRUE; } return FALSE;}
/*-----------------------------------------------------------------------*//* lpfnProgress *//* *//* Function: *//* This function is called by updateFirmwareEx ( 'C' ) or *//* updateFirmware ( C++ ) to allow the user to be presented with *//* prompts and feedback. Use this example as a skeleton for your *//* progress function, modifying the messages as required. *//* *//* Argument list: *//* __int16 nMessage - a progress code: *//* updateWAITING_POWERUP (ServoNode/NextMove BX): waiting for the *//* user to power-cycle the controller. *//* updateERASING_FLASH: (ServoNode/NextMove BX)controller is *//* erasing flash. From this point on the existing firmware is*//* lost. *//* updateSCANNING_FILE: (ServoNode/NextMove BX)checking for *//* errors *//* updateDOWNLOADING ( All controllers ): loading the file. The *//* function will be called each time 1% of the file is *//* downloaded with nMessage set to updateDOWNLOADING and the *//* percentage in fPercentCompleted. *//* updateRESETTING ( NextMove PC ): updateFirmware(Ex) is *//* resetting the controller *//* updateRUNNING ( NextMove PC ):the application has loaded *//* succesfully and updateFirmware(Ex) is waiting for it to *//* initialise. *//* float fPercentCompleted - When nMessage == updateDOWNLOADING, the *//* fPercentCompleted holds the percentage of the file that has *//* been downloaded. *//* Return value: *//* void *//*-----------------------------------------------------------------------*/void CALLBACK lpfnProgress ( __int16 nMessage, float fPercentCompleted ){ switch ( nMessage ){ case updateWAITING_POWERUP: printf("\nWaiting for power-up\r"); break;
Function Reference
MINT Interface Library: Issue 4.3 Page 152
case updateERASING_FLASH: printf("Erasing flash \r"); break; case updateSCANNING_FILE: printf("Scanning file \r"); break; case updateDOWNLOADING: if ( (float)0.0<fPercentCompleted ) printf("Downloading: %d%% \r", ( int )fPercentCompleted); else printf("Downloading \r"); break; case updateRESETTING: printf("Resetting \r"); break; case updateRUNNING: printf("Running application \r"); break; }}
/*-----------------------------------------------------------------------*//* main *//* *//* Function: *//* This function downloads mint.hex to a NextMove BX *//* Argument list: *//* void *//*-----------------------------------------------------------------------*/__int16 main( void ){ __int8 bPortOpen;
/*---------------------------------------------------------------------*/ /* Create a CNextMove BX object: node 0, com 1, 9600 baud */ /*---------------------------------------------------------------------*/ CNextMoveBX MME(0,1,9600,TRUE);
/*---------------------------------------------------------------------*/ /* Check whether the serial port was open */ /*---------------------------------------------------------------------*/ MME.isOpen(&bPortOpen); if(!bPortOpen) { cout << "port not open\n"; return 1; }
/*---------------------------------------------------------------------*/ /* Turn on RTS/CTS handshaking ( optional ) */ /*---------------------------------------------------------------------*/ MME.setHandshakeMode(mdRTS_CTS);
/*---------------------------------------------------------------------*/ /* Update the firmware */ /*---------------------------------------------------------------------*/ __int16 nError; nError = MME.updateFirmware("mint.hex",0,0,FALSE,lpfnProgress,lpfnCancel);
Function Reference
MINT Interface Library: Issue 4.3 Page 153
/*---------------------------------------------------------------------*/ /* Convert the error code into a text string */ /*---------------------------------------------------------------------*/ __int8 szError[szMAX_ERROR]; getErrorString(szError,nError);
/*---------------------------------------------------------------------*/ /* Display the message */ /*---------------------------------------------------------------------*/ cout << "Error " << nError << ": " << szError << endl;
while(!kbhit());
return nError;}
See also:
updateFirmware
uploadFileThis function has been renamed to uploadMINTFile.
uploadMINTFile
Prototype: ‘C’ - __int16 uploadMINTFile ( OCHANDLE hController,
const __int8 FAR *szFilename, __int16 nFileType );
VB - uploadMINTFile% Lib "host32" (ByVal hController&, ByVal szFilename$, ByVal nFileType%)
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hNextMove: Handle to the controller
szFileName: File name to upload.
nType: Specifies buffer
Function Reference
MINT Interface Library: Issue 4.3 Page 154
filePROGRAM Program file.
fileCONFIG Configuration File.
fileARRAY Array File.
Description:uploadMINTFile opens (or creates) the file szFileName and writes the contents of therelevant MINT buffer to it. Note that to upload from a remote ServoNode on a CANnetwork, the MINT keyword TERMINALMODE must be set to allow serial comms acrossCAN.
Example (VB):If uploadMINTFile (hController, “myprog.cfg”, fileCONFIG) Then MsgBox “Error saving file to disk”End If
See also:
downloadMINTFile, uploadMINTFileEx
uploadMINTFileEx
Prototype: ‘C’ - __int16 uploadMINTFileEx (OCHANDLE hController,
const __int8 FAR *szFilename,__int16 nFileType,
void (CALLBACK *lpfnProgress)( __int16 nNumLines ), __int8 (CALLBACK *lpfnCancel) ( void )
__int16 FAR *lpnErrorLine);VB - not availableDelphi - not available
Controller:NextMove BX NextMove BX NextMove PC EuroSystem EuroSystem ServoNode ServoNode
Remote Remote RemoteYes Yes Yes Yes Yes Yes Yes
Parameters:hNextMove: Handle to the controller
szFileName: File name to upload.
nType: Specifies buffer
filePROGRAM Program file.
Function Reference
MINT Interface Library: Issue 4.3 Page 155
fileCONFIG Configuration File.
fileARRAY Array File.
lpfnProgress: User written progress callback function.
lpfnCancel: User written cancel callback function.
lpfnErrorLine: If there is a ‘line too long error’ this is the line at fault.
Description:uploadMINTFileEx opens (or creates) the file szFileName and writes the contents of therelevant MINT buffer to it. To upload from a remote ServoNode on a CAN network, theMINT keyword TERMINALMODE must be set to allow serial comms across CAN. For afull description of the use of the callback functions see downloadMINTFile.
C++ Users: This function is called uploadMINTFile under C++. The final twoparameters default to NULL, making it act the same as the other uploadMINTFile.
See also:
downloadMINTFileEx, uploadMINTFile
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 156
8. Appendix 1: NextMove PC DPR Map__________
8.1 Overview
16 bit wide
1K
x1
6b
itw
ord
s
Status/Control Registers - 9 words
Reserved351 Words
Ref: nm_dpr 0598
Interrupt Host Word (3FF)
Interrupt NextMove Word (3FE)
Application Code Register (3FB)Functionality Code Register (3FC)
Scratchpad Register (3FD)
3FFH
000H
00FH
015
Axis Data256 words
MINT Comms Protocol198 words
Immediate Command Mode Interface: 32 words
I/O Data32 words
NextMove Serial Transmit Buffer (PC Receive Buffer)67 words
NextMove Serial Receive Buffer (PC Transmit Buffer)67 words
DPR Control Register
DPR Status Register
Timer Tick
MINT / MML Build ID
Analogue I/O Mix
Digital I/O Mix
Axis Mix
MINT Status
MINT Line Number
015
Reserved - 7 words
10FH
12FH
14FH
192H
1D5H
29BH
3FAH
MINT Error
Axis Configurations
MINT Error Line
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 157
8.2 NextMove PC Address MapEach area of the address map is described below. Where an address is shown, that is theDPR location. Where an address offset is shown, that offset is added to the base address.Where an address is indicated as ‘auto-update’ it means that writing to the ‘InterruptNextMove Word’ will result in NextMove reading that address and using the value. Seesection 3.6: Auto-Update Area (pg.28) for details.
Floating point numbers will conform to C31 format. It is up to the PC interface toconvert to IEEE format before passing the data to the PC application. Likewise,IEEE floating point numbers must be converted to C31 format before writing to theDPR. All library functions do this automatically.
The update time on the DPR is 2ms. Where units are shown, the key is as follows:uu - user unitsuu/s - user units / secondau - analogue units. (See ADCMode keyword for explanation of ranges)% - percentagects - encoder counts
Symbolic constants are defined in the header files DPR_MAP.H / MIL_DEV.BAS /MIL_DEV.PAS
All addresses and address offsets are in hex.
8.2.1 Status / Control Registers
Address Data SymbolicConstant
Size DataType
AutoUpdate
0x000 DPR ControlRegister
roCONTROL 16 integer ❏
0x001 DPR Status Register roSTATUS 16 integer0x002 Axis Mix roNUM_AXES 16 integer0x003 Digital I/O Mix roNUM_DIO 16 integer0x004 Analogue I/O Mix roNUM_AIO 16 integer0x005 MINT / MML Build
IdentifierroBUILD 16 integer
0x006 Timer Tick roTIMER_TICK 16 integer0x007 MINT line number roMINT_LINE 16 integer
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 158
Address Data SymbolicConstant
Size DataType
AutoUpdate
0x008 MINT Status roMINT_STATUS 16 integer0x009 MINT Error roMINT_ERR 16 integer0x00A MINT Error line roMINT_ERL 16 integer0x00B Axis configurations roAXIS_CF 32 integer
0x00D –0x00F
Reserved
DPR Control Register:
Bit Meaning Symbolic Constant
0 Lock DPR contents btLOCK1 Lock axis 0 DPR contents btLOCK_AXIS_02 Lock axis 1 DPR contents btLOCK_AXIS_13 Lock axis 2 DPR contents btLOCK_AXIS_24 Lock axis 3 DPR contents btLOCK_AXIS_35 Lock axis 4 DPR contents btLOCK_AXIS_46 Lock axis 5 DPR contents btLOCK_AXIS_57 Lock axis 6 DPR contents btLOCK_AXIS_68 Lock axis 7 DPR contents btLOCK_AXIS_7
9-15 Reserved
DPR Status Register:
Bit Meaning Symbolic Constant
0 DPR Contents locked if 1 btLOCKED1 DPR contents invalid if 0 btVALID
2 - 15 Reserved
Axis Mix:
This specifies the number and types of axes available on the NextMove variant:
Lo-Byte - Number of stepper axes
Hi-Byte - Number of servo axes
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 159
Digital I/O Mix:
This specifies the number of digital inputs and outputs available on the NextMove variant:
Lo-Byte - Number of digital outputs
Hi-Byte - Number of digital inputs
Analogue I/O Mix:
This specifies the number of analogue inputs and outputs available on the NextMovevariant:
Lo-Byte - Number of analogue outputs
Hi-Byte - Number of analogue inputs
MML Build ID:
The build identifier of the MINT Motion Library running on NextMove. Each version ofthe MINT Interface Library can only communicate with one version of MINT. To makesure the versions match, each version of MINT has a build number embedded in it. Toreturn the build number call getAAABuild.
Timer Tick:
This is a free running 16bit counter that is updated by NextMove once every 2ms and can beused to synchronise data with the DPR.
MINT Line Number:
This is the currently executing MINT program line. By reading this location, it is possibleto trace program execution without affecting program flow unlike MINTs built in programtracer. The MINT status flag should be read to determine which buffer is currently beingexecuted.
MINT Status:
The MINT Status flag consists of various bit masks for status information. The top 8 bitsconvey the current MINT error status. If a programming error occurs that results in thetermination of a program, the top 8 bits will reflect the error. The MINT Line Numberregister will determine the line on which the error occurred.
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 160
Bit Meaning Symbolic Constant
0 Command line interface not available.Program of config file running.
mkNOT_COMMAND_LINE
1 Config buffer if 0, program buffer if 1 mkPROGRAM2 1 if MINT is executing code mkEXECUTING
3 - 7 Reserved
MINT Error:
The MINT ‘ERR’ code for the last MINT error that occurred.
MINT Error Line:
The MINT line number where the last MINT error occurred.
Axis Configurations:
The current axis configurations are written to two 16 bit locations, each axis configurationsrepresented by 4 bits. Each four bit location holds the axis CONFIG value.
DPR location Bits 12-15 Bits 8-11 Bits 4-7 Bits 0-3
0x0B Axis 3 Axis 2 Axis 1 Axis 00x0C Axis 7 Axis 6 Axis 5 Axis 4
Values are:
0 – Axis is configured off.1 – Axis is configured as a servo axis.2 – Axis is configured as a stepper axis.3 – Axis is configured for PWM.
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 161
8.2.2 Axis DataThe data for each axis is held in a block, the format and address offset as shown.
AddrOffset
Data Symbolic Constant Size DataType
Units AutoUpd.
0x00 Position roPOSITION 32 float uu0x02 Instantaneous
SpeedroMEASURED_SPEED 32 float uu/s
0x04 Slew Speed roDEMAND_SPEED 32 float uu/s ❏0x06 Mode of
MotionroMODE_OF_MOTION 32 integer -
0x08 Motion Error roMOTION_ERROR 16 integer -0x09 Following
ErrorroFOLLOWING_ERROR 32 float uu
0x0B ProportionalGain
roP_GAIN 32 float - ❏
0x0D VelocityFeedback Gain
roV_GAIN 32 float - ❏
0x0F VelocityFeedforward
Gain
roFF_GAIN 32 float - ❏
0x11 DerivativeGain
roD_GAIN 32 float - ❏
0x13 Integral Gain roI_GAIN 32 float - ❏0x15 Integral Range roI_RANGE 32 float % ❏0x17 Next Mode of
MotionroNEXT_MODE 32 integer -
0x19 DAC DemandValue
roDAC_VALUE 16 integer au
0x1A Free Spaces inMove Buffer
roFREE_SPACES 16 integer -
0x1B Move BufferIdentifier
roMOVE_ID 16 integer -
0x1C Axis DemandPosition
roDEMAND_POS 32 float uu
0x1E Axis DemandVelocity
roDEMAND_VEL 32 float uu/s
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 162
The base address for each axis is:
Axis Base Address Symbolic Constant
0 0x010 roAXIS_01 0x030 roAXIS_12 0x050 roAXIS_23 0x070 roAXIS_34 0x090 roAXIS_45 0x0B0 roAXIS_56 0x0D0 roAXIS_67 0x0F0 roAXIS_7
8.2.3 I/O Data
Address Data SymbolicConstant
Size DataType
Units AutoUpd.
0x110 Analogue 0 roANALOG_0 16 integer au0x111 Analogue 1 roANALOG_1 16 integer au0x112 Analogue 2 roANALOG_2 16 integer au0x113 Analogue 3 roANALOG_3 16 integer au0x114 Analogue 4 roANALOG_4 16 integer au0x115 Analogue 5 roANALOG_5 16 integer au0x116 Analogue 6 roANALOG_6 16 integer au0x117 Analogue 7 roANALOG_7 16 integer au0x118 Digital Inputs roINPUTS 32 integer -0x11A Digital Outputs roOUTPUTS 16 integer - ❏0x11B Stop/Error Input
StatusroMG_STATUS 16 integer -
0x11C Boost Outputs roBOOST 16 integer - ❏0x11D VME master
encoder positionroMENC_POS 32 float cts
0x11F VME masterencoder velocity
roMENC_VEL 32 float cts
0x121 -0x12F
Reserved 16 -
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 163
8.2.4 Immediate Comand ModeThe ICM area is used for the transfer of Motion Generator commands
The start of the ICM area is 0x130 and has the symbolic constant roFRONT_START.
8.2.5 Serial InterfaceThe serial interface works by implementing a 64 word circular buffer within DPR. There isone such buffer for the receive buffer and one for the transmit buffer. Head and tail pointersare also located in DPR allowing both sides of DPR to check the status of the buffers.
The serial interface occupies DPR locations 0x150 to 0x1D5 in the following configuration:
Txd Buffer
0x85
0x46Txd Reserved 0x45
Txd Tail 0x44Txd Head 0x43
Rxd Buffer
0x42
0x03Rxd Reserved 0x02
Rxd Tail 0x01Rxd Head 0x00
The buffer itself has two sets of symbolic constants, depending on which side, NextMove orhost, that is using them.
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 164
AddressOffset
Symbolic Constant - Host Symbolic Constant - NextMove
0x00 ofTXD_HEAD ofNM_RXD_HEAD0x01 ofTXD_TAIL ofNM_RXD_TAIL0x03 ofTXD_BUFFER ofNM_RXD_BUFFER0x43 ofRXD_HEAD ofNM_TXD_HEAD0x44 ofRXD_TAIL ofNM_TXD_TAIL0x46 ofRXD_BUFFER ofNM_TXD_BUFFER
The offsets from the start of the serial interface are shown in hex. The start of the serial I/Obuffer has a symbolic constant of ofSERIAL_IO_BASE.
8.2.6 Special Functions Registers
Address Use Symbolic Constant
0x3FB Application Code Register roAPPLICATION_CODE0x3FC Functionality Code Register roFUNCTION_CODE0x3FD Scratchpad Register roSCRATCH_PAD0x3FE Interrupt NextMove Register roINTERRUPT_NM_REG0x3FF Interrupt Host Register roINTERRUPT_PC_REG
The way in which dual port RAM is used may vary from application to application. Allapplications should use the registers detailed in this document in the same way. This willallow host resident code to determine whether it recognises the application and the protocolused for communication.
There is no hardware restriction upon those locations that may be read or written from eitherside. Both NextMove and the host have full read and write access to all locations.
Application Code Register (3FB)
This register identifies the software running on NextMove. The host may use this todetermine how to communicate with the software or better interpret the bits within theFunctionality Code Register. Each application program should have a unique identifier. Ofthe 65536 possible codes, the first half are reserved. Codes 32768 to 65535 may be used toidentify user programs. Application programs should prime this register after all otherinitialisation. It is recommended that the host does not write to this location.
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 165
Code Description Of Program Symbolic Constant
0 Unidentified program or no programrunning.
apNONE
1 Loader running. apLOADER2 Immediate Command Mode
supported.apFRONT
3 NextMove test program running. apNM_TEST4 MINT for NextMove suported. apNM_MINT
5+ Reserved
Functionality Code Register (3FC)
This register describes the capabilities of the software running on NextMove. The registermay be used by a host to determine how it should communicate with the software, what datais stored in dual port RAM, etc. The register contains a series of bits each of which indicatewhether a specific feature is supported. The table below describes the current list ofstandard application capabilities. It is expected that this list will grow over time.Application programs should set the relevant bits in this register after all other initialisation.
It is recommended that the host does not write to this location.
Bit Description Of Feature Symbolic Constant
0 Loader communication protocol. fcLOADER_COMMS1 Motion Generator auto update of
locations 0 to $12F.fcAUTO_UPDATE
2 FRONT.OUT communication protocol. fcFRONT_COMMS3 Pseudo Serial Port Buffer. fcSERIAL_PORT4 MINT interpretation of serial buffer
communications (Comms Protocol)fcCOMMS_ON
6 - 15 Reserved
Appendix 1: NextMove PC DPR Map
MINT Interface Library: Issue 4.3 Page 166
Scratchpad Register (3FD)
This register is a general purpose register used only by the host. It is only written to by theLoader immediately after reset when it is cleared to zero. It may be used by the host todetermine that a NextMove may be installed on the bus. As NextMove will not write to thislocation the host can write codes and read them back in the knowledge that they should nothave changed. After use by the PC host, the scratchpad should be returned to the value itoriginally contained.
It is recommended that NextMove application programs do not write to this register.
Interrupt NextMove Register (3FE)
Writing to this register from the host will generate an interrupt on NextMove. If the userhas installed a dual port RAM interrupt handler, setDualPortHandler(), then this will becalled with the interrupt code. Note, certain codes are reserved.
Interrupt Code Meaning
0x0001 – 0x012F Auto update address0x0130 – 0x03EF ICM interface0x03F0 – 0x03FF Reserved0x0400 – 0x04FF MINT Serial interrupt.All other codes call the user installed DPRhandler
Note that dual port RAM will generate multiple interrupts to the C31 processor for a singlewrite from the host side. Reading this register from the host will not generate a NextMoveinterrupt.
Interrupt Host Register (3FF)
Writing to this register from NextMove will generate a host interrupt at the selectedinterrupt level. This is set by jumpers D,E,F,G,I,J,K on NextMove PC. Reading from thislocation on the host side will clear down the interrupt line. Reading this register fromNextMove will not generate a host interrupt.
Appendix 2: Symbolic Constants
MINT Interface Library: Issue 4.3 Page 167
9. Appendix 2: Symbolic Constants _____________The library functions can return error codes or can be passed parameters for which a numberof symbolic constants have been defined in appropriate header files. These values areshown below.
Error Codes:
Value Symbolic Constant Meaning
0 erSUCCESS No error1 erMML_ERROR The MML function failed. Cal
getSystemError (NextMove MINTMotion Library Reference manual)
1001 erINITIALISING Loader initialising1002 erNOT_RUNNING Loader not runnning1003 erBAD_COMMAND Unrecognised command code1004 erBAD_ADDRESS Invalid address received1005 erBAD_ERASE Flash erase failed1006 erBAD_BURN Flash program failed1007 erCANNOT_OPEN_FILE File bad or does not exist1008 erINVALID_FORMAT File not proper COFF format1009 erERROR_DOWNLOADING COFF download failed1010 erTIMEOUT Loader did not respond in time1011 erDPRAM_LOCATION DPR location out of range1012 erNOT_ENOUGH_MEM Insufficient memory for program1013 erBAD_BOOT_DEVICE Bad boot source id1014 erCARD_NOT_FOUND Unable to locate NextMove1015 erINVALID_VME_TYPE Bad VME parameter.1016 erINVALID_NEXTMOVE_TYPE Bad NextMove parameter.1017 erINVALID_STRING_FORMAT Must use NULL terminated string for
string parameters.1018 erNO_MINT_PROMPT Command prompt was not avaiable for
up/download. Should use MINTBreakto stop a running program.
1019 erNO_WIN95_VME_SUPPORT NextMove/VME not currentlysupported under Windows 95.
1020 erCOMMAND_ABORTED User aborted front command1021 erFRONT_ACTIVE Front resource already in use1022 erCOMMAND_INTERRUPTED Command was not passed to MG: try
again.
Appendix 2: Symbolic Constants
MINT Interface Library: Issue 4.3 Page 168
Value Symbolic Constant Meaning
1023 erRETURN_INVALID Return code invalid. Call getSystemErr.1024 erFRONT_DISABLED Immediate Command Mode has been
disabled1025 erINVALID_HANDLE The handle had not been correctly
initialised.1026 Error 1026 Removed1027 erPROTOCOL_ERROR Unknown protocol on upload/download1028 erFILE_ERROR The file could not be opened, or was
corrupted.1029 erINVALID_FILETYPE The filetype parameter passes to
up/downloadFile was not correct.1030 erNO_PROMPT The function failed as MINT was not at
the command line. Try MINTBreak andthen call the function again.
1031 erNO_NT_SUPPORT This function cannot be used underWindows NT.
1032 erRESPONSE NextMove did not respond.1033 erTEMP_FILE_ERROR The function was unable to create a
required temporary file. Check diskspace.
1034 erCODE_ERROR Bad coding: contact supplier !1035 erIN_COMMS_ROUTINE Interface already in use by the comms
protocol1036 erDOWNLOADING Interface already in use by a file
download1037 erUPLOADING Interface already in use by a file upload1038 erIN_MINT328_ROUTINE Interface already in use a a MINT328
routine1039 erPORT_NOT_OPEN Serial port not opened1040 erCORRUPTION Corruption occured1041 erPORT_OUT_OF_RANGE Specified port not available1042 erNOTIFY Could not enable WM_NOTIFY1043 erCHECKSUM_ERROR The checksum failed1044 erNAK_RECEIVED The controller sent NAK1045 Error 1045 Removed1046 erERROR_OPENING_PORT Port could not be opened1047 erINVALID_CARDNUMBER Card number out of range1048 erINVALID_AXIS_PARAM Axis out of range1049 erINVALID_CONTROLLER_TYPE Invalid controller enumeration
Appendix 2: Symbolic Constants
MINT Interface Library: Issue 4.3 Page 169
Value Symbolic Constant Meaning
1050 erINVALID_COMMS_ADDRESS Comms address out of range1051 Error 1051 removed1052 erPORT_UNAVAILABLE Port already in use1053 erUSER_ABORT The user aborted the command1054 erCONTROLLER_REPORTS_ERROR The controller detected an error1055 erUPDATING Interface already in use by a firmware
update1056 erRECEIVE_BUFFER_EMPTY The receive buffer is empty1057 erTRANSMIT_BUFFER_FULL The transmit buffer is full1058 erINVALID_RETRIES The retries parameter failed1059 erBAD_SQUASH_FILE Bad squash file parameter1060 erUNDEFINED_SERIAL_ERROR The serial error is unknown1061 erPSERIAL_BUFFER_CORRUPTION The (pseudo-)serial buffers are corrupt1062 erFUNCTION_NOT_SUPPORTED Not supported on this platform1063 erCANNOT_OPEN_FILE File bad or doesn't exist1064 erINVALID_FORMAT file not proper COFF format1065 erDATA_TOO_LONG Too much data in one chunk1066 erINCORRECT_ARRAY_SIZE Array size or pointer incorrect1067 erUNKNOWN_ERROR_CODE The error code was not known1068 erCONTROLLER_NOT_RUNNING The controller is not running1069 erMML_VERSION_MISMATCH mgBUILD incorrect1070 erNO_DEVICE_DRIVER_SUPPORT Device driver not set up1071 erBAD_COM_PORT_NUMBER Com port not supported1072 erBAD_BAUD_RATE Baud rate not supported1073 erIN_GETCHARTIMEOUT Interface already in use1074 erIN_PUTCHARTIMEOUT Interface already in use1075 erIN_GETSTRINGTIMEOUT Interface already in use1076 erIN_PUTSTRINGTIMEOUT Interface already in use1077 erCAPTURING Interface already in use1078 erLINE_TOO_LONG MINT line too long
updateFirmware Codes (cBootDevice Parameter):
Value Symbolic Constant Meaning
0 tmFLASH Load program to flash memory1 tmRAM Load program to RAM
Appendix 2: Symbolic Constants
MINT Interface Library: Issue 4.3 Page 170
updateFirmware Codes (cTarget Parameter):
Value Symbolic Constant Meaning
0 bdEPROM Boot from EPROM1 bdFLASH Boot from flash memory2 bdSERIAL Boot from serial port
File Upload / Download Codes (Use with uploadMINTFile &downloadMINTFile)
Value Symbolic Constant Meaning
1 filePROGRAM Program file2 fileCONFIG Configuration file3 fileARRAY Array file
getControllerType Codes
Value Symbolic Constant Meaning
0 conEUROSYSTEM EuroSystem family (possibly RS485)1 conSERVONODE ServoNode (possibly on a CAN
network)2 conNEXTMOVE_BX NextMove BX3 conNEXTMOVE_PC NextMove PC
set/getHandshakeMode Codes
Value Symbolic Constant Meaning
1 mdRTS_CTS RTS/CTS Handshaking
updateFirmwareEx Update Callback Codes
Value Symbolic Constant Meaning
1 updateWAITING_POWERUP Waiting for the user to power cycle thecontroller
2 updateERASING_FLASH Controller is erasing flash3 updateSCANNING_FILE Scanning the firmware file4 updateDOWNLOADING Downloading the firmware: use the
percentage parameter.
Appendix 2: Symbolic Constants
MINT Interface Library: Issue 4.3 Page 171
Value Symbolic Constant Meaning
5 updateRESETTING Resetting the controller6 updateRUNNING Running the application
Appendix 3: Timings
MINT Interface Library: Issue 4.3 Page 172
10. Appendix 3: Timings ________________________These timings show the time taken to call functions from a host. The tests were performedon a 166 MHz Pentium PC with a NextMove / PC. Note that the timings varied across tests:these figures are averages.
10.1 Basic DPR Access
Function Time inmicrosecondsWindows 95
Time inmicrosecondsWindows 98beta
Time inmicrosecondsWindows NT
16 bit write ( putWord) 8.5 21 4132 bit write (putLong ) 17.4 42 4516 bit read ( getWord ) 8.5 21 4132 bit read ( getLong ) 26.1 61 46
10.2 Immediate Command Mode Functions
Function Time inmicrosecondsWindows 95
Time inmicrosecondsWindows 98beta
Time inmicrosecondsWindows NT
getPOS 402 505 407setJOG 433 569 450setSPEED 367 504 404