Mint™ version 4 PC Programming Guide MN1278 Issue 1.2 MN1278 05.
Mint v4 PC Programming Guide ii MN1278 05.
Copyright Copyright Baldor UK Ltd © 2001. All rights reserved. This manual is copyrighted and all rights are reserved. This document or attached software may not, in whole or in part, be copied or reproduced in any form without the prior written consent of Baldor UK. Baldor UK makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of fitness for any particular purpose. The information in this document is subject to change without notice.
Mint v4 PC Programming Guide iv MN1278 05.
Manual Revision History Manual Revision History Issue Date BOCL Reference 1.0 Apr 99 UM00545-000 1.1 Feb 00 UM00545-001 1.2 May 2001 UM00545-002 MN1278 05.2001 Comments Raised from MN00249-003. This is a new UM for v4, allowing updates to the v3 manual to continue as MN00249-XYZ Added NextMove PC device driver documentation. Corrected for Mint v4 ( new C++ files, Win2000, WinME. Updates for PC Developer Libraries 1302 release.
Mint v4 PC Programming Guide vi MN1278 05.
Contents Introduction ................................................................................ 1 1.1 Introduction...............................................................................................2 1.2 Installation ................................................................................................2 Communicating with a Controller ............................................. 3 2.1 NextMove PCI.............................................................................
Mint v4 PC Programming Guide 3.3.2 A Visual Basic Tutorial. ......................................................................27 3.4 Borland Delphi 5.0 ..................................................................................31 PC Based Motion Control ........................................................ 35 4.1 Limitations of PC based applications ......................................................37 4.2 Events and Interrupt Control on NextMove PCI ..................................
Contents 6.10 Data Synchronisation..............................................................................66 Appendix 2: Timings ................................................................ 67 7.1 Immediate Command Mode Functions ...................................................67 Appendix 3: Symbolic Constants ............................................ 69 Bibliography ............................................................................. 77 MN1278 05.
Introduction 1. Introduction 1 The Mint™ v4 PC Programming Guide details how to call Mint v4 functions and how to communicate with Mint controllers from PC based host applications. MN1278 05.
Mint v4 PC Programming Guide 1.1 Introduction The PC Developer Libraries allow PC based applications to be written that communicate with Mint controllers. This is achieved using the Mint Interface Library which is a common API (Application Program Interface) for the range of Mint based motion controllers. The Mint Interface Library is suitable for use under Windows 95, 98, ME, NT and 2000 via an ActiveX control or C++ source code.
Communicating with a Controller 2. Communicating with a Controller 2 This chapter covers general communication with Mint controllers. MN1278 05.
Mint v4 PC Programming Guide The Mint Interface Library is a common API that allows access to Mint controllers. It can be used via an ActiveX control or through C++ source code. The Mint Interface Library is suitable for use under Windows 95, 98, ME, NT and 2000. The ActiveX control (OCX) can be used with a large number of languages. This document concentrates on Microsoft Visual C++, Microsoft Visual Basic and Borland Delphi but the principle is the same in any language.
Communicating with a Controller The main features and uses of DPR are: • Support for the Mint Comms protocol. This is a method of asynchronously updating variables in a Mint program from the host. • Mint pseudo serial buffer. This allows communication with the Mint command line and Mint program and configuration loading/saving. • Reporting of Mint status. The host can read whether Mint is at the command line and if not, which line it is executing. • Automatic reporting of motion variables.
Mint v4 PC Programming Guide /* COMMS location uses #define CONTROL_LOCATION #define PARAM_1 */ 1 2 /* Flags for control location #define COMPLETED 0.0 #define SPECIAL_ROUTINE1 1.0 */ /* Create a handle to the controller */ CNextMovePC myNextMove ( NODE0, nmADDRESS ); /* Define variables */ float fErrorCode; float fOutput = 1.0; float fControl = SPECIAL_ROUTINE1; /* Write to comms location */ myNextMove.setComms (NODE0, PARAM_1, &fOutput ); /* Write to comms location */ myNextMove.
Communicating with a Controller 2.5 Interfacing with Mint The Mint command line allows manual execution of Mint keywords. Using the Mint WorkBench, the Mint command line can be used when testing, commissioning and debugging Mint programs. There are several functions in the Mint Interface Library for direct access to the serial buffer: setSerialChar, setSerialCharTimeout, setSerialStringTimeout, getSerialChar, getSerialCharTimeout and getSerialStringTimeout.
Mint v4 PC Programming Guide The following is a summary of the functions used to access the Mint command line: Function Name doMintBreak doMintRun getSerialChar getSerialCharTimeout getSerialStringTimeout setSerialChar setSerialCharTimeout setSerialStringTimeout 8 Description Sends Ctrl-E to Mint,( bypassing the pseudo-serial buffer on NextMove PC and PCI ).
Using the Library with Various Languages 3. Using the Library with Various Languages 3 This chapter details the use various different programming languages. The languages covered are: MN1278 05.
Mint v4 PC Programming Guide 3.1 C++ The Mint Interface Library was written in C++. The source code is provided and can be included in your project. The only supported compilers are Visual C++ v6.0 and Watcom 11. All other compilers must use the ActiveX control to communicate with controllers. 3.1.1 C++ : the Classes The Mint Interface Library contains a C++ class for each controller. In each case the class is defined in the header file in the right of the table.
Using the Library with Various Languages File Controller nmbase.cpp nmstd.cpp precomp.cpp serial.cpp syncronisation.cpp uncompress.cpp NextMove PC NextMove PC All All Serial All All 3.1.2 Pre-Compiled Headers in Visual C++ 6.0. In order to speed up compilation of C++ projects using C++, the Mint Interface Library files precomp.cpp and precomp.h can be used. This has been found to reduce build times by up to 85% so although not required are worth using. To use precompiled headers, include precomp.
Mint v4 PC Programming Guide Figure 3-1: Visual C++ 6.0 Project Settings (step 5) 6. Add #include “precomp.h” to the top of each source (.c or .cpp) file. Note that no pre-compiler directives (e.g. #include, #if, #define) should be placed above this line (although comments can be). 7. In the Project menu, select Settings. This will open the ‘Project Settings’ dialog. Select the C/C++ tab. In the Category drop-down, select Precompiled Headers. Select All Configurations in Settings For: on the left.
Using the Library with Various Languages Figure 3-2: Visual C++ 6.0 Project Settings (step 7) 8. Select precomp.cpp in File View. Right click with the mouse and select Settings. This will open a dialog similar to the dialog in step 3, but this time the dialog will only apply to precomp.cpp. Again, select Settings For: All Configurations, and the Precompiled Headers Category on the C/C++ tab. This time, select Create precompiled header file (.pch) and add precomp.h to the Through Header field.
Mint v4 PC Programming Guide Figure 3-3: Visual C++ 6.0 Project Settings (step 8) 9. Rebuild the project. Precomp.cpp should now be the first file to build. This causes the pre-compiled header file to be built. All the other files will now use this pre-compiled header as opposed to having to re-compile all the header files each time. 3.1.3 A Visual C++ 6.0 Tutorial This section will guide you through creating a Visual C application.
Using the Library with Various Languages 1. Open Visual C and select ‘ New’ from the ‘File’ menu. Select ‘MFC Appwizard(exe)’ from the ‘Projects’ tab. Enter the name ‘VCTutorial’ for the project and press ‘OK’. Figure 3-4: Visual C++ 6 New Project (step 1) MN1278 05.
Mint v4 PC Programming Guide 2. At Step 1 of the wizard, select ‘Dialog based’ and press ‘Finish’. Figure 3-5: Visual C++ 6 Application Wizard (step 2) 3. 16 Delete all the controls from the dialog (‘OK’ button, ‘Cancel’ button and ‘TODO: Place dialog controls here.’ Text) MN1278 05.
Using the Library with Various Languages 4. Select ‘Settings’ from the ‘Project’ menu. Select ‘All configurations’ from the ‘Settings For’ drop list. Select the ‘C/C++’ tab and add _INC_STDAFX_H_ to the end of the ‘Preprocessor definitions’ list. This will cause the existing “stdafx.h" to be included in the precompiled header. Figure 3-6: Project Settings (step 4) MN1278 05.
Mint v4 PC Programming Guide 5. Select ‘Precompiled Headers’ in the ‘Category’ drop list. Change ‘stdafx.h’ to ‘precomp.h’ in the ‘Use Precompiled header’ option. Figure 3-7: Project Settings (step 5) 18 MN1278 05.
Using the Library with Various Languages 6. Select ‘Preprocessor’ from the ‘Category’ drop list. Add ‘.,’ (dot-comma ) followed by the path to the Mint Interface Library header files in the ‘Additional include directories’ field. Press ‘OK’ to close the dialog. Figure 3-8: Project Settings (step 6) 7. In the ‘FileView’ pane, delete stdafx.cpp. Right-click on ‘VCTutorialFiles’ and select ‘Add Files To Project.’ Add ‘precomp.cpp’ (which should be in the c:\mint\host directory. ) MN1278 05.
Mint v4 PC Programming Guide 8. Right click on ‘precomp.cpp’ in ‘FileView’ and select ‘Settings’. Select ‘All Configurations’ in the ‘Settings For’ drop list. Select ‘Precompiled headers’ in the category drop-list on the ‘C/C++’ tab. Click the ‘Create Precompiled Header’ radio button and enter ‘precomp.h’ in the text field. Figure 3-9: Project Settings (step 8) 9. 20 Edit ‘VCTutorial.cpp’ and ‘VCTutorialDlg.cpp’. In both files, replace ‘#include “stdafx.h”’ with ‘#include “precomp.h”’.
Using the Library with Various Languages 10. Select ‘ClassView’. Right click on ‘CVCTutorialDlg’ and select ‘Add Member Function’. Copy the dialog below. Figure 3-10: Class View dialog (step 10) Hit ‘OK’ to edit the new function. The MILError function will check the return code from all Mint Interface Library functions. Edit the function as follows.
Mint v4 PC Programming Guide 12. Select ‘ClassView’. Right click on ‘CVCTutorialDlg’ and select ‘Add Member Variable’. Copy the dialog below. Figure 3-11: ClassView Dialog (step 12) 13. Find CVCTutorialDlg::OnInitDialog() in the file ‘VCTutorialDlg’. Replace the comment ‘// TODO: Add extra initialization here’ with code to initialise the CController * object. This will depend on the controller being used Note that m_pController could have been declared as the class that will be created (e.g.
Using the Library with Various Languages 14. The code should now compile, but not link. The following files should be added to the project to make it link. MintDrive & NextMove BX base.cpp baldorserial.cpp host_def.cpp ( if you have not already added it ) logfile.cpp mme.cpp mml.cpp serial.cpp synchronisation.cpp uncompress.cpp NextMove PC Base.cpp Host_def.cpp ( if you have not already added it ) logfile.cpp mml.cpp nextmove.cpp nm_nt.cpp nm_win32.cpp nmbase.cpp nmstd.cpp synchronisation.cpp uncompress.
Mint v4 PC Programming Guide /*------------------------------------------------*/ /* Toggle it. */ /*------------------------------------------------*/ MILError ( m_pController->setDriveEnable( 0, ( FALSE == b ))); } 3.1.4 Compiling an ATL COM Project with Visual C. When compiling an ATL COM project in Visual C, define _NO_AFX_. This prevents AFX and MFC files being included. 3.1.5 RS485 Networks.
Using the Library with Various Languages 3.2.2 The ActiveX Control and Error Handling. The ActiveX control produces COM (ActiveX) errors (exceptions) if any function fails. These will be trapped by whatever exception handling method is implemented in that language (error handling in Visual Basic is described in more detail in 3.3.1 ) The meaning of the error code can be found as follows: • Mask off the top 16 bits ( or 17 in VB ) as the actual error code is only contained in the lower 16 bits.
Mint v4 PC Programming Guide When using the Active Control, warning messages such as the dialog above ( taken from a Visual Basic application ) may be shown for slow operations such as file download. This is because the application expects the ActiveX operation to finish its operation in a certain time ( the default for Visual Basic is five seconds. ) It should be able to change these timeouts or remove the check completely, the method will be different for each language.
Using the Library with Various Languages AfxOleGetMessageFilter()->EnableNotRespondingDialog( FALSE ); The file will have to include afxole.h 3.3 Visual Basic 6 3.3.1 Error number conversion The error numbers returned in Err after a function call in Visual Basic differ from the constants defined in mil.bas. To convert from an Err code (other than 0) to a MIL error, mask off the top 17 bits by ANDing with &H7FFF and subtract &H200. There is a function called VBErrorToMIL in mil.bas to do this.
Mint v4 PC Programming Guide Figure 3-12: Selection of Mint Component 3. Find ‘Baldor Motion Library XXXX for Mint Build XXXX in the list and check the box. In this example the version 1107 is being used, but you this will have changed by the time this manual is printed. If there is a choice of several versions, choose the most recent, unless you want to target an older version of Mint. Hit ‘OK’ This should have added the icon to the toolbox. 4. Select’Add Module’ from the ‘Project’ tab.
Using the Library with Various Languages 6. In the Form_Load module we will tell the COM server which type of controller we want to communicate with. These means the code will depend on the controller you have. The Consts should be editted to match your system, - MintDrive Private Sub Form_Load() Const NodeNumber = 10 Const CommPort = 1 Const Baudrate = 57600 myController.
Mint v4 PC Programming Guide Figure 3-13: Example Dialog Box 9. Add the following code to trap this (or any other error). Private Sub Command1_Click() Dim bState As Boolean On Error GoTo command1_error '********************************************* ' Read the state of the drive enable for axis 0 '********************************************* myController.
Using the Library with Various Languages 3.4 Borland Delphi 5.0 NOTE: Before any programs, including the examples, can be built, the type library must be imported. See step 2. This section will guide you through creating a simple Delphi application. The application will contain one button which will toggle the state of the drive enable output for axis 0. Note that the axis must already be configured as servo (use the Mint WorkBench to do this). 1. Open Delphi and create a new project. 2.
Mint v4 PC Programming Guide Figure 3-14: Delphi – Installing Mint Component 3. Select the ActiveX tab on the toolbar. The rightmost icon should now be the MintController icon. Click the icon and then click Form1 to create an instance of the control. Examining the properties of the control should show that the name is MintController1. 4. We now have to edit the FormCreate function. Double click on Form1 to open the FormCreate function. The line of code depends on the controller being used.
Using the Library with Various Languages - MintDrive procedure TForm1.FormCreate(Sender: TObject); const NodeNumber = 10; const CommPort = 1; const BaudRate = 57600; begin MintController1.setMintDriveLink( NodeNumber, CommPort, BaudRate, TRUE ); end; - NextMove PC procedure TForm1.FormCreate(Sender: TObject); const NodeNumber = 0; const Address = $23c; begin MintController1.setNextMovePCLink( NodeNumber, Address ); end; - NextMove PCI procedure TForm1.
Mint v4 PC Programming Guide 6. This code should now run. To add an error handler, change the first parameter to setDriveEnable to –1 to create a run time error. This will raise an EOleException error. To trap this error, modify the code as follows. procedure TForm1.Button1Click(Sender: TObject); var wbEnabled : WordBool; begin { Trap errors. All errors will cause program flow to jump to the except } try { Read the current state of the drive enable. } MintController1.
PC Based Motion Control 4. PC Based Motion Control 4 This chapter covers creating motion applications on the host PC. MN1278 05.
Mint v4 PC Programming Guide The Mint Interface Library provides all of the functionality that is available in the Mint programming language. Motion applications can be written on the host PC by calling functions from the Mint Interface Library. When a function is called, the Mint Interface Library communicates with the controller and calls the specified function directly on the controller.
PC Based Motion Control Functions called from the host fall into two categories. Those functions that replicate Mint keywords are known as Mint Motion Library calls (MML) and those functions which are general communications functions are known as Mint Interface Library calls (MIL). Example: The following code is a Visual Basic extract showing a host application set up a move on a NextMove BX. The TMintController object has been added to the form and named ‘myController’.
Mint v4 PC Programming Guide 4.2 Events and Interrupt Control on NextMove PCI The NextMove PCI controller requires a device driver to be installed on the host PC in order for communication to be established between it and the controller. The use of device drivers makes it possible for interrupts from the card to be trapped and handled. The Dual Port RAM interface allows the PC to interrupt the controller and the controller to interrupts the host.
PC Based Motion Control Priority 6 7 8 9 10 11 Event Timer Digital input Comms DPR event Move Buffer Low Axis Idle Note: The reset event is generated if the controller resets, hence this is not generated by the firmware and is consequently not subject to the priority scheme. The NextMove PCI controller will check for a pending event every 2ms. If multiple events occur within a 2ms tick, then the above priority system will be used to decide which event to generate.
Mint v4 PC Programming Guide DPR The install function for DPR events, it accepts a pointer to a function, if this is a NULL pointer the handler is uninstalled. typedef void TDPREventHandler (void *pController, __int16 nCode) __int16 installDPREventHandler (TDPREventHandler *pHandler) Errors The install function for error events, it accepts a pointer to a function, if this is a NULL pointer the handler is uninstalled.
PC Based Motion Control Stop Switch The install function for stop switch events, it accepts a pointer to a function, if this is a NULL pointer the handler is uninstalled. typedef void TStopSwitchEventHandler (void *pController) __int16 installStopSwitchEventHandler (TStopSwitchEventHandler *pHandler) Timer The install function for timer events, it accepts a pointer to a function, if this is a NULL pointer the handler is uninstalled. The parameter passed to the event handler is always zero.
Mint v4 PC Programming Guide // timer event handler void myTimerEventHandler ( void *p, __int16 nTimerEventNumber ) { cout << "Timer Event” << endl; } When a host PC event handler is called, the embedded application running on the controller will continue to execute. 4.2.2 Event Control Functions There are various functions that can be used to control events generation.
PC Based Motion Control 4.2.3 Interrupting the Host from a Mint Program ( DPR Events ) Events can be manually generated in both directions using the function doDPREvent and the DPREvent handler. If the host PC calls doDPREvent, this will generate an interrupt to the controller that will call the DPREvent handler on the controller. If the controller calls the function doDPREvent, this will generate an interrupt to the host PC that will call the DPREvent handler on the host PC.
Mint v4 PC Programming Guide installErrorEventHandler installFastInEventHandler installInputEventHandler installMoveBufferLowEventHandler installSerialReceiveEventHandler installStopSwitchEventHandler installResetEventHandler installTimerEventHandler installUnknownEventHandler The passed parameter is a BOOLEAN parameter. • TRUE indicates that a handler exists on the host PC • FALSE indicates that a handler does not exist on the host PC.
NextMove PCI and Non-Micorsoft Operating Systems 5. NextMove PCI and Non-Microsoft Operating Systems 5 This chapter details how to use the NextMove PCI with operating systems other than Windows NT and Windows 9x. MN1278 05.
Mint v4 PC Programming Guide This Chapter covers implementing an interface to NextMove PCI in under an operating system other than the systems supported by the standard Baldor Motion Toolkit for example QNX, Linux etc. A special version of the CNextMovePCI1 class has been written. This class (called CSimplePCI) provides all the functions required except the actual hardware interface functions, which must be provided by the user. 5.1 How to Recognize the NextMove PCI.
NextMove PCI and Non-Micorsoft Operating Systems 5.3.1 The CMySimplePCI Example. The CMySimplePCI example overloads CSimplePCI to create a class which can be used to communicate with NextMove PCI under Windows 9X and Windows NT using the CSimplePCI interface. It is laid out in such a way that the Windows specific code can easily be replaced with code specific to another operating system. 5.3.2 Functions Required by the Overloaded Class. The CMySimplePCI class declaration is as follows.
Mint v4 PC Programming Guide … … /*================================================================*/ /* END : Replace this */ /*================================================================*/ which show code that is only relevant to the example. This is code that should be replaced with code specific to that operating system. Only code in the files MySimplePCI.h and MySimplePCI.cpp should be modified. Do NOT modify SimplePCI.h and SimplePCI.cpp Constructor. A constructor must be supplied.
NextMove PCI and Non-Micorsoft Operating Systems doDeviceClose This function releases any resources which had been taken by the class. getDeviceOpen This function must report whether the class has control of any resources it requires to communicate with the controller and whether that controller is physically present. In the MySimplePCI example this reports whether it can communicate with device driver.
Mint v4 PC Programming Guide The following files may also be added: • host_def.cpp : if the function getErrorString is being used. • precomp.cpp : if this file is being used to construct the precompiled header. 50 MN1278 05.
Appendix 1: DPR Map 6. Appendix 1: DPR Map Each area of the address map is described below. Where an address is shown, that is the DPR location. Where an address offset is shown, that offset is added to the base address. Floating point numbers will conform to C31 format. It is up to the PC interface to convert 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 the DPR.
Mint v4 PC Programming Guide Address Use 0x600 0x5FF 0x5FF 0x500 0x4FF 0x500 0x4FF 0x480 0x480 0x47F Read Only ICM expansion Reserved for future axes Axis 11 Data Axis 10 Data Axis 9 Data Axis 8 Data 0x460 0x45F 0x440 0x43F 0x420 0x41F Axis Data 0x400 0x3FF Control Registers 0x3FB 0x3FA 0x3F9 0x3F8 0x3F7 0x400 0x3FF 0x3FE 0x3FD 0x3FC 0x3FB 0x3FA 0x3F9 0x3F8 0x3F7 0x29C 0x29B 0x29C 0x29B 0x1D6 0x1D5 0x1D6 0x1D5 Reserved Reserved Scratchpad (Unused) Functionality Code
Appendix 1: DPR Map Address Use 0x130 0x12F 0x130 0x12F 0x110 0x10F 0x110 0x10F Read Only IO Data Axis 7 Data Axis 6 Data Axis 5 Data Axis 4 Data Axis 3 Data Axis 2 Data Axis 1 Data Axis 0 Data Reserved 1ms Timer Tick Axis Configurations (8-11) Axis Configurations (0-7) MINT Error Line MINT Error MINT Status MINT Line Number 2ms Timer Tick Build ID Analog I/O Mix Digital I/O Mix 0x0F0 0x0EF 0x0D0 0x0CF 0x0B0 0x0AF 0x090 0x08F 0x070 0x06
Mint v4 PC Programming Guide Address 0x000 6.2 Use 0x002 0x001 0x000 Read Only Axis Mix DPR Status Register DPR Control Register NextMove PC DPR Map Dual Port RAM on NextMove PC has 1K of 16 bit data.
Appendix 1: DPR Map Address Use Read Only 0x0CF Axis 5 Data Axis 4 Data Axis 3 Data Axis 2 Data Axis 1 Data Axis 0 Data Reserved 1ms Timer Tick Axis Configurations (4-7) Axis Configurations (0-3) MINT Error Line MINT Error MINT Status MINT Line Number 2ms Timer Tick Build ID Analog I/O Mix Digital I/O Mix Axis Mix DPR Status Register DPR Control Register 0x0B0 0x0AF 0x090 0x08F 0x070 0x06F 0x050 0x04F 0x030 0x02F Axis Data 0x010 0x00F Status/Control
Mint v4 PC Programming Guide 6.
Appendix 1: DPR Map DPR Control Register – NextMove PC: Bit 0 1 2 3 4 5 6 7 8 9 10 11-15 Meaning Symbolic Constant Lock DPR contents Lock axis 0 DPR contents Lock axis 1 DPR contents Lock axis 2 DPR contents Lock axis 3 DPR contents Lock axis 4 DPR contents Lock axis 5 DPR contents Lock axis 6 DPR contents Lock axis 7 DPR contents Lock IO data Lock auxiliary axes Reserved btLOCK btLOCK_AXIS_0 btLOCK_AXIS_1 btLOCK_AXIS_2 btLOCK_AXIS_3 btLOCK_AXIS_4 btLOCK_AXIS_5 btLOCK_AXIS_6 btLOCK_AXIS_7 btLOCK_IO_PC
Mint v4 PC Programming Guide MML Build ID: The build identifier of the Mint Motion Library running on NextMove. Each version of the Mint Interface Library can only communicate with 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 number call getAAABuild. Timer Tick: This is a free running 16bit counter that is updated by NextMove once every 2ms and can be used to synchronize data with the DPR.
Appendix 1: DPR Map NextMove PCI: Axis Configurations gives the current configuration of each axis in 4 bits. 31 28 Axis 7 31 28 - 27 24 Axis 6 27 24 23 20 Axis 5 23 - 20 - 19 16 Axis 4 19 16 - 15 12 Axis 3 15 12 Axis 11 11 8 Axis 2 11 8 Axis 10 7 4 3 0 Axis 1 Axis 0 7 3 4 Axis 9 0 Axis 8 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.
Mint v4 PC Programming Guide Offset 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A 0x1B 0x1C 0x1D 0x1E 0x1F Use Symbolic Constant Data Size Measured Position Reserved Measured Velocity Reserved Speed* Reserved Mode of motion Reserved Axis error Following Error Reserved Kprop* Reserved Kvel* Reserved KvelFF* Reserved Kderiv* Reserved Kint* Reserved KintLimit(%)* Reserved Next Mode of motion Reserved DAC value Free Sp
Appendix 1: DPR Map 6.
Mint v4 PC Programming Guide The layout of the section is compatible to the current layout on NextMove PC. The locations used on NextMove PC for the upper 16 bits of data are unused. All data is written every 2ms. 6.6 Comms Array The Comms area simulates protected Comms communications on serial based controllers. The Comms array uses an area of DPR from address 0x1D6 to 0x29A. The data is accessed as: Address Comms Location 0x1D6 0x1D8 0x1DA …..
Appendix 1: DPR Map 6.8 Pseudo Serial Interface The serial interface works by implementing a 64 word circular buffer within DPR. There is one such buffer for the receive buffer and one for the transmit buffer. Head and tail pointers are also located in DPR allowing both sides of DPR to check the status of the buffers.
Mint v4 PC Programming Guide 6.9 Special Functions Registers Address 0x3F8 0x3F9 0x3FA 0x3FB 0x3FC 0x3FD Use Symbolic Constant ICM Handshaking Data associated with events Data associated with events Application Code Register Functionality Code Register Scratchpad Register roICM_HANDSHAKE roINTERRUPT_DATA_1 roINTERRUPT_DATA_2 roAPPLICATION_CODE roFUNCTION_CODE roSCRATCH_PAD The way in which dual port RAM is used may vary from application to application.
Appendix 1: DPR Map Functionality Code Register (3FC) This register describes the capabilities of the software running on NextMove. The register may be used by a host to determine how it should communicate with the software, what data is stored in dual port RAM, etc. The register contains a series of bits each of which indicate whether a specific feature is supported. The table below describes the current list of standard application capabilities. It is expected that this list will grow over time.
Mint v4 PC Programming Guide 6.10 Data Synchronization It may be desirable to prevent NextMove PC and PCI from updating the DPR update area for a period to allow a ‘snap-shot’ of DPR to be taken. The status and control registers provide a mechanism for this. It is supported by the function lockDPR. This function can be used to • request that DPR not be updated by Mint • inform Mint that it can now update MML. Note that locking DPR can take up to two milliseconds to complete.
Appendix 2: Timings 7. Appendix 2: Timings These timings show the time taken to call Immediate Command Mode (ICM) functions from a host. The tests were performed on a 300 MHz Pentium II PC. On both MintDrive and NextMove PCI the timings were the same on Windows 95 and Windows NT. 7.1 Immediate Command Mode Functions Function NextMove PCI Mint NextMove PCI WinNT4 / Win95 MintDrive Mint MintDrive WinNT4 / Win95 getPos setJog setSpeed 0.140ms 0.133ms 0.138ms 0.254 ms 0.182 ms 0.184 ms 0.726ms 0.
Mint v4 PC Programming Guide 68 MN1278 05.
Appendix 3: Symbolic Constants 8. Appendix 3: Symbolic Constants The library functions can return error codes or can be passed parameters for which a number of symbolic constants have been defined in appropriate header files. These values are shown below.
Mint v4 PC Programming Guide 70 Value Symbolic Constant Meaning 1025 erINVALID_HANDLE disabled The handle had not been correctly initialised.
Appendix 3: Symbolic Constants Value Symbolic Constant Meaning 1054 1055 erCONTROLLER_REPORTS_ERROR erUPDATING 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 erRECEIVE_BUFFER_EMPTY erTRANSMIT_BUFFER_FULL erINVALID_RETRIES erBAD_SQUASH_FILE erUNDEFINED_SERIAL_ERROR erPSERIAL_BUFFER_CORRUPTION erFUNCTION_NOT_SUPPORTED erCANNOT_OPEN_FILE erINVALID_FORMAT erDATA_TOO_LONG erINCORRECT_ARRAY_SIZE erUNKNOWN_ERROR_CODE erCONTROLLER_
Mint v4 PC Programming Guide 72 Value Symbolic Constant Meaning 1093 1094 1095 1096 1097 erICM_RX_SIZE_ERROR erICM_PROCESS_TIMEOUT erDEV_DRV_UNKNOWN_IOCTL erBBP_ACK_TIMEOUT erBBP_POLL_TIMEOUT 1098 erBBP_POLL_NO_DATA 1099 erBBP_RX_TIMEOUT 1100 erBBP_UNSUPPORTED_TRANS 1101 1102 erBBP_INVALID_DATA_LENGTH erBBP_VALUE_OUT_OF_RANGE 1103 erBBP_VALUE_OUT_OF_BOUNDS 1104 erBBP_CONTROL_FAULT_COND 1105 erBBP_STATUS_MODE_REJECT 1106 1107 1108 erBBP_BLOCK_REJECTED erBBP_END_OF_BLOCK erIN_BBP_ROUTINE
Appendix 3: Symbolic Constants Value Symbolic Constant Meaning 1119 erSQ_INVALID_OUTPUT_FILE_STRING 1120 erSQ_INVALID_INPUT_FILE_STRING 1121 erSQ_INVALID_PATH_STRING 1122 erSQ_TOO_MANY_BASIC_KEYWORDS 1123 erSQ_TOO_MANY_MOTION_KEYWORDS 1124 erSQ_TOO_MANY_CONSTANTS 1125 erSQ_VARIABLES_NOT_INITIALISED 1126 1127 1128 erCANNOT_WRITE_TO_INTERRUPT erNO_LINK_TO_CONTROLLER erFIRST_ARRAY_ELEMENT_IS_SIZE 1129 1130 erPOS_ARRAY_REQUIRED erARRAY_SIZE_MISMATCH 1131 1132 1133 1134 1135 erPARAMETER_CA
Mint v4 PC Programming Guide updateFirmware Codes (nBootDevice Parameter): Value 0 1 Symbolic Constant Meaning tmFLASH tmRAM Load program to flash memory Load program to RAM updateFirmware Codes (nTarget Parameter): Value 0 1 2 3 4 Symbolic Constant Meaning bdEPROM bdFLASH bdSERIAL bdNV bdDPR Boot from EPROM Boot from flash memory Boot from serial port Boot from NVRAM Boot from Dual Port RAM File Upload/Download Codes (Use with uploadMintFile & downloadMintFile): Value 1 2 3 Symbolic Constant M
Appendix 3: Symbolic Constants Value Symbolic Constant 4 updateDOWNLOADING 5 6 updateRESETTING updateRUNNING MN1278 05.2001 Meaning Downloading the firmware: use the percentage parameter.
Mint v4 PC Programming Guide 76 MN1278 05.
Bibliography 9. Bibliography 6 Bibliography [1] Mint v4 Programming Guide [MN1262] [2] Mint v4 Advanced Programming Guide [MN1270] [3] Mint v4 PC Programming Guide [MN1278] [4] Mint v4 CAN Programming Guide [MN1282] [5] Mint v4 Function Reference Guide [MN1280] All manuals can be found on the Baldor Motion Toolkit CD-ROM. MN1278 05.
Mint v4 PC Programming Guide 78 MN1278 05.