Yokogawa MX100 User Manual

User’s Manual
Model MX190 API for the MX100/DARWIN
Yokogawa Electric Corporation
IM MX190-01E
3rd Edition

Foreword

Notes
Thank you for purchasing the API for the MX100/DARWIN. This user’s manual explains the operating procedures of the API for the MX100/DARWIN. To ensure correct use, please read this manual thoroughly before beginning operation. After reading the manual, keep it in a convenient location for quick reference whenever a question arises during operation.
• The contents of this manual are subject to change without prior notice as a result of continuing improvements to the instrument’s performance and functions.
• Every effort has been made in the preparation of this manual to ensure the accuracy of its contents. However, should you have any questions or find any errors, please contact your nearest YOKOGAWA representative, dealer, or sales office.
• Copying or reproducing all or any part of the contents of this manual without the permission of Yokogawa Electric Corporation is strictly prohibited.
• Use of this software on more than one computer at the same time is prohibited. Use by more than one user is also prohibited.
• Transfer or lending of this software to any third party is prohibited.
• Yokogawa Electric Corporation provides no guarantees other than for physical deficiencies found on the original disk upon opening the product package.
• Yokogawa Electric Corporation shall not be held responsible by any party for any losses or damage, direct or indirect, caused by the use or any unpredictable defect of the product.
• Please do not lose your serial number as it cannot be reissued.
• Serial numbers will not be reissued. Please keep your serial numbers in a safe place.
Overview of Functions
Trademarks
Revisions
• vigilantplant and DAQMASTER are registered trademarks of Yokogawa Electric Corporation.
• Microsoft and Windows are registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
• Adobe and Acrobat are registered trademarks or trademarks of Adobe Systems Incorporated.
• Company and product names that appear in this manual are registered trademarks or trademarks of their respective holders.
• The company and product names used in this manual are not accompanied by the registered trademark or trademark symbols (® and ™).
1st Edition: May, 2003 2nd Edition: November, 2004 3rd Edition: March, 2008
3rd Edition :March 2008 (YK) All Rights Reserved, Copyright © 2003 Yokogawa Electric Corporation
i

Terms and Conditions of the Software License

NOTICE - PLEASE READ CAREFULLY BEFORE USE
Thank you very much for purchasing this medium containing a software program and related documentation provided by Yokogawa Electric Corporation (hereinafter called “Yokogawa”), and the program contained, embedded, inserted or used in the medium (hereinafter called the “Yokogawa Software Program”).
By opening this package or plastic wrapping (hereinafter called “Package”) enclosing the Yokogawa Software Program, you acknowledge that you understand and agree to the “Terms and Conditions of the Software License” (hereinafter called “Terms and Conditions”) which is written in the documentation and separately attached. Accordingly, the Terms and Conditions bind you.
The Yokogawa Software Program and its related documentation including ownership of copyright shall remain the exclusive property of Yokogawa or those third parties from whom sublicensed software in the Yokogawa Software Program is licensed.
Yokogawa hereby grants you permission to use the Yokogawa Software Program on the conditions that you agree to the Terms and Conditions before you open the Package and/or install it in or onto a computer.
IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS, YOU CANNOT OPEN THE PACKAGE, AND MUST IMMEDIATELY RETURN IT TO YOKOGAWA OR ITS DESIGNATED PARTY.
Terms and Conditions of the Software License
Yokogawa Electric Corporation, a Japanese corporation (hereinafter called “Yokogawa”), grants permission to use this Yokogawa Software Program (hereinafter called the “Licensed Software”) to the Licensee on the conditions that the Licensee agrees to the terms and conditions stipulated in Article 1 hereof. You, as the Licensee (hereinafter called “Licensee”), shall agree to the following terms and conditions for the software license (hereinafter called the “Agreement”) based on the use intended for the Licensed Software. Please note that Yokogawa grants the Licensee permission to use the Licensed Software under the terms and conditions herein and in no event shall Yokogawa intend to sell or transfer the Licensed Software to the Licensee. Licensed Software Name: API for the MX100/DARWIN Number of License: 1
Article 1 (Scope Covered by these Terms and Conditions)
1.1 The terms and conditions stipulated herein shall be applied to any Licensee who purchases the Licensed Software on the condition that the Licensee consents to agree to the terms and conditions stipulated herein.
1.2 The “Licensed Software” herein shall mean and include all applicable programs and documentation, without limitation, all proprietary technology, algorithms, and know-how such as a factor, invariant or process contained therein.
Article 2 (Grant of License)
2.1 Yokogawa grants the Licensee, for the purpose of single use, non-exclusive and non-transferable license of the Licensed Software with the license fee separately agreed upon by both parties.
2.2 The Licensee is, unless otherwise agreed in writing by Yokogawa, not entitled to copy, change, sell, distribute, transfer, or sublicense the Licensed Software.
2.3 The Licensed Software shall not be copied in whole or in part except for keeping one (1) copy for back-up purposes. The Licensee shall secure or supervise the copy of the Licensed Software by the Licensee itself with great, strict, and due care.
2.4 In no event shall the Licensee dump, reverse assemble, reverse compile, or reverse engineer the Licensed Software so that the Licensee may translate the Licensed Software into other programs or change it into a man-readable form from the source code of the Licensed Software. Unless otherwise separately agreed by Yokogawa, Yokogawa shall not provide the Licensee the source code for the Licensed Software.
2.5 The Licensed Software and its related documentation shall be the proprietary property or trade secret of Yokogawa or a third party which grants Yokogawa the rights. In no event shall the Licensee be transferred, leased, sublicensed, or assigned any rights relating to the Licensed Software.
2.6 Yokogawa may use or add copy protection in or onto the Licensed Software. In no event shall the Licensee remove or attempt to remove such copy protection.
2.7 The Licensed Software may include a software program licensed for re-use by a third party (hereinafter called “Third Party Software”, which may include any software program from affiliates of Yokogawa made or coded by themselves.) In the case that Yokogawa is granted permission to sublicense to third parties by any licensors (sub-licensor) of the Third Party Software pursuant to different terms and conditions than those stipulated in this Agreement, the Licensee shall observe such terms and conditions of which Yokogawa notifies the Licensee in writing separately.
2.8 In no event shall the Licensee modify, remove or delete a copyright notice of Yokogawa and its licenser contained in the Licensed Software, including any copy thereof.
Article 3 (Restriction of Specific Use)
3.1 The Licensed Software shall not be intended specifically to be designed, developed, constructed, manufactured, distributed or maintained for the purpose of the following events: a) Operation of any aviation, vessel, or support of those operations from the ground;, b) Operation of nuclear products and/or facilities;, c) Operation of nuclear weapons and/or chemical weapons and/or biological weapons; or d) Operation of medical instrumentation directly utilized for humankind or the human body.
3.2 Even if the Licensee uses the Licensed Software for the purposes in the preceding Paragraph 3.1, Yokogawa has no liability to or responsibility for any demand or damage arising out of the use or operations of the Licensed Software, and the Licensee agrees, on its own responsibility, to solve and settle the claims and damages and to defend, indemnify or hold Yokogawa totally harmless, from or against any liabilities, losses, damages and expenses (including fees for recalling the Products and reasonable attorney’s fees and court costs), or claims arising out of and related to the above-said claims and damages.
Article 4 (Warranty)
4.1 The Licensee shall agree that the Licensed Software shall be provided to the Licensee on an “as is” basis when delivered. If defect(s), such as damage to the medium of the Licensed Software, attributable to Yokogawa is found, Yokogawa agrees to replace, free of charge, any Licensed Software on condition that the defective Licensed Software shall be returned to Yokogawa’s specified authorized service facility within seven (7) days after opening the Package at the Licensee’s expense. As the Licensed Software is provided to the Licensee on an “as is” basis when delivered, in no event shall Yokogawa warrant that any information on or in the Licensed Software, including without limitation, data on computer programs and program listings, be completely accurate, correct, reliable, or the most updated.
4.2 Notwithstanding the preceding Paragraph 4.1, when third party software is included in the Licensed Software, the warranty period and terms and conditions that apply shall be those established by the provider of the third party software.
ii IM MX190-01E
Terms and Conditions of the Software License
4.3 When Yokogawa decides in its own judgement that it is necessary, Yokogawa may from time to time provide the Licensee with Revision
upgrades and Version upgrades separately specified by Yokogawa (hereinafter called “Updates”).
4.4 Notwithstanding the preceding Paragraph 4.3, in no event shall Yokogawa provide Updates where the Licensee or any third party conducted
renovation or improvement of the Licensed Software.
4.5 THE FOREGOING WARRANTIES ARE EXCLUSIVE AND IN LIEU OF ALL OTHER WARRANTIES OF QUALITY AND PERFORMANCE,
WRITTEN, ORAL, OR IMPLIED, AND ALL OTHER WARRANTIES INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED BY YOKOGAWA AND ALL THIRD PARTIES LICENSING THIRD PARTY SOFTWARE TO YOKOGAWA.
4.6 Correction of nonconformity in the manner and for the period of time provided above shall be the Licensee’s sole and exclusive remedy for
any failure of Yokogawa to comply with its obligations and shall constitute fulfillment of all liabilities of Yokogawa and any third party licensing the Third Party Software to Yokogawa (including any liability for direct, indirect, special, incidental or consequential damages) whether in warranty, contract, tort (including negligence but excluding willful conduct or gross negligence by Yokogawa) or otherwise with respect to or arising out of the use of the Licensed Software.
Article 5 (Infringement)
5.1 If and when any third party should demand injunction, initiate a law suit, or demand compensation for damages against the Licensee under
patent right (including utility model right, design patent, and trade mark), copy right, and any other rights relating to any of the Licensed Software, the Licensee shall notify Yokogawa in writing to that effect without delay.
5.2 In the case of the preceding Paragraph 5.1, the Licensee shall assign to Yokogawa all of the rights to defend the Licensee and to negotiate
with the claiming party. Furthermore, the Licensee shall provide Yokogawa with necessary information or any other assistance for Yokogawa’s defense and negotiation. If and when such a claim should be attributable to Yokogawa, subject to the written notice to Yokogawa stated in the preceding Paragraph 5.1, Yokogawa shall defend the Licensee and negotiate with the claiming party at Yokogawa’s cost and expense and be responsible for the final settlement or judgment granted to the claiming party in the preceding Paragraph 5.1.
5.3 When any assertion or allegation of the infringement of the third party’s rights defined in Paragraph 5.1 is made, or when at Yokogawa’s
judgment there is possibility of such assertion or allegation, Yokogawa will, at its own discretion, take any of the following countermeasures at Yokogawa’s cost and expense. a) To acquire the necessary right from a third party which has lawful ownership of the right so that the Licensee will be able to continue to use
the Licensed Software; b) To replace the Licensed Software with an alternative one which avoids the infringement; or c) To remodel the Licensed Software so that the Licensed Software can avoid the infringement of such third party’s right.
5.4 If and when Yokogawa fails to take either of the countermeasures as set forth in the preceding subparagraphs of Paragraph 5.3, Yokogawa shall indemnify the Licensee only by paying back the price amount of the Licensed Software which Yokogawa has received from the Licensee. THE FOREGOING PARAGRAPHS STATE THE ENTIRE LIABILITY OF YOKOGAWA AND ANY THIRD PARTY LICENSING THIRD PARTY SOFTWARE TO YOKOGAWA WITH RESPECT TO INFRINGEMENT OF THE INTELLECTUAL PROPERTY RIGHTS INCLUDING BUT NOT LIMITED TO, PATENT AND COPYRIGHT.
Article 6 (Liabilities)
6.1 If and when the Licensee should incur any damage relating to or arising out of the Licensed Software or service that Yokogawa has provided to the Licensee under the conditions herein due to a reason attributable to Yokogawa, Yokogawa shall take actions in accordance with this Agreement. However, in no event shall Yokogawa be liable or responsible for any special, incidental, consequential and/or indirect damage, whether in contract, warranty, tort, negligence, strict liability, or otherwise, including, without limitation, loss of operational profit or revenue, loss of use of the Licensed Software, or any associated products or equipment, cost of capital, loss or cost of interruption of the Licensee’s business, substitute equipment, facilities or services, downtime costs, delays, and loss of business information, or claims of customers of Licensee or other third parties for such or other damages. Even if Yokogawa is liable or responsible for the damages attributable to Yokogawa and to the extent of this Article 6, Yokogawa’s liability for the Licensee’s damage shall not exceed the price amount of the Licensed Software or service fee which Yokogawa has received. Please note that Yokogawa shall be released or discharged from part or all of the liability under this Agreement if the Licensee modifies, remodels, combines with other software or products, or causes any deviation from the basic specifications or functional specifications, without Yokogawa’s prior written consent.
6.2 All causes of action against Yokogawa arising out of or relating to this Agreement or the performance or breach hereof shall expire unless Yokogawa is notified of the claim within one (1) year of its occurrence.
6.3 In no event, regardless of cause, shall Yokogawa assume responsibility for or be liable for penalties or penalty clauses in any contracts between the Licensee and its customers.
Article 7 (Limit of Export)
Unless otherwise agreed by Yokogawa, the Licensee shall not directly or indirectly export or transfer the Licensed Software to any countries other than those where Yokogawa permits export in advance.
Article 8 (Term)
This Agreement shall become effective on the date when the Licensee receives the Licensed Software and continues in effect unless or until terminated as provided herein, or the Licensee ceases using the Licensed Software by itself or with Yokogawa’s thirty (30) days prior written notice to the Licensee.
Article 9 (Injunction for Use)
During the term of this Agreement, Yokogawa may, at its own discretion, demand injunction against the Licensee in case that Yokogawa deems that the Licensed Software is used improperly or under severer environments other than those where Yokogawa has first approved, or any other condition which Yokogawa may not permit.
Article 10 (Termination)
Yokogawa, at its sole discretion, may terminate this Agreement without any notice or reminder to the Licensee if the Licensee violates or fails to perform this Agreement. However, Articles 5, 6, and 11 shall survive even after the termination.
Article 11 (Jurisdiction)
Any dispute, controversies, or differences between the parties hereto as to interpretation or execution of this Agreement shall be resolved amicably through negotiation between the parties upon the basis of mutual trust. Should the parties fail to agree within ninety (90) days after notice from one of the parties to the other, both parties hereby irrevocably submit to the exclusive jurisdiction of the Tokyo District Court (main office) in Japan for settlement of the dispute.
Article 12 (Governing Law)
This Agreement shall be governed by and construed in accordance with the laws of Japan. The Licensee expressly agrees to waive absolutely and irrevocably and to the fullest extent permissible under applicable law any rights against the laws of Japan which it may have pursuant to the Licensee’s local law.
Article 13 (Severability)
In the event that any provision hereof is declared or found to be illegal by any court or tribunal of competent jurisdiction, such provision shall be null and void with respect to the jurisdiction of that court or tribunal and all the remaining provisions hereof shall remain in full force and effect.
iii

Checking the Contents of the Package

e
Unpack the box and check the contents before operating the software. If some of the contents are not correct, or if any items are missing or damaged, contact the dealer from whom you purchased them.
Model
Model Name
MX190 API for the MX100/DARWIN
Package Contents
CD-ROM 1 piece
API for the MX100/DARWIN
CD-ROM 1 piec
User's Manual
iv IM MX190-01E

Handling Precautions of the CD-ROM

Make sure to observe the precautions below.
WARNING
• Do not use or store the CD-ROM in a place with excessive dirt or dust.
• Do not touch the non-printed side of the CD-ROM.
Oil and sweat from the fingertips sticking to the surface can cause malfunctions. Do not write on the CD-ROM.
• Lead from pencils and residue from erasers sticking to the surface can also cause malfunction.
• Do not bend or scratch the CD-ROM.
Doing so will make the CD-ROM unreadable.
• Do not place objects on the CD-ROM.
Doing so can deform the CD-ROM and make it unusable.
• Do not drop from high places.
Dropping the CD-ROM can make it unusable due to breakage or deformation.
• Keep away from direct sunlight and any heating equipment.
Never use solvents such as alcohol, thinner, and Freon to clean the CD-ROM.
• Insert the CD-ROM into the CD-ROM drive with care.
• Do not eject the CD-ROM, or turn OFF or reset the PC while the CD-ROM is being accessed.
• Store the CD-ROM in its storage case.
Do not leave the CD-ROM in the CD-ROM drive after use. Leaving the CD-ROM out of the storage case can cause it to become dirty or deformed.
Overview of Functions
v

How to Use This Manual

Structure of this Manual
This user’s manual consists of the following twenty-six chapters, appendix, and index.
ChTitle Description
1 Before Using the Software Gives an overview of the API for the MX100/DARWIN.
2 API for MX100 - Visual C++ - Describes how to apply the API to the MX100 using Visual
3 API for MX100 - Visual C - Describes how to apply the API to the MX100 using Visual
4 API for MX100 - Visual Basic - Describes how to apply the API to the MX100 using Visual
5 Functions for the MX100 API Describes the details of the MX100 functions that can be
- Visual C/Visual Basic - used by Visual C and Visual Basic.
6 MX100 API Constants and Describes the details of the constants and types for
Types the MX100 that can be used by Visual C++, Visual C, and
7 API for DARWIN Describes how to apply the API to DARWIN using Visual
- Visual C++ - C++. Describes the functions, program examples, and the
8 API for DARWIN Describes how to apply the API to DARWIN using Visual C.
- Visual C - Describes the functions and program examples.
9 API for DARWIN Describes how to apply the API to the DARWIN using Visual
-Visual Basic - Basic. Describes the functions and program examples.
10 Functions for the DARWIN API Describes the details of the DARWIN functions that can be
- Visual C/Visual Basic - used by Visual C and Visual Basic.
11 DARWIN Constants and Types Describes the details of the constants and types for
12 MX100 for Extended API Describes how to apply the extended API to the MX100
- Visual C++ - using Visual C++. Describes the functions, program
13 MX100 for Extended API Describes how to apply the extended API to the MX100
- Visual C - using Visual C. Describes the functions and program
14 MX100 for Extended API Describes how to apply the extended API to the MX100
- Visual Basic - using Visual Basic. Describes the functions and program
15 MX100 for ExtendedAPI Describes how to apply the extended API to the MX100
- Visual Basic.NET - using Visual Basic.NET. Describes the functions and
16 MX100 for Extension API Describes how to apply the extendedAPI to the MX100
- Visual C# - using Visual C#. Describes the functions and program
17 Functions for the MX100 Describes the details of the MX100 functions that can be
(Extended API) used by Visual C, Visual Basic, and Visual Basic.NET/C#.
- Visual C/Visual Basic/ Visual Basic.NET/C# -
Describes the PC requirements needed to run the software, the installation procedures, and other information.
C++. Describes the functions, program examples, and the details of the classes.
C. Describes the functions and program examples.
Basic. Describes the functions and program examples.
Visual Basic.
details of the classes.
DARWIN that can be used by Visual C++, Visual C, and Visual Basic.
examples, and the details of the classes.
examples.
examples.
program examples.
examples.
vi IM MX190-01E
How to Use This Manual
ChTitle Description
18 MX100 Constants and Types Describes the details of the constants and types for the for
Extended API MX100 that can be used by Visual C++, Visual C, Visual
- Visual Basic - Basic, and Visual Basic.NET/C#.
19 DARWIN for Extended API Describes how to apply the extended API to DARWIN using
- Visual C++ - Visual C++. Describes the functions and program examples.
20 DARWIN for Extended API Describes how to apply the extended API to DARWIN using
- Visual C - Visual C. Describes the functions and program examples.
21 DARWIN for Extended API Describes how to apply the extended API to DARWIN using
- Visual Basic - Visual Basic. Describes the functions and program
examples.
22 DARWIN for Extended API Describes how to apply the extended API to DARWIN using
- Visual Basic.NET - Visual Basic.NET. Describes the functions and program
examples.
23 DARWIN for Extended API Describes how to apply the extended API to DARWIN using
- Visual C# - Visual C#. Describes the functions and program examples.
24 DARWIN for Extended API Describes the details of the DARWIN functions that can be
- Visual C/Visual Basic/ used by Visual C, Visual Basic, Visual Basic.NET/C#. Visual Basic.NET/C# -
25 DARWIN for Extended API Describes the details of the constants and types for
Constants and Types DARWIN that can be used by Visual C++, Visual C, Visual
Basic, and Visual Basic.NET/C#. 26 Error messages Lists and explains error messages. Appendix Describes the terminology used by this software and the
terminology for the MX100/DARWIN. Index An alphabetical index of the contents of the manual.
Overview of Functions
Scope of the Manual
OS
This manual does not cover the basic operations of Windows. For information regarding the basic operations of Windows, see the user’s guide that came with Windows. Also, this manual does not cover the Visual Studio environment or languages supported. See the relevant user’s manual for information on those topics.
MX100/DARWIN
Describes only the terminology used by the API. For details on the MX100 and DARWIN, see the relevant user’s manuals.
Manual Revision History
Revision Description
2 Supports API R2.01 3 Supports API R3.01
vii

Sample Programs

• This manual contains sample programs for each programming language.
• The sample programs can be downloaded from the Web site below. http://www.yokogawa.com/ns/daq/mx100/daq-mx100_01.htm
* You can access the Web site by clicking the Up-to-Date Information button on the startup
screen of the user's manual CD-ROM and then moving on to MX100 PC-Based Data Acquisition Unit.
* URL is subject to change.
When you have accessed the Web site, click Software Download and then search for the sample program in the screen that appears. keyword:sample program product category:Data Acquisition Equipment
viii IM MX190-01E

Format Used in This Manual

Explanation of Description of Functions
The functions are explained using the following format. This format is also applied to the description of the function members of the classes.
The name of the function.
Syntax for Visual C++ or Visual C.
autoFIFOMX
Syntax
int autoFIFOMX(DAQMX daqmx, int bAuto);
Declaration
Public Declare Function autoFIFOMX Lib "DAQMX" (ByVal daqmx As Long, ByVal bAuto As Long) As Long
Parameters
daqmx bAuto
Specify the device descriptor. Specify the valid/invalid value.
Description
Sets auto control of the FIFO.
Return value
Returns an error number. Error:
Not descriptor
No device descriptor.
Reference
CDAQMX::autoFIFO
Error that this function generates.
Declaration statement for Visual Basic.
Description of the parameters.
Describes the functionality of the function and gives notes.
Description of the return value
(
see "Return value" below
Overview of Functions
).
Functions that are called when this function is executed (see "Reference" below).
Return Value (Error Numbers)
There are three types of errors: errors generated by the function itself, errors caused by other component functions upon execution of the main function, and communication errors. The errors generated by the function itself are listed in the ìError:”section. The errors generated by one of the component functions that is called when the
main function is executed are described in the explanation of those functions
which are listed under ìReference.”Communication Errors Communication execution errors generated when communication is performed using the communication descriptor. A communication error is any error between error numbers 0 and 3. For a description of error numbers and corrective actions, see section 12.1, ìAPI Error Messages.”
ix
Format Used in This Manual
Reference
A function consists of multiple, simpler functions. The Reference section lists the functions that make up a given function. This information can be used to understand the action of the function and/or troubleshoot errors. Functions for Visual C and Visual Basic are executed by calling the Visual C++ class instance. Therefore, the Reference section lists the class name and the member function name and/or the function name. The names are listed in alphabetical order.
Program Description
Sample programs are printed in this manual in monospaced font. Note the following.
• Due to the limitation of the width of a page, a long statement is written across multiple lines.
Terminology Reference
The terminology for the API and the terminology for the MX100 and DARWIN are described in the appendix.
Miscellaneous
Units
K Denotes 1024.Example: 100 KB M Denotes 1024 K. Example: 10 MB
Symbols
Note
Calls attention to information that is important for proper operation of the software.
x IM MX190-01E

CONTENTS

Foreword ......................................................................................................................................... i
Terms and Conditions of the Software License ...............................................................................ii
Checking the Contents of the Package ..........................................................................................iv
Handling Precautions of the CD-ROM ........................................................................................... v
How to Use This Manual ................................................................................................................vi
Sample Programs......................................................................................................................... viii
Format Used in This Manual ..........................................................................................................ix
Chapter 1 Before Using the API
1.1 Introduction to Functions .................................................................................................. 1-1
1.2 Software Components and Features ............................................................................... 1-4
1.3 Operating Environment .................................................................................................... 1-6
1.4 Installation ........................................................................................................................ 1-8
API (Chapter 2—Chapter 11)
Chapter 2 MX100 - Visual C++ -
2.1 MX100 Class .................................................................................................................... 2-1
2.2 Correspondence between the Functions and Class/Member Functions - MX100 - ......... 2-4
2.3 Programming - MX100/Visual C++ - ................................................................................ 2-9
2.4 Details of the MX100/DARWIN Common Class ............................................................ 2-15
2.5 Details of the MX100 Class ............................................................................................ 2-37
Chapter 3 MX100 - Visual C -
3.1 Functions and Their Functionalities - MX100/Visual C - .................................................. 3-1
3.2 Program - MX100/Visual C - ............................................................................................ 3-6
Chapter 4 MX100 - Visual Basic -
4.1 Functions and Their Functionalities - MX100/Visual Basic - ............................................ 4-1
4.2 Programming - MX100/Visual Basic - .............................................................................. 4-6
Chapter 5 Functions for the MX100 (Visual C/Visual Basic)
5.1 Details of Functions - MX100 (Visual C/Visual Basic) - ................................................... 5-1
Chapter 6 MX100 Constants and Types
6.1 Overview of the MX100 Constants .................................................................................. 6-1
6.2 MX100 Constants ............................................................................................................ 6-3
6.3 MX100 Setting Item Numbers ........................................................................................ 6-16
6.4 Overview of the MX100 Types ....................................................................................... 6-23
6.5 MX100 Types ................................................................................................................. 6-25
Chapter 7 DARWIN - Visual C++ -
7.1 DARWIN Class ................................................................................................................ 7-1
7.2 Correspondence between the Functions and Class/Member Functions - DARWIN - ..... 7-2
7.3 Programming - DARWIN/Visual C ++ - ............................................................................ 7-5
7.4 Details of the DARWIN Class ........................................................................................ 7-13
xi
Contents
Chapter 8 DARWIN - Visual C -
8.1 Functions and Their Functionalities - DARWIN/Visual C - ............................................... 8-1
8.2 Programming - DARWIN/Visual C - ................................................................................. 8-4
Chapter 9 DARWIN - Visual Basic -
9.1 Functions and Their Functionalities - DARWIN/Visual Basic - ......................................... 9-1
9.2 Programming - DARWIN/Visual Basic - ........................................................................... 9-4
Chapter 10 Functions for the DARWIN - Visual C/Visual Basic -
10.1 Details of Functions - DARWIN (Visual C/Visual Basic) - .............................................. 10-1
Chapter 11 DARWIN Constants and Types
11.1 Overview of the DARWIN Constants ............................................................................. 11-1
11.2 DARWIN Constants ....................................................................................................... 11-2
11.3 Overview of the DARWIN Types .................................................................................. 11-10
11.4 DARWIN Types ............................................................................................................ 11-11
Extended API (Chapter 12—Chapter 25)
Chapter 12 MX100 for Extended API - Visual C++ -
12.1 MX100 Class.................................................................................................................. 12-1
12.2 Correspondence between the Functions and Class/Member Functions - MX100 -....... 12-3
12.3 Programming - MX100/Visual C++ - ............................................................................ 12-15
12.4 Details of the MX100 Class .......................................................................................... 12-20
Chapter 13 MX100 for Extended API - Visual C -
13.1 Functions and Their Functionalities - MX100/Visual C - ................................................ 13-1
13.2 Programming - MX100/Visual C - ................................................................................ 13-12
Chapter 14 MX100 for Extended API - Visual Basic -
14.1 Functions and Their Functionalities - MX100/Visual Basic - .......................................... 14-1
14.2 Programming - MX100/Visual Basic - .......................................................................... 14-12
Chapter 15 MX100 for Extended API - Visual Basic.NET -
15.1 Functions and Their Functionalities - MX100/Visual Basic.NET -.................................. 15-1
15.2 Programming - MX100/Visual Basic.NET - .................................................................. 15-12
Chapter 16 MX100 for Extended API - C# -
16.1 Functions and Their Functionalities - MX100/C# - ......................................................... 16-1
16.2 Programming - MX100/C# - ......................................................................................... 16-12
Chapter 17 Functions for the MX100 (Extended API) - Visual C/Visual Basic/
Visual Basic.NET/C# -
17.1 Details of Function - MX00 (Visual C/Visual Basic/Visual Basic.NET/C#)
- Status Transition Functions ......................................................................................... 17-1
17.2 Details of Function - MX00 (Visual C/Visual Basic/Visual Basic.NET/C#)
- Retrieval Functions .................................................................................................... 17-91
xii IM MX190-01E
Chapter 18 MX100 Constants and Types for Extended API - Visual Basic -
18.1 Overview of the MX100 Constants ................................................................................ 18-1
18.2 MX100 Constants .......................................................................................................... 18-3
18.3 MX100 Setting Item Numbers ...................................................................................... 18-19
18.4 MX100 Types ............................................................................................................... 18-20
Chapter 19 DARWIN for Extended API - Visual C++ -
19.1 DARWIN Class .............................................................................................................. 19-1
19.2 Correspondence between the Functions and Class/Member Functions - DARWIN - ... 19-2
19.3 Programming - DARWIN/Visual C++ - ........................................................................... 19-7
19.4 Functions and Class Members for Loading Instantaneous Value Data ....................... 19-10
19.5 Program for Loading Instantaneous Value Data - DARWIN/Visual C++ - .................... 19-13
19.6 Details of the DARWIN Class ...................................................................................... 19-16
Chapter 20 DARWIN for Extended API - Visual C -
20.1 Functions and Their Functionalities - DARWIN/Visual C - ............................................. 20-1
20.2 Programming - DARWIN/Visual C - ............................................................................... 20-6
20.3 Correspondence between Functions for Instantaneouce Value Data Loading
and Functions - DARWIN/Visual C - .............................................................................. 20-9
20.4 Program for Loading Instantaneous Value Data - DARWIN/Visual C - ........................ 20-11
Contents
Chapter 21 DARWIN for Extended API - Visual Basic -
21.1 Correspondence between the Functions and Class/Member Functions
- DARWIN/Visual Basic -................................................................................................ 21-1
21.2 Programming - DARWIN/Visual Basic - ......................................................................... 21-6
21.3 Correspondence between Functions for Instantaneous Value Data Loading
and Member Functions - DARWIN/Visual Basic -......................................................... 21-8
21.4 Program for Loading Instantaneous Value Data - DARWIN/Visual Basic - .................. 21-10
Chapter 22 DARWIN for Extended API - Visual Basic.NET -
22.1 Functions and Their Functionalities - DARWIN/Visual Basic.NET -............................... 22-1
22.2 Programming - DARWIN/Visual Basic.NET -................................................................. 22-6
22.3 Correspondence between Functions for Instantaneous Value Data Loading
and Functions - DARWIN/Visual Basic.NET -............................................................... 22-8
22.4 Program for Loading Instantaneous Value Data -DARWIN/Visual Basic.NET-............ 22-10
Chapter 23 DARWIN for Extended API - C# -
23.1 Functions and Their Functionalities - DARWIN/C# -...................................................... 23-1
23.2 Programming - DARWIN/C# - ........................................................................................ 23-6
23.3 Correspondence between Functions and Instantaneous Value Data Loading Functions
- DARWIN/VIsual C# - ................................................................................................... 23-9
23.4 Program for Loading Instantaneous Value Data -DARWIN/C#- ................................... 23-11
xiii
Contents
Chapter 24 DARWIN for Extended API
- Visual C/Visual Basic/Visual Basic.NET/C# -
24.1 Details of Functions - DARWIN (Visual C/Visual Basic/Visual Basic.NET/C#)
- Status Transition Functions ......................................................................................... 24-1
24.2 Details of Functions - DARWIN (Visual C/Visual Basic/Visual Basic.NET/C#)
- Retrieval Functions .................................................................................................... 24-38
24.3 Details of Functions for Instantaneous Value Loading - DARWIN (Visual C/Visual Basic/
Visual Basic.NET/C#) - Status Transition Functions .................................................... 24-73
24.4 Details of Instantaneous Value Loading Functions - DARWIN (Visual C/Visual Basic/
Visual Basic.NET/C#) - Status Transition Functions .................................................... 24-80
Chapter 25 DARWIN for Extended API Constants and Types
25.1 Overview of the DARWIN Constants ............................................................................. 25-1
25.2 DARWIN Constants ....................................................................................................... 25-2
25.3 DARWIN Types ............................................................................................................ 25-14
25.4 Overview of DARWIN Constants for Loading Instantaneous Value Data .................... 25-15
25.5 DARWIN Constants for Loading Instantaneous Value Data ........................................ 25-16
25.6 DARWIN Types for Loading Instantaneous Value Data ............................................... 25-20
API and Extended API
Chapter 26 Error Messages
26.1 API Error Messages ....................................................................................................... 26-1
26.2 MX100 - Specific Error Messages - ............................................................................... 26-3
Appendix
Appendix 1 MX100 Terminology .............................................................................................. App-1
Appendix 2 DARWIN Terminology ........................................................................................App-13
Appendix 3 Calculation of the MX100 Timeout Value ...........................................................App-19
Appendix 4 API Revision History (R2.01).............................................................................. App-20
Appendix 5 API Revision History (R3.01).............................................................................. App-26
Index
xiv IM MX190-01E

Chapter 1 Before Using the API

1.1 Introduction to Functions

Supported Models
This software provides the API (Application Programming Interface) that supports the MX100 and DARWIN, and the extension API that makes the main API easier to use. MX100: All models DARWIN: All models (DA, DC, and DR). However, the Ethernet communication
function (Ethernet module) is required.
Supported Languages
Languages supported by the API: Visual C++, Visual C, and Visual Basic Languages supported by the extension API:
Visual C++, Visual C, Visual Basic, Visual Basic.NET, and Visual C#
Functions for the MX100
Communication Functions
1
Before Using the API
Functions used to communicate with the MX100 via the Ethernet interface.
Setup Functions
For configuring the MX100, modules, and channels. However, CAN Bus Module hardware settings are not supported. For hardware settings, use the software that came with the module.
Data Retrieval Functions
• Retrieval of measured data using FIFO Retrieves the most recently measured data via the FIFO (first-in first-out) buffer. Also retrieves instantaneous values. The retrieval interval of instantaneous values is 100 ms or more.
• Retrieval of measured data by channel Retrieves the most recent measured data of the specified channel. Also retrieves instantaneous values. The retrieval interval of instantaneous values is 100 ms or more.
• Retrieval of setup data Retrieves the system configuration of the MX100, network information such as the IP address, and setup data related to channels.
• Collective retrieval of DO (digital output) data Collectively retrieves the ON/OFF status of the DO.
• Retrieval of channel information data (channel number, etc.)
• Retrieval of AO/PWM data Retrieves data that shows the AO/PWM channel output.
1-1
1.1 Introduction to Functions
• Retrieval of transmission output data Data that indicates the AO/PWM channel transmission status. When data is retrieved, it indicates the status of the current transmission output. When data is sent, it is the specification that controls the start and stop of the transmission output.
Control Functions
• Date/time setting
• Setting of the backup function that saves the measured data to the CF card, and formatting of the CF card
• Initialization and reconfiguration of the system (unit)
• Resetting of alarms (acknowledge alarm)
• Designation of the information displayed on the 7-segment LED
Utilities
Provides functions for converting measured values into character strings, retrieving error message strings, and other utility functions.
Functions for DARWIN
The API provides functions that are equivalent to the DARWIN communication functions. Some of the basic functions of the DARWIN communication functions are provided as API classes (for Visual C++) or functions (for Visual Basic, Visual C, Visual Basic.NET, and C#). Other functions can be implemented using the commands of the DARWIN communication function.
Functions Provided by this Software
• Communication Functions
Functions used to communicate with DARWIN via the Ethernet interface.
• Setup Functions
Sets the measurement range and alarms.
• Data Retrieval Functions
• Retrieval of the measured data Retrieves measured data in ASCII or binary format. The values are instantaneous values.
1-2 IM MX190-01E
1.1 Introduction to Functions
• Retrieval of setup data Retrieves the setup data of the operation mode, basic setting mode, and A/D calibration mode.
• Retrieval of channel information data (channel number, etc.)
• Control Functions
• Date/time setting
• Reconfiguring the system
• RAM clear (initialization of operation mode parameters)
• Alarm reset
• Setting mode switching
• Utilities
Provides functions for converting measured values into character strings, retrieving error message strings, and other utility functions.
Implementing Functions Corresponding to the Commands of the DARWIN
Communication Function
1
Before Using the API
Functions corresponding to commands of the DARWIN communication function can be implemented according to the procedure below.
• Visual C++: Create an inheritance class of CDAQDARWIN and add member functions that execute the commands of the DARWIN communication function using the runCommand member function.
• Visual C and Visual Basic: Create functions that execute the commands of the DARWIN communication function using the runCommandDARWIN function.
• Visual Basic.NET/C#: Create functions that execute the commands of the DARWIN communication function using the runCommandDA100 function of the extension API.
Notes
• The user program needs to be recompiled and re-linked because the structure and other aspects of the API R3.01 were changed.
1-3

1.2 Software Components and Features

Software Components
The software consists of the API and an extension API. The software provides Visual C++ classes. The classes are Common Class, MX100 class, and DARWIN class. The MX100 Class and DARWIN Class are derived from the Common Class.
Functions used by Visual C, Visual Basic, Visual Basic.NET, and C# are provided. Functions for the MX100 and functions for DARWIN are also available. These functions are executed by calling the Visual C++ class instance.
Visual C, Visual Basic Visual Basic.NET*, C#*
MX100 functions
Visual C++
Common
class
* Visual Basic.NET and C#
Features
• Control is achieved by retrieving the handle (device descriptor) that represents the
• The API provides structures for collection of data corresponding to the function.
• This API is subordinate to the extension API. Call the API to activate. The
DARWIN functions
correspond by Extension API.
MX100
class
DARWIN
class
connection with the controlled unit. This means that, programs can be created independently of the hardware environment of the MX100 or DARWIN.
For example, the MX100 module information structure contains the module type, the number of channels, the scan interval, and other information related to the module. The same structure can be used even when the same data is retrieved using different commands and different formats.
extension API holds the current status data internally. The extension API can describe a program without using a structure.
1-4 IM MX190-01E
1.2 Software Components and Features
Files Included
The software consists of the files listed below.
Type Extension Description
Executable module .dll Executable files. Include file .h Include file for Visual C and Visual C++. Library file .lib Files linked in Visual C and Visual C++. Standard module for Visual Basic .bas Files containing definitions for Visual
API viewer text file .txt Files containing functions, types, and
Standard module for Visual Basic.NET .vb Files containing definitions for Visual
Standard module for C# .cs Files containing definitions for C#.
1
Before Using the API
Basic.
constants for Visual Basic in text format. Can be used by the API Viewer of Visual Studio.
Basic.NET.
1-5

1.3 Operating Environment

PC (Personal Computer)
The software can be used by installing the API on a PC that meets the conditions below.
Note
• No limitation is placed on the CPU, memory, and hard disk. However, the performance of the software depends on them.
• At least 10 MB of free space on the hard disk is required for installing the API.
Operating System
One of the following operating systems must be running.
• Windows NT 4.0 SP3 or later
• Windows 2000
• Windows XP
• Windows Vista Home Premium
• Windows Vista Business
CD-ROM Drive
Used to install the API.
Mouse
Mouse supported by the OS.
Display
Display supported by the OS.
Communication Port
Ethernet port supported by the OS. The TCP/IP protocol must be installed.
Supported Languages
• Visual C++ • Visual Basic.NET (extended API only)
• Visual C C# (extended API only)
• Visual Basic
User Development Environment
A supported language must be installed and functional. You must use Visual Studio 6.0 SP5 or later. The functions of this software are not guaranteed when used with other platforms. Visual C/ Visual C++ in Visual Studio 2005 or later is not compatible with the time_t type. For Visual Studio 2005, specify the Preprocessor Definition as USE_32BIT_TIME_T under Properties > C/C++ > Preprocessor.
1-6 IM MX190-01E
1.3 Operating Environment
MX100
No limitations in particular.
DARWIN
DA100, DC100, DR130, DR230, or DR240 The Ethernet communication function (Ethernet module) is required.
1
Before Using the API
1-7

1.4 Installation

Procedure
1. Turn ON the PC and allow the operating system to start.
Note
Close memory resident programs such as virus protection programs before installation.
2. Insert the CD-ROM containing the software into the CD-ROM drive.
3. After a few moments, the DAQMASTER DARWIN MXAPI window and the Install Shield Wizard window appear. Next, the following screen appears. Follow the instructions on the screen.
If the DAQMASTER DARWIN MXAPI window does not appear, carry out the procedure below.
Click My Computer and double-click the CD-ROM icon. Double-click the Disk 1 icon and double-click Setup.exe in the folder. The DAQMASTER DARWIN MXAPI window and the Install Shield Wizard window appear. Then, the following screen appears. Follow the instructions on the screen.
Note
• Reinstalling the Software If you carry out step 3 on a PC that has the software already installed, a window for confirming the file deletion opens. Click OK to delete the software. Then, carry out step 3 to reinstall the software.
• You can uninstall the API by double-clicking Add/Remove Programs in the Windows Control Panel.
1-8 IM MX190-01E

Chapter 2 MX100 - Visual C++ -

2.1 MX100 Class

The API consists of the MX100/DARWIN Common Class and the class dedicated to the MX100 (see the figure below).
CDAQChInfo
• CDAQMXChID
• CDAQMXChInfo
• CDAQMXChConfig
CDAQDataInfo
• CDAQMXDataInfo
CDAQDateTime
• CDAQMXDateTime
CDAQHandler
• CDAQMX
CDAQMXChConfigData
CDAQMXConfig
CDAQMXDOData
CDAQMXNetInfo
CDAQMXSegment
CDAQMXStatus
CDAQMXSysInfo
CDAQMXBalanceData
CDAQMXBalanceResult
CDAQMXOutputData
CDAQMXAOPWMData
CDAQMXTransmit
: Class common to the MX100 and the DARWIN.
: Class dedicated to the MX100.
2
MX100 -Visual C++
CDAQChInfo Class
Base class for storing the channel information data.
CDAQDataInfo Class
Base class for storing the measured data.
CDAQDateTime Class
Base class for storing the time information data.
CDAQHandler Class
Handler base class for performing communications with the instrument (MX100/ DARWIN).
CDAQMX Class
Class derived from the CDAQHandler class. Provides functions for the MX100.
2-1
2.1 MX100 Class
CDAQMXAOPWMData
Class for storing the AO/PWM data on the MX100. It is a wrapper class of the MXAOPWMData structure.
CDAQMXBalanceData
Class for storing the initial balance data on the MX100. It is a wrapper class of the MXBalanceData structure.
CDAQMXBalanceResult
Class for storing the initial balance results on the MX100. It is a wrapper class of the MXBalanceResult structure.
CDAQMXChConfig Class
Class derived from the CDAQMXChID class. Class for storing the channel setup data. It is a wrapper class of the MXChConfig structure.
CDAQMXChConfigData class
Class for storing the channel setup data for all the channels. It is a wrapper class of the MXChConfigData structure.
CDAQMXChID Class
Class derived from the CDAQChInfo class. Class for storing channel ID information. It is a wrapper class of the MXChID structure.
CDAQMXChInfo Class
Class derived from the CDAQMXChID class. Class for storing the channel information data. It is a wrapper class of the MXChInfo structure.
CDAQMXConfig Class
Class for storing the setup data. It is a wrapper class of the MXChConfigData structure.
CDAQMXDataInfo Class
Class derived from the CDAQDataInfo class. Class for storing the measured data. It is a wrapper class of the MXDataInfo structure.
CDAQMXDateTime Class
Class derived from the CDAQDateTime class. Class for storing time information data. It is a wrapper class of the MXDateTime structure.
2-2 IM MX190-01E
CDAQMXDOData Class
Class for storing the DO data. It is a wrapper class of the MXDOData structure.
2.1 MX100 Class
CDAQMXNetInfo Class
Class for storing the network information data. It is a wrapper class of the MXNetInfo structure.
CDAQMXOutputData
Class for storing the output channel data of the MX100. It is a wrapper class of the MXOutputData structure.
CDAQMXSegment Class
Class for storing the display pattern of the 7-segment LED. It is a wrapper class of the MXSegment structure.
CDAQMXStatus Class
Class for storing the MX100 status data. It is a wrapper class of the MXStatus structure.
CDAQMXSysInfo Class
Class for storing the system configuration data of the MX100. It is a wrapper class of the MXSystemInfo structure.
2
MX100 -Visual C++
CDAQMXTransmit
Class for storing the transmission output data of the MX100. It is a wrapper class of the MXTransmit structure.
2-3

2.2 Correspondence between the Functions and Class/Member Functions - MX100 -

This section indicates the correspondence between the functions that the software supports and the class.
Communication Functions
Function Class and Member Function
Connect to the MX100. CDAQMX::open Disconnect from the MX100. CDAQMX::close Set the communication timeout. CDAQMX::setTimeOut
Note
Setting of the communication timeout is not recommended because unexpected disconnection may occur due to the conflict with the timeout time when data is retrieved.
Control Functions
Starting/Stopping the FIFO
Function Class and Member Function
Start the FIFO CDAQMX::startFIFO Stop the FIFO CDAQMX::stopFIFO Set auto control of the FIFO CDAQMX::autoFIFO
Other Controls
Function FIFO Class and Member Function
Set time information on the MX100 as the Stop CDAQMX::setDateTime number of seconds from the reference date/time (Jan. 1, 1970).
Turn ON/OFF data saving to the CF card Continue CDAQMX::setBackup (data backup).
CF write mode Stop CDAQMXSysInfo:
setCFWriteMode
Format the CF card. Stop CDAQMX::formatCF
• Reconfigure the system of the unit. Stop CDAQMX::initSystem
• Initialize the system of the unit. Stop
• Reset alarms (alarm ACK) of the unit. Continue
The FIFO column in the table indicates the FIFO operation when the function is executed while FIFO is running. Stop: The FIFO stops when the function is executed. Continue: The FIFO continues even when the function is executed. With the backup settings, the CF write mode represents a partial change of the collectively obtained data. After changing the data, it must be sent all together.
Note
If the auto control of the FIFO is enabled, the FIFO is automatically resumed when the FIFO is stopped due to an execution of a function.
2-4 IM MX190-01E
2.2 Correspondence between the Functions and Class/Member Functions - MX100
Setup Functions
Collective Setup
Function FIFO Class and Member Function
Configure the setup data collectively Stop CDAQMX::setConfig Set the DO (Digital Output) data collectively Continue CDAQMX::setDOData Set the basic settings collectively Stop CDAQMX::setMXConfig Set the 7-segment LED display Continue CDAQMX::setSegment Transmit AO/PWM data Continue CDAQMX::setAOPWMData Send transmission output data Continue CDAQMX::setTransmit Set initial balance data Stop CDAQMX::setBalance Set output channel data Stop CDAQMX::setOutput Initial balance data Execute Stop CDAQMX::runBalance
Reset Stop CDAQMX::resetBalance
For a description of the FIFO column in the table, see the explanation given in “Other Controls” on the previous page. With Visual Basic, setting data cannot be handled collectively.
2
MX100 -Visual C++
2-5
2.2 Correspondence between the Functions and Class/Member Functions - MX100
Setup Changes
Function Class and Member Function
Range setting SKIP (not used) CDAQMXConfig::setSKIP
DC voltage input CDAQMXConfig::setVOLT Thermocouple input CDAQMXConfig::setTC RTD input CDAQMXConfig::setRTD Digital input (DI) CDAQMXConfig::setDI Difference computation between channels CDAQMXConfig::setDELTA Remote RJC CDAQMXConfig::setRRJC Resistance CDAQMXConfig::setRES Strain CDAQMXConfig::setSTRAIN AO CDAQMXConfig::setAO PWM CDAQMXConfig::setPWM Pulse CDAQMXConfig::setPULSE
Communication CDAQMXConfig::setCOM Set the unit name of the channel. CDAQMXChID::setUnit Set the channel tag. CDAQMXChID::setTag Set a comment for the channel. CDAQMXChID::setComment Set the alarm. CDAQMXChConfig::setAlarm Set the RJC used on the channel. CDAQMXChConfig::setRJCType Set the filter on the channel. CDAQMXChConfig::setFilter Set the burnout detection action. CDAQMXChConfig::setBurnout Set the alarm to be assigned to the DO channel CDAQMXChConfig::setRefAlarm to which an alarm output was specified. (To set a DO channel to alarm output, use the setDOType function member.) Sets the chattering filter on the channel. CDAQMXChConfig::setChatFilter Set the scan interval. CDAQMXConfig::setInterval Set the temperature unit. CDAQMXConfig::setTempUnit Set the ID number of the unit. CDAQMXSysInfo::setUnitNo Set the timeout value (the time from the disconnection to CDAQMXSysInfo::setCFTimeout
the start of saving to the CF card. For the calculation method of the timeout value, see appendix 3.
Select the signal type to be assigned to the DO channel. CDAQMXConfig::setDOType Select the signal type to be assigned to the AO channel. CDAQMXConfig::setAOType Select the signal type to be assigned to the PWM ch. CDAQMXConfig::setPWMType Set the output channel data type. CDAQMXOutputData::setOutputType Set the output value when the output data power CDAQMXOutputData::setChoice
supply is ON and an error occurs. Set the PWM output channel pulse interval CDAQMXOutputData::setPulstime
(integral multiplication factor). Set the signal type to be assigned to the DO channel. CDAQMXConfig::setDOType Change a portion of the DO data. CDAQMXDOData::setDO Change a portion of the AO/PWM data. CDAQMXAOPWMData::setAOPWM Change a portion of the initial balance data. CDAQMXBalanceData::setBalance Change a portion of the transmission output data. CDAQMXTransmit::setTransmit
2-6 IM MX190-01E
2.2 Correspondence between the Functions and Class/Member Functions - MX100
Note
• To change the settings, use CDAQMX::getConfig to retrieve the setup data, use the setup change function member to modify the settings, and use CDAQMX::setConfig to set the data to the MX100 collectively.
• For DO data, after modifying the contents of CDAQMXDOData with the setup change function member, use CDAQMX::setDOData to set the data on the MX100 collectively.
• For AO/PWM data, after modifying the contents of CDAQMXAOPWMData with the setup change function member, use CDAQMX::setAOPWMData to set the data on the MX100 collectively.
• For transmission data, after modifying the contents of CDAQMXTransmit with the setup change function member, use CDAQMX::setTransmit to set the data on the MX100 collectively.
Data Retrieval Functions
Retrieval of System Status Data and System Configuration Data
Function Class and Member Function
Get system status data. CDAQMX::getStatusData Get system configuration data. CDAQMX::getSystemConfig
Retrieval of Setup Data
2
MX100 -Visual C++
Function Class and Member Function
Get the setup data collectively. CDAQMX::getConfig Get basic settings collectively. CDAQMX::getMXConfig Declare the retrieval of the setup data. CDAQMX::talkConfig
Retrieves setup data other than the channel setup data. Get channel setup data. CDAQMX::getChConfig
Function used to retrieve channel setup data after declaring the retrieval of setup data using the talkConfig function member.
Retrieval of DO Data
Function Class and Member Function
Get the DO data collectively. CDAQMX::getDOData
Retrieval of Channel Information Data
Function Class and Member Function
Declare the retrieval of the channel information data. CDAQMX::talkChInfo Get channel information data. CDAQMX::getChInfo
Retrieval of Measured Data (Channel Designation)
Function Class and Member Function
Get the most recent data range of the specified channel. CDAQMX::getChDataNo Declare the retrieval of the measured data of the CDAQMX::talkChData
specified channel. Declare the retrieval of the instantaneous values of the specified channel.
Get the time information of the specified channel CDAQMX::getTimeData for each data number.
Get the measured data of the specified channel. CDAQMX::getChData
2-7
2.2 Correspondence between the Functions and Class/Member Functions - MX100
Retrieval of Measured Data (FIFO Designation)
Function Class and Member Function
Get the most-recent data range of the specified FIFO no. CDAQMX::getFIFODataNo Declare the retrieval of the measured data of the CDAQMX::talkFIFOData specified FIFO number. Declare the retrieval of the instantaneous values of the specified FIFO number. Get the time information of the specified FIFO number CDAQMX::getTimeData for each data number. Get the measured data of the specified FIFO number. CDAQMX::getChData
Retrieval of Initial Balance Data
Function Class and Member Function
Get initial balance data. CDAQMX::getBalance
Retrieves output channel data
Function Class and Member Function
Get output channel data. CDAQMX::getOutput Get AO/PWM data and transmission output data. CDAQMX::getAOPWMData
Utilities
Function Class and Member Function
Insert the specified user count (user-defined CDAQMX::setUserTime order information) in the next packet to be issued. Get the MX100-specific error that was received last CDAQMX::getLastError through communications. Convert the measured value into a double-precision CDAQMXDataInfo::toDoubleValue floating point number. Convert the measured value into string. CDAQMXDataInfo::toStringValue Get the alarm type string. CDAQMXDataInfo::getAlarmName Get the maximum length of the alarm string. CDAQMXDataInfo::
getMaxLenAlarmName Get the version number of this API. CDAQMX::getVersionAPI Get the revision number of this API. CDAQMX::getRevisionAPI Get the error message string. CDAQMX::getErrorMessage Get the maximum length of the error message string. CDAQMX::getMaxLenErrorMessage Get the number of the parameter on which an error CDAQMX::getItemError was detected. Convert AO/PWM output values to output data DAQMXAOPWMData::toAOPWMValue values. Convert AO/PWM output data values to output CDAQMXAOPWMData::toRealValue values. Check the validity of data numbers. CDAQMXStatus::isDataNo Convert to style version. CDAQMXSysInfo::toStyleVersion
2-8 IM MX190-01E

2.3 Programming - MX100/Visual C++ -

Adding the Path of the Include File
Add the path of the include file (DAQMX.h) to the project. The method of adding the include file varies depending on the environment used.
Declaration in the Source File
Write the declaration in the source file.
#include "DAQMX.h"
Note
The include file of the common section (DAQHandler.h) is referenced from the include file described above. Thus, declaration for it is not necessary.
Library Designation
Add the library (DAQMX.lib, DAQ Handler.lib) to the project. The method of adding the include file varies depending on the environment used. This enables the use of all classes. It also enables the use of all Visual C functions.
2
MX100 -Visual C++
2-9
2.3 Programming - MX100/Visual C++ -
Retrieval of the Measured Data
Program Example 1
This program retrieves measured data.
////////////////////////////////////////////////////////////// // MX100 sample for measurement #include <stdio.h> #include "DAQMX.h"//////////////////////////////////////////// ////////////////// int main(int argc, char* argv[]) { int rc; //return code CDAQMX daqMX; //class int flag; MXDataNo startNo, endNo, dataNo; MXUserTime usertime; CDAQMXDateTime datetime; CDAQMXChInfo chinfo; CDAQMXDataInfo datainfo(NULL, &chinfo); //connect rc = daqMX.open("192.168.1.12"); //get by FIFO rc = daqMX.startFIFO(); rc = daqMX.getFIFODataNo(0, &startNo, &endNo); rc = daqMX.talkFIFOData(0, startNo, endNo); do { //date time rc = daqMX.getTimeData(&dataNo, datetime, &usertime, &flag); } while (! (flag & DAQMX_FLAG_ENDDATA)); do { //measured data rc = daqMX.getChData(&dataNo, datainfo, &flag); } while (! (flag & DAQMX_FLAG_ENDDATA)); rc = daqMX.stopFIFO(); //disconnect rc = daqMX.close(); return rc; } //////////////////////////////////////////////////////////////
Description
Overview
Data retrieval is possible by starting the FIFO. The range to be retrieved is specified by the FIFO number and the data number. The time stamp corresponding to the data number and the measured data are retrieved separately. The end is determined by the flag.
Include File Statement
#include "DAQMX.h"
2-10 IM MX190-01E
2.3 Programming - MX100/Visual C++ -
Flow of the Process
The flow chart shown below omits the declaration section.
START
Connect
Start the FIFO
Get the data range
that can be retrieved
Declare the retrieval
of the measured data
Get the time
information
Last data
number?
Communication Process
First, make a connection. After making the connection, the member functions become available. As a termination procedure, disconnect the communication.
CDAQMX::open
CDAQMX::startFIFO
CDAQMX::getFIFODataNo
CDAQMX::talkFIFOData
CDAQMX::getTimeData
Get the
measured data
Last data
number?
Stop the FIFO
Disconnect
END
2
MX100 -Visual C++
CDAQMX::getChData
CDAQMX::stopFIFO
CDAQMX::close
Note
If there is no access for approximately three minutes, the MX100 drops the connection. Drop the connection if you are not accessing the MX100 for an extended time. Make the connection only when necessary.
Communication Connection
open("192.168.1.12")
The IP address of the MX100 is specified. This statement implicitly specifies the communication constant DAQMX_COMMPORT (communication port number of the MX100).
Note
Communication can also be made when constructing the class. The connection is dropped when the class is destructed.
FIFO Start
startFIFO()
Starts the FIFO.
2-11
2.3 Programming - MX100/Visual C++ -
Retrieval of Data Range
getFIFODataNo(0, &startNo, &endNo)
Retrieves the range from the next data following the data retrieved last to the most recent data of the specified FIFO number using data numbers.
Talker
talkFIFOData(0, startNo, endNo)
Specifies the data range and declares the retrieval of the FIFO data (measured data retrieval declaration).
Retrieval of the FIFO Data Time Information
getTimeData(&dataNo, datetime, &usertime, &flag)
Gets the time information in the specified range in units of data numbers. The end is determined by the flag (constant DAQMX_FLAG_ENDDATA).
Note
“usertime”is the user-defined sequence information (user count). The value specified in advance using the setUserTime member function is stored.
Retrieval of FIFO Data
getChData(&dataNo, datainfo, &flag)
Gets the measured data in the specified range in units of channels. The end is determined by the flag (constant DAQMX_FLAG_ENDDATA).
FIFO Stop
stopFIFO()
Stops the FIFO.
Comm. cut
closeMX(comm)
Drops the connection.
2-12 IM MX190-01E
Retrieval of Setup Data and Configuration
Program Example 2
2.3 Programming - MX100/Visual C++ -
This program executes the following three items. This program contains all three items, but each item can be written and executed separately.
• Collective retrieval of setup data
• Collective setting of setup data
• Setting a DC voltage range for the channels
////////////////////////////////////////////////////////////// // MX100 sample for configuration #include <stdio.h> #include "DAQMX.h" ////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { int rc; //return code CDAQMX daqMX; //class CDAQMXConfig configdata; //connect rc = daqMX.open("192.168.1.12"); //get rc = daqMX.getConfig(configdata); //set rc = daqMX.setConfig(configdata); //range rc = daqMX.getConfig(configdata); configdata.setVOLT(1, DAQMX_RANGE_VOLT_20MV); rc = daqMX.setConfig(configdata); //disconnect rc = daqMX.close(); return rc; } //////////////////////////////////////////////////////////////
2
MX100 -Visual C++
Description
Collective Retrieval of Setup Data
getConfig(configdata)
The setup data below can be retrieved by the collective retrieval of setup data.
• System configuration data: See the CDAQMXSysInfo class (section 2.5).
• Status: See the CDAQMXStatus class (section 2.5).
• Basic settings: See the CDAQMXConfig class (section 2.5).
2-13
2.3 Programming - MX100/Visual C++
Note
The setup data can also be retrieved using the talkConfig member function and the getChConfig member function. The talkConfig function is used to declare the retrieval of the setup data and retrieve the system configuration data, status, and network information data. Then, the getChConfig function is used to retrieve channel setup data in units of channels.
Collective Setting of Setup Data
setConfig(configdata)
The data below can be set by the collective setting of setup data.
• System configuration data: See CDAQMXSysInfo class (section 2.5).
• Basic settings: See the CDAQMXConfig class (section 2.5).
Setting a DC Voltage Range for the Channels
setVOLT(1, DAQMX_RANGE_VOLT_20MV)
Sets channel number 1 to DC voltage range 20 mV. Scaling is not used. First, the setup data is retrieved collectively. Next, the change described above is made. Then, the data is set on the MX100 collectively. Use similar steps when making changes to the settings.
Get the setup data
collectively
Change
the setup data
Set the data
collectively
Error Processing
• Most member functions return the result of the function process using an error number (0 if successful).
• The member function CDAQMX::getErrorMessage can be used to get the error message string corresponding to the error number. The member function CDAQMX::getMaxLenErrorMessage can be used to get the maximum length of the error message string.
• The member function CDAQMX::getLastError can be used to get the errors from the MX100.
CDAQMX::getConfig
CDAQMXConfig::setVOLT, etc. (see "Setup Change" on page 2-6.)
CDAQMX::setConfig
2-14 IM MX190-01E

2.4 Details of the MX100/DARWIN Common Class

The classes are listed in alphabetical order by the class name.
CDAQChInfo Class
This class is a base class of the channel information data. If necessary, you can override member data manipulation with an inheritance class. A function is provided that checks whether the instance has inherited this class. You can override with an inheritance class.
Public Members
Construct/Destruct
CDAQChInfo Constructs an object. ~CDAQChInfo Destructs an object.
Member Data Manipulation
initialize Initializes the data member. getChType Gets the channel type. getChNo Gets the channel number. getPoint Gets the decimal point position. setChType Sets the channel type. setChNo Sets the channel number. setPoint Sets the decimal point position.
2
MX100 -Visual C++
Utilities
isObjedt Checks an object.
Operator
operator= Executes substitution.
Protected Members
Data Members
m_chType Field for storing the channel type. m_chNo Field for storing the channel number. m_point Field for storing the decimal point position.
2-15
2.4 Details of the MX100/DARWIN Common Class
Private Members
None.
Member Functions (Alphabetical Order)
CDAQChInfo::CDAQChInfo
Syntax
CDAQChInfo(int chType = 0, int chNo = 0, int point= 0); virtual ~CDAQChInfo(void);
Parameters
chType Specify the channel type. chNo Specify the channel number. point Specify the decimal point position.
Description
Constructs or destructs an object. When constructing, the data member is set to the specified value.
Reference
setChNo setChType setPoint
CDAQChInfo::getChNo
Syntax
virtual int getChNo(void);
Description
Gets the value of the channel number field of the data member.
Return value
Returns the channel number.
CDAQChInfo::getChType
Syntax
virtual int getChType(void);
Description
Gets the value of the channel type field of the data member.
Return value
Returns the channel type.
2-16 IM MX190-01E
CDAQChInfo::getPoint
Syntax
virtual int getPoint(void);
Description
Gets the value of the decimal point position field of the data member.
Return value
Returns the decimal point position.
CDAQChInfo::initialize
Syntax
virtual void initialize(void);
Description
Initializes the data member. The default value is 0.
Reference
setChType setChNo setPoint
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
CDAQChInfo::isObject
Syntax
virtual int isObject(const char * classname = "CDAQChInfo");
Parameters
classname Specify the class name using a string.
Description
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overriden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid).
Return value
Returns a return value of 1 (true), or 0 (false).
CDAQChInfo::operator=
Syntax
CDAQChInfo & operator=(CDAQChInfo & cChInfo);
Parameters
Description
Return value
cChInfo Specify an object for substitution.
Copies the data member using the specified object information data.
Returns the reference to the object.
2-17
2.4 Details of the MX100/DARWIN Common Class
CDAQChInfo::setChNo
Syntax
virtual void setChNo(int chNo);
Parameters
chNo Specify the channel number.
Description
Stores the specified value in the channel number field of the data member.
CDAQChInfo::setChType
Syntax
virtual void setChType(int chType);
Parameters
chType Specify the channel type.
Description
Stores the specified value in the channel type field of the data member.
CDAQChInfo::setPoint
Syntax
virtual void setPoint(int point);
Parameters
point Specify the decimal point position.
Description
Stores the specified value in the decimal point position field of the data member
2-18 IM MX190-01E
CDAQDataInfo Class
2.4 Details of the MX100/DARWIN Common Class
This class is a base class of the measured data. Measured values can be retrieved by associating them with the channel information data. If necessary, you can override member data manipulation with an inheritance class. A function is provided that checks whether the instance has inherited this class. You can override with an inheritance class.
Public Members
Construct/Destruct
CDAQDataInfo Constructs an object. ~CDAQDataInfo Destructs an object.
Member Data Manipulation
initialize Initializes the data member. getValue Gets the data value. setValue Sets the data value.
Association
getClassChInfo Gets the association with the channel information data. setClassChInfo Sets the association with the channel information data.
2
MX100 -Visual C++
Measured value Format
getDoubleValue Gets the measured value. getStringValue Gets the measured value as a string. toDoubleValue Generates the measured value. toStringValue Generates the measured value as a string.
Utilities
isObject Checks an object.
Operator
operator= Executes substitution.
Protected Members
Data Members
m_value Field for storing the data value. m_pChInfo Association with the channel information data. Field for
Private Members
storing the pointer to CDAQChInfo.
None.
2-19
2.4 Details of the MX100/DARWIN Common Class
Member Functions (Alphabetical Order)
CDAQDataInfo::CDAQDataInfo
Syntax
CDAQDataInfo(int value = 0, CDAQChInfo * pcChInfo = NULL); virtual ~CDAQDataInfo(void);
Parameters
value Specify the data value. pcChInfo Specify the association with the channel information data.
Description
Constructs or destructs an object. When constructing, the data member is set to the specified value. When destructing, the associated channel information data is not deleted.
Reference
setClassChInfo setValue
CDAQDataInfo::getClassChInfo
Syntax
CDAQChInfo * getClassChInfo(void);
Description
Gets the value of the field associated with the channel information data of the data member. Returns NULL if the value is not specified.
Return value
Returns the association with the channel information data.
CDAQDataInfo::getDoubleValue
Syntax
double getDoubleValue(void);
Description
Generates the measured value from the data value of the data member and the decimal point position associated with the channel information data. If there is no association with the channel information data, the decimal point position is 0.
Return value
Returns the measured value as a double-precision floating number.
Reference
getClassChInfo getValue toDoubleValue CDAQChInfo::getPoint
2-20 IM MX190-01E
CDAQDataInfo::getStringValue
Syntax
int getStringValue(char * strValue, int lenValue);
Parameters
strValue Specify the field where the string is to be stored. lenValue Specify the byte size of the field where the string is to be stored.
Description
Generates the measured value from the data value of the data member and the decimal point position associated with the channel information data. Converts the generated measured value into a string and stores it in the specified field. If there is no association with the channel information data, the decimal point position is 0. The string stored to the field includes the terminator. The return value is the length of the actual string. The return value does not include the terminator.
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
Return value
Returns the length of the string.
Reference
getClassChInfo getValue toStringValue CDAQChInfo::getPoint
CDAQDataInfo::getValue
Syntax
virtual int getValue(void);
Description
Gets the value of the data value field of the data member.
Return value
Returns the data value.
CDAQDataInfo::initialize
Syntax
virtual void initialize(void);
Description
Initializes the data member. The default value is 0. The association with the channel information data is not initialized.
Reference
setValue
2-21
2.4 Details of the MX100/DARWIN Common Class
CDAQDataInfo::isObject
Syntax
virtual int isObject(const char * classname = "CDAQDataInfo");
Parameters
classname Specify the class name using a string.
Description
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overriden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid).
Return value
Returns a return value of 1 (true), or 0 (false).
CDAQDataInfo::operator=
Syntax
CDAQDataInfo & operator=(CDAQDataInfo & cDataInfo);
Parameters
cDataInfo Specify an object for substitution.
Description
Copies the data member of the specified object. Also copies the association with the channel information data.
Return value
Returns the reference to the object.
CDAQDataInfo::setClassChInfo
Syntax
void setClassChInfo(CDAQChInfo * pcChInfo);
Parameters
pcChInfo Specify the association with the channel information data.
Description
Stores the specified value in the association field of the channel information data of the data member.
2-22 IM MX190-01E
CDAQDataInfo::setValue
Syntax
virtual void setValue(int value);
Parameters
value Specify the data value.
Description
Stores the specified value in the data value field of the data member.
CDAQDataInfo::toDoubleValue
Syntax
static double toDoubleValue(int value, int point);
Parameters
value Specify the data value. point Specify the decimal point position.
Description
Generates the measured value from the specified data value and decimal point position.
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
Return value
Returns the measured value as a double-precision floating number.
CDAQDataInfo::toStringValue
Syntax
static int toStringValue(int value, int point, char * strValue, int lenValue);
Parameters
value Specify the data value. point Specify the decimal point position. strValue Specify the field where the string is to be stored. lenValue Specify the byte size of the field where the string is to be stored.
Description
Generates the measured value from the specified data value and decimal point position. Converts the generated measured value into a string and stores to the specified field. The string stored to the field includes the terminator. The return value is the length of the actual string. The return value does not include the terminator.
Return value
Reference
Returns the length of the string.
toDoubleValue
2-23
2.4 Details of the MX100/DARWIN Common Class
CDAQDateTime Class
This class is a base class of time information data. Numbers of seconds and milliseconds are passed to the data member. If necessary, you can override member data manipulation with an inheritance class. A function is provided that checks whether the instance has inherited this class. You can override with an inheritance class.
Public Members
Construct/Destruct
CDAQDateTime Constructs an object. ~CDAQDateTime Destructs an object.
Member Data Manipulation
initialize Initializes the data member. getTime Gets seconds. getMilliSecond Gets milliseconds. setTime Sets seconds. setMilliSecond Sets milliseconds. setNow Sets the current date/time.
Utilities
isObject Checks an object. toLocalDateTime Converts to years, months, days, hours, minutes, and
Operator
operator= Executes substitution.
Protected Members
Data Members
m_time Field for storing the number of seconds from Jan. 1, 1970. m_milli Second Field for storing the number of milliseconds.
Private Members
None.
seconds according to the local time zone.
2-24 IM MX190-01E
2.4 Details of the MX100/DARWIN Common Class
Member Functions (Alphabetical Order)
CDAQDateTime::CDAQDateTime
Syntax
CDAQDateTime(time_t time = 0, int millisecond = 0); virtual ~CDAQDateTime(void);
Parameters
time Specify seconds. milliSecond Specify milliseconds.
Description
Constructs or destructs an object. When constructing, the data member is set to the specified value.
Reference
setMilliSecond setTime
CDAQDateTime::getMilliSecond
Syntax
virtual int getMilliSecond(void);
Description
Gets the value of the milliseconds field of the data member.
2
MX100 -Visual C++
Return value
Returns milliseconds.
CDAQDateTime::getTime
Syntax
virtual time_t getTime(void);
Description
Gets the value of the decimal point position field of the data member.
Return value
Returns seconds.
CDAQDateTime::initialize
Syntax
virtual void initialize(void);
Description
Initializes the data member. The default value is 0.
Reference
setMillioSecond setTime
2-25
2.4 Details of the MX100/DARWIN Common Class
CDAQDateTime::isObject
Syntax
virtual int isObject(const char * classname = "CDAQDateTime");
Parameters
classname Specify the class name using a string.
Description
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overriden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid).
Return value
Returns a return value of 1 (true), or 0 (false).
CDAQDateTime::operator=
Syntax
CDAQDateTime & operator=(CDAQDateTime & cDateTime);
Parameters
cDateTime Specify an object for substitution.
Description
Copies the data member of the specified object .
Return value
Returns the reference to the object.
CDAQDateTime::setMilliSecond
Syntax
virtual void setMilliSecond(int milliSecond);
Parameters
milliSecond Specify milliseconds.
Description
Stores the specified value in the millisecond field of the data member
CDAQDateTime::setNow
Syntax
virtual void setNow(void);
Description
Gets the current data/time and stores it in the data member. Milliseconds are set to 0.
Reference
setMilliSecond setTime
2-26 IM MX190-01E
CDAQDateTime::setTime
Syntax
virtual void setTime(time_t time);
Parameters
time Specify seconds.
Description
Stores the specified value in the seconds field of the data member.
CDAQDateTime::toLocalDateTime
Syntax
void toLocalDateTime(int * pYear, int * pMonth, int * pDay, int * pHour, int * pMinute, int * pSecond); static void toLocalDateTime(time_t sectime, int * pYear, int * pMonth, int * pDay, int * pHour, int * pMinute, int * pSecond);
Parameters
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
sectime Specify seconds. pYear Specify the destination where the year value is returned. pMonth Specify the destination where the month value is returned. pDay Specify the destination where the day value is returned. pHour Specify the destination where the hour value is returned. pMinute Specify the destination where the minute value is returned. pSecond Specify the destination where the second value is returned.
Description
Converts the specified number of seconds to years, months, days, hours, minutes, and seconds according to the local time zone. The specified number is the number of seconds from Jan. 1, 1970. Seconds are obtained from the data member for parameters with no seconds specified. A four digit value is returned in year. A value between 1 and 12 is returned for the month. A value between 1 and 31 is returned for the day. A value between 0 and 23 is returned for the hour. A value between 0 and 59 is returned for the minutes. A value between 0 and 59 is returned for the seconds. Returns 0 if conversion fails.
Reference
getTime
2-27
2.4 Details of the MX100/DARWIN Common Class
CDAQHandler Class
This class is a base class of the handler. It provides communication functions. The communication format is TCP/IP. The communication is controlled using the communication descriptor. The communication descriptor is stored in the communication descriptor field of the data member using a pointer to the general type. The communication descriptor is constructed when the connection is made and destructed when the connection is dropped. To change the communication format, create an inheritance class and override all communication member functions. The data acquisition function is defined so that it can be called without knowing the model. However, this class cannot be used with only the definition. It must be overridden with the inheritance class before being implemented. A function is provided that checks whether the instance has inherited this class. You can override with an inheritance class.
Public Members
Construct/Destruct
CDAQHandler Constructs an object. ~CDAQHandler Destructs an object.
Communication Functions
open Establishes a connection. close Drops the connection. sendLine Sends string data. receiveLine Receives string data by lines. setTimeOut Sets the communication timeout (setting of the
Data Retrieval Functions
getData Gets the measured data. getChannel Gets the channel information data.
Utilities
getVersionAPI Gets the version number of this API. getRevisionAPI Gets the revision number of this API. getErrorMessage Gets the error message string getMaxLenErrorMessage Gets the maximum length of the error message
isObject Checks an object.
communication timeout is not recommended (see section 2.2)).
string.
2-28 IM MX190-01E
Protected Members
2.4 Details of the MX100/DARWIN Common Class
Data Members
m_comm Field for storing the communication descriptor. m_nRemainSize Field for storing the remaining size of the received data.
Communication Functions
send Sends the data. receive Receives the data.
Utilities
receiveRemain Receives the remaining bytes and discards them. getVersionDLL Gets the version number of the DLL. getRevisionDLL Gets the revision number of the DLL.
Private Members
None
Member Functions (Alphabetical Order)
2
MX100 -Visual C++
CDAQHandler::CDAQHandler
Syntax
CDAQHandler(void); CDAQHandler(const char * strAddress, unsigned int uiPort, int * errCode = NULL); virtual ~CDAQHandler(void);
Parameters
strAddress Specify the IP address as a string. uiPort Specify the port number. errCode Specify the destination where the error number is to be returned.
Description
Constructs or destructs an object. When constructing, the data member is initialized. The default value as a general rule is 0 (NULL). When the parameters are specified, a connection is established (open) during construction. If the return destination is specified, the error number during connection is returned. When destructing, the data member field is released. Connection is dropped (close) when the communication descriptor exists. The error number is not returned.
Reference
close open
2-29
2.4 Details of the MX100/DARWIN Common Class
CDAQHandler::close
Syntax
virtual int close(void);
Description
Drops the connection. Destructs the communication descriptor.
Return value
Returns an error number. Error: Not connected Not connected. Communication error An error was detected in communications.
CDAQHandler::getChannel
Syntax
virtual int getChannel(int chType, int chNo, CDAQChInfo & cChInfo);
Parameters
chType Specify the channel type. chNo Specify the channel number. cChInfo Specify the destination where the channel information data is to be returned.
Description
This function gets the channel information data by channels. This function must be overridden with the inheritance class of each model. Returns an error number if not overridden.
Return value
Returns an error number. Error: Not Support Not supported.
2-30 IM MX190-01E
CDAQHandler::getData
Syntax
virtual int getData(int chType, int chNo, CDAQDateTime & cDateTime, CDAQDataInfo & cDataInfo);
Parameters
chType Specify the channel type. chNo Specify the channel number. cDateTime Specify the destination where the time information data is
to be returned.
cDataInfo Specify the destination where the measured data is to be
returned.
Description
This function gets the instantaneous values in units of channels. This function must be overridden with the inheritance class of each model. Returns an error number if not overridden.
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
Return value
Returns an error number. Error: Not Support Not supported.
CDAQHandler::getErrorMessage
Syntax
static const char * getErrorMessage(int errCode);
Parameters
errCode Specify the error number.
Description
Gets the error message string corresponding to the error number specified by the parameter. If the value is outside the range, the message string is set to Unknown.
Return value
Returns a pointer to the error message string.
2-31
2.4 Details of the MX100/DARWIN Common Class
CDAQHandler::getMaxLenErrorMessage
Syntax
static const int getMaxLenErrorMessage(void);
Description
Gets the maximum length of the error message string. The value is the number of bytes. The return value does not include the terminator.
Return value
Returns the length of the string.
CDAQHandler::getRevisionAPI
Syntax
static const int getRevisionAPI(void);
Description
Gets the revision number of this API.
Return value
Returns the revision number.
CDAQHandler::getRevisionDLL
Syntax
static const int getRevisionDLL(void);
Description
Gets the revision number of the DLL.
Return value
Returns the revision number.
CDAQHandler::getVersionAPI
Syntax
static const int getVersionAPI(void);
Description
Gets the version number of this API.
Return value
Returns the version number.
2-32 IM MX190-01E
CDAQHandler::getVersionDLL
Syntax
static const int getVersionDLL(void);
Description
Gets the version number of the DLL.
Return value
Returns the version number.
CDAQHandler::isObject
Syntax
virtual int isObject(const char * classname = "CDAQHandler");
Parameters
classname Specify the class name using a string.
Description
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overriden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid).
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
Return value
Returns a return value of 1 (true), or 0 (false).
CDAQHandler::open
Syntax
virtual int open(const char * strAddress, unsigned int uiPort);
Parameters
strAddress Specify the IP address as a string. uiPort Specify the port number.
Description
Connects to the device with the IP address and port number specified by the parameters. Constructs the communication descriptor and stores it in the communication descriptor field of the data member. If the communication descriptor already exists, it is not changed.
Return value
Returns an error number. Error: Creating connection is failure Failed to construct the communication descriptor. Connection exists already Communication descriptor already exists. Communication error An error was detected in communications.
2-33
2.4 Details of the MX100/DARWIN Common Class
CDAQHandler::receive
Syntax
virtual int receive(unsigned char * bufData, int maxData, int * lenData);
Parameters
bufData Specify the field where the received data is to be stored using a
byte array. maxData Specify the byte size of the received data. lenData Specify the destination where the byte size of the actual data
received is returned.
Description
Stores the received data in the field specified by the parameter up to the specified byte size. Returns the byte size of the actual data received if the return destination is specified.
Return value
Returns an error number. Error: Not connected Not connected. Communication error An error was detected in communications.
CDAQHandler::receiveLine
Syntax
virtual int receiveLine(char * strLine, int maxLine, int * lenLine);
Parameters
strLine Specify the field where the received string is to be stored. maxLine Specify the byte size of the field where the received string is to be
stored. lenLine Specify the destination where the byte size of the actual string
received is returned.
Description
Stores the received string to the field specified by the parameter until a line feed is detected or up to the specified byte size. Stores the received string excluding line feeds. Returns the byte size of the actual data received and stored if the return destination is specified.
Return value
Returns an error number. Error: Not connected Not connected. Communication Errors An error was detected in communications.
2-34 IM MX190-01E
CDAQHandler::receiveRemain
Syntax
int receiveRemain(void);
Description
If the remaining size field is greater than 0, the amount of data that is equal to the remaining size is received and discarded. The remaining size field is set to 0. If the remaining size field is 0 or less, the operation concludes successfully.
Return value
Returns an error number.
Reference
receive
CDAQHandler::send
Syntax
virtual int send(const unsigned char * bufData, int lenData);
Parameters
2.4 Details of the MX100/DARWIN Common Class
2
MX100 -Visual C++
bufData Specify the data to be sent using a byte array. lenData Specify the byte size of the data to be sent.
Description
Sends the amount of data to be sent specified by the parameter for the byte size.
Return value
Returns an error number. Error: Not connected Not connected. Communication error An error was detected in communications.
2-35
2.4 Details of the MX100/DARWIN Common Class
CDAQHandler::sendLine
Syntax
virtual int sendLine(const char * strLine);
Parameters
strLine Specify the string to be sent.
Description
Sends the specified string. The line feed is added to the string before it is sent. Specify the string excluding the line feed.
Return value
Returns an error number. Error: Not connected Not connected. Communication error An error was detected in communications.
CDAQHandler::setTimeOut
Syntax
virtual int setTimeOut(int seconds);
Parameters
seconds Specify the communication timeout value in units of seconds.
Description
Sets the transmission and reception timeout to the value specified by the parameter. If a negative value is specified, the timeout is discarded. The use of the timeout is not recommended.
Return value
Returns an error number. Error: Not connected Not connected. Communication error An error was detected in communications.
2-36 IM MX190-01E

2.5 Details of the MX100 Class

The classes are listed in alphabetical order by the class name.
CDAQMX Class
CDAQHandler CDAQMX
This class is derived from the CDAQHandler class. This class provides functions for the MX100. The communication is in binary, therefore do not use primitive communication functions of the base class. Information necessary for communications is stored internally. Send packets are generated internally from command number, user count, and communication packet version. When retrieving data, execute the member of the retrieval declaration, then execute the member that retrieves the data number’s worth of data, for each data. The presence or absence of the declaration is checked here. A function is provided that checks whether the instance has inherited this class. You can override with an inheritance class.
2
MX100 -Visual C++
Public Members
Construct/Destruct
CDAQMX Constructs an object. ~CDAQMX Destructs an object.
Control Functions
Starting/Stopping the FIFO
startFIFO Starts the FIFO. stopFIFO Stops the FIFO. autoFIFO Sets auto control of the FIFO.
Other Controls
setDateTime Sets the time information data. setBackup Sets backup to the CF card. formatCF Formats the CF card. initSystem Initializes the system. setSegment Sets the 7-segment LED. setDOData Sets the DO data. setAOPWMData Sets AO/PWM data. setTransmit Sets the transmission output data.
2-37
2.5 Details of the MX100 Class
Setup Functions
Collective Setup
setConfig Sets the setup data. setMXConfig Sets the basic settings. setOutput Sets the basic setting output channel data. setBalance Sets initial balance data. runBalance Executes initial balancing. resetBalance Initializes the initial balance value.
Data Retrieval Functions
Retrieval of System Status Data and System Configuration Data
getStatusData Gets the status. getSystemConfig Gets the system configuration data.
Retrieval of Setup Data
getConfig Gets the setup data. talkConfig Declares the retrieval of the setup data. getChConfig Gets the channel setup data. getMXConfig Gets the basic settings. getOutput Gets the basic output channel data. getBalance Gets initial balance data.
Retrieval of Output Data
getDOData Gets the DO data. getAOPWMData Gets AO/PWM data and transmission output data.
Retrieval of Channel Information Data
talkChInfo Declares the retrieval of the channel information data. getChInfo Gets the channel information data.
Retrieval of the Measured Data
getChDataNo Gets the data number of the channel. talkChData Declares the retrieval of the measured data according to the
getTimeData Gets the time information data of the measured data. getFIFODataNo Gets the data number of the FIFO. talkFIFOData Declares the retrieval of the measured data according to the
getChData Gets the measured data. getTimeData Gets the time information data of the measured data.
channel specification.
FIFO specification.
Utilities
getUserTime Gets the user count. setUserTime Sets the user count. getLastError Gets the MX100-specific error. getItemError Gets the setting item number.
2-38 IM MX190-01E
• Overridden Members
Communication Functions
2.5 Details of the MX100 Class
open Establishes connection.
Data Retrieval Functions
getData Gets the measured data. getChannel Gets the channel information data.
Utilities
isObject Checks an object.
• Inherited Members
See CDAQHandler. close getErrorMessage getMaxLenErrorMessage getRevisionAPI getVersionAPI receiveLine sendLine setTimeOut
Protected Members
Data Members
m_nNo Field for storing the command number. m_nLastError Field for storing MX100-specific errors. m_bAutoFIFO Field for storing the FIFO auto control. m_llUserTime Field for storing the user count. m_nSessionNo Field for storing the session number. m_chFIFONo Field for storing the FIFO number per channel. m_chFIFOIndex Field for storing the channel sequence number in the FIFO
m_chDataType Field for storing the data type per channel. m_chDeciPos Field for storing the decimal point position per channel. m_lastFIFODataNo Field for storing the last data number per FIFO. m_lastChDataNo Field for storing the last data number per channel. m_startChNo Field for storing the start channel number. m_endChNo Field for storing the end channel number. m_curChNo Field for storing the current channel number. m_startFIFOIdx Field for storing the start channel sequence number of the
m_endFIFOIdx Field for storing the end channel sequence number of the
m_curFIFOIdx Field for storing the current channel sequence number of the
m_startDataNo Field for storing the start data number. m_endDataNo Field for storing the end data number. m_curDataNo Field for storing the current data number. m_nFIFONo Field for storing the FIFO number.
2
MX100 -Visual C++
per channel.
FIFO.
FIFO.
FIFO.
2-39
2.5 Details of the MX100 Class
m_nDataNum Field for storing the data number. m_nChNum Field for storing the number of channels. m_nTimeNum Field for storing the remaining number of time information
m_packetVer Field for storing the communication packet version. m_nItemError Field for storing the setting item number. m_bTalkConfig Declaration flag for retrieval of the setup data. m_bTalkChInfo Declaration flag for retrieval of the channel information data. m_bTalkData Declaration flag for retrieval of the measured data.
Communication Functions
runCommand Executes a command. sendPacket Sends a packet. receivePacket Receives a packet. receiveBlock Receives a block. runPacket Sends/receives packets. receiveBuffer Receives the “size” amount of data, including the size information.
data of the measured data.
Internal Commands
nop Executes the NOP command. registry Executes the registry command.
Member Data Manipulation
getNo Gets the command number. incCurDataNo Increments the current data number. incCurFIFOIdx Increments the channel sequence number in the current FIFO. getDataNo Gets the data number. searchChNo Gets the channel number from the channel sequence
number in the FIFO. clearAttr Initializes the data member. clearData Initializes the data member related to the retrieval of the
measured data. getPacketVersion Gets the communication packet version. clearLastDataNoCh Initializes the last data number of each channel. clearLastDataNoFIFO Initializes the last data number of each FIFO.
Utilities
getVersionDLL Gets the version number of the DLL. getRevisionDLL Gets the revision number of the DLL.
• Inherited Members
See CDAQHandler.
m_comm m_nRemainSize receive receiveRemain send
2-40 IM MX190-01E
Private Members
None.
Member Functions (Alphabetical Order)
CDAQMX::autoFIFO
Syntax
int autoFIFO(int bAuto);
Parameters
bAuto Specify auto control using a Boolean value.
Description
Sets auto control. Stores the specified value in the automatic control field of the data member. When enabled, the FIFO is started.
Return value
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Returns an error number.
Reference
startFIFO
CDAQMX::CDAQMX
Syntax
CDAQMX(void); CDAQMX(const char * strAddress, unsigned int uiPort = DAQMX_COMMPORT, int * errCode = NULL); virtual ~CDAQMX(void);
Parameters
strAddress Specify the IP address as a string. uiPort Specify the port number. errCode Specify the destination where the error number is to be returned.
Description
Constructs or destructs an object. When constructing, the data member is initialized. The default value as a general rule is 0 (NULL). When the parameters are specified, a connection is established (open) during construction. If the return destination is specified, the error number during connection is returned. When destructing, the data member field is released. The connection is dropped (close) when the communication descriptor exists. The error number is not returned.
Reference
clearAttr close open CDAQHandler::CDAQHandler
2-41
2.5 Details of the MX100 Class
CDAQMX::clearAttr
Syntax
void clearAttr(void);
Description
Initializes all the data members. The default value as a general rule is 0.
Reference
clearData
CDAQMX::clearData
Syntax
void clearData(int sessionNo = 0);
Parameters
sessionNo Specify the session number.
Description
Initializes the data member to start the retrieval of the measured data. Stores the specified value in the session number field of the data member.
Reference
clearLastDataNoCh clearLastDataNoFIFO
CDAQMX::clearLastDataNoCh
Syntax
void clearLastDataNoCh(int chNo = DAQMX_CHNO_ALL);
Parameters
chNo Specify the channel number.
Description
Initializes the last data number field of each channel specified in the data member. If the constant for “Specify all Channels”is specified for the channel numbers, all channels are processed.
CDAQMX::clearLastDataNoFIFO
Syntax
void clearLastDataNoFIFO(int fifoNo = DAQMX_FIFONO_ALL);
Parameters
fifoNo Specify the FIFO number.
Description
Initializes the last data number field of each FIFO in the FIFO numbers specified in the data member. If the constant for “Specify all FIFO numbers”is specified for the FIFO numbers, all FIFOs are processed.
2-42 IM MX190-01E
CDAQMX::formatCF
Syntax
virtual int formatCF(void);
Description
Formats the CF card. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand startFIFO stopFIFO
CDAQMX::getAOPWMData
Syntax
int getAOPWMData(CDAQMXAOPWMData & cMXAOPWMData, CDAQMXTransmit & cMXTransmit);
Parameters
2.5 Details of the MX100 Class
2
MX100 -Visual C++
cMXAOPWMData Specify the destination where the AO/PWM data is to be
returned.
cMXTransmit Specify the destination where the transmission output data
is to be returned.
Description
Gets of AO/PWM data and transmission output data.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXAOPWMData::initialize CDAQMXAOPWMData::setAOPWM CDAQMXTransmit::initialize CDAQMXTransmit::setTransmit
2-43
2.5 Details of the MX100 Class
CDAQMX::getBalance
Syntax
int getBalance(CDAQMXBalanceData & cMXBalanceData);
Parameters
cMXBalanceData Specify the destination where the initial balance data is to
Description
Gets initial balance data. Gets the setup data, and stores the initial balance data portion in the specified return destination.
Return value
Returns an error number.
Reference
getMXConfig CDAQMXBalanceData::initialize CDAQMXConfig::getClassMXBalanceData
be returned.
CDAQMX::getChannel
Syntax
virtual int getChannel(int chType, int chNo, CDAQChInfo & cChInfo);
Parameters
chType Specify the channel type. chNo Specify the channel number. cChInfo Specify the destination where the channel information data is to
be returned.
Description
This function gets the channel information data by channels. Gets the channel information data of the specified channel. The channel type is ignored.
Return value
Returns an error number.
Reference
getChInfo talkChInfo
2-44 IM MX190-01E
CDAQMX::getChConfig
Syntax
int getChConfig(CDAQMXChConfig & cMXChConfig, int * pFlag = NULL);
Parameters
cMXChConfig Specify the destination where the channel setup data is to be
returned.
pFlag Specify the destination where the flag is to be returned.
Description
Gets the channel information data that was declared to be retrieved using the talkConfig function in units of channels. Analyzes information and stores the data in the return destination. When the last set of data is retrieved, the flag status is set. It is also set when the function ends in error. Do not perform communications using other functions until the data retrieval is completed. Packets differ with the style number of the main unit.
Return value
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Returns an error number. Error: Not support Unsupported version. Or, the sequence of execution was
incorrect.
Reference
getPacketVersion receiveBlock CDAQMXChConfig::setChNo
2-45
2.5 Details of the MX100 Class
CDAQMX::getChData
Syntax
int getChData(MXDataNo * dataNo, CDAQMXDataInfo & cMXDataInfo, int * pFlag = NULL);
Parameters
dataNo Specify the destination where the data number is to be returned. cMXDataInfo Specify the destination where the measured data is to be returned. pFlag Specify the destination where the flag is to be returned.
Description
Gets the measured data that was declared to be retrieved using the talkChData and talkFIFOData functions in units of channels. Analyzes information and stores the data in the return destination. If an association with channel information data exists in the measured data return destination, channel information data that identifies the measured data is stored. When the last set of data is retrieved, the flag status is set. It is also set when the function ends in error. Do not perform communications using other functions until the data retrieval is completed.
Return value
Returns an error number.
Reference
incCurFIFOIdx receiveBlock searchChNo CDAQMXChInfo::setChNo CDAQMXChInfo::setFIFONo CDAQMXChInfo::setPoint CDAQMXChInfo::setValid CDAQMXDataInfo::getClassMXChInfo
CDAQMX::getChDataNo
Syntax
int getChDataNo(int chNo, MXDataNo * startDataNo, MXDataNo * endDataNo);
Parameters
chNo Specify the channel number. startDataNo Specify the destination where the start data number is to be returned. endDataNo Specify the destination where the end data number is to be returned.
Description
Gets the data number of measured data that can be retrieved. Gets the data range that can be retrieved starting from the next data after the measured data that was received last through channel designation.
Return value
Returns an error number. Error: Not support The channel number is outside the range.
Reference
getDataNo
2-46 IM MX190-01E
CDAQMX::getChInfo
Syntax
int getChInfo(CDAQMXChInfo & cMXChInfo, int * pFlag = NULL);
Parameters
cMXChInfo Specify the destination where the channel information data is to
be returned.
pFlag Specify the destination where the flag is to be returned.
Description
Gets the channel information data that was declared to be retrieved using the talkChInfo function in units of channels. Analyzes information and stores the data in the return destination. When the last set of data is retrieved, the flag status is set. It is also set when the function ends in error. Do not perform communications using other functions until the data retrieval is completed. Stores required information in the each channel information storage field of the data member.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Return value
Returns an error number. Error: Not support The sequence of execution was incorrect.
Reference
receiveBlock CDAQMXChInfo::getFIFOIndex CDAQMXChInfo::getFIFONo CDAQMXChInfo::getPoint CDAQMXChInfo::setChNo CDAQMXChInfo::setFIFOIndex CDAQMXChInfo::setFIFONo
CDAQMX::getConfig
Syntax
int getConfig(CDAQMXConfig & cMXConfig);
Parameters
cMXConfig Specify the destination where the setup data is to be returned.
Description
Gets the setup data. Gets the System configuration data, status, and basic settings and merges the information.
Return value
Reference
Returns an error number.
getMXConfig getStatusData getSystemConfig
2-47
2.5 Details of the MX100 Class
CDAQMX::getData
Syntax
virtual int getData(int chType, int chNo, CDAQDateTime & cDateTime, CDAQDataInfo & cDataInfo);
Parameters
chType Specify the channel type. chNo Specify the channel number. cDateTime Specify the destination where the time information data is to be
cDataInfo Specify the destination where the measured data is to be
Description
This function gets the instantaneous values in units of channels. Gets the measured data of the specified channel. The channel type is ignored.
Return value
Returns an error number.
returned.
returned.
Reference
getChData getTimeData talkChData
CDAQMX::getDataNo
Syntax
int getDataNo(int fifoNo, MXDataNo prevLast, MXDataNo * startDataNo, MXDataNo * endDataNo);
Parameters
fifoNo Specify the FIFO number. prevLast Specify the data number retrieved last. startDataNo Specify the destination where the start data number is to be
returned.
endDataNo Specify the destination where the end data number is to be
returned.
Description
Gets the status data and calculates the range of measured data that can be retrieved. If measured data that can be retrieved does not exist, negative numbers are returned.
Return value
Returns an error number. Error: Not support The FIFO number is outside the range.
Reference
getStatusData CDAQMXStatus::getNewDataNo CDAQMXStatus::getOldDataNo
2-48 IM MX190-01E
CDAQMX::getDOData
Syntax
int getDOData(CDAQMXDOData & cMXDoData);
Parameters
cMXDoData Specify the destination where the DO data is to be returned.
Description
Gets the DO data. Gets the data of all the channels collectively.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXDOData::initialize CDAQMXDOData::setDO
CDAQMX::getFIFODataNo
Syntax
int getFIFODataNo(int fifoNo, MXDataNo * startDataNo, MXDataNo * endDataNo);
Parameters
2.5 Details of the MX100 Class
2
MX100 -Visual C++
fifoNo Specify the FIFO number. startDataNo Specify the destination where the start data number is to be returned. endDataNo Specify the destination where the end data number is to be returned.
Description
Gets the data number of measured data that can be retrieved. Gets the data range that can be retrieved starting from the next data after the measured data that was received last through FIFO designation.
Return value
Returns an error number. Error: Not support The FIFO number is outside the range.
Reference
getDataNo
CDAQMX::getItemError
Syntax
int getItemError(void);
Description
Gets the value of the setting item number field from the data member.
Return value
Returns the setting item number.
2-49
2.5 Details of the MX100 Class
CDAQMX::getLastError
Syntax
int getLastError(void);
Description
Gets the value in the MX100-specific error field from the data member.
Return value
Returns the MX100-specific error.
CDAQMX::getMXConfig
Syntax
int getMXConfig(CDAQMXConfig & cMXConfig);
Parameters
cMXConfig Specify the destination where the setup data is to be returned.
Description
Gets the basic settings. Packets differ with the style number of the MX100.
Return value
Returns an error number. Error: Not support Unsupported version.
Reference
getNo getPacketVersion getUserTime runCommand
CDAQMX::getNo
Syntax
int getNo(void);
Description
Gets the value in the command number field from the data member. Increments the command number.
Return value
Returns the command number.
2-50 IM MX190-01E
CDAQMX::getOutput
Syntax
int getOutput(CDAQMXOutputData & cMXOutputData);
Parameters
cMXOutputData Specify the destination where the output channel data is to be
returned.
Description
Gets the basic output channel data. Gets the setup data, and stores the output channel data portion in the specified return destination.
Return value
Returns an error number.
Reference
getMXConfig CDAQMXConfig::getClassMXOutputData CDAQMXOutputData::initialize
2.5 Details of the MX100 Class
2
MX100 -Visual C++
CDAQMX::getPacketVersion
Syntax
int getPacketVersion(void);
Description
Gets the value of the communication packet version field from the data member.
Return value
Returns the communication packet version.
CDAQMX::getRevisionDLL
Syntax
static const int getRevisionDLL(void);
Description
Gets the revision number of this DLL.
Return value
Returns the revision number of this DLL.
2-51
2.5 Details of the MX100 Class
CDAQMX::getStatusData
Syntax
int getStatusData(CDAQMXStatus & cMXStatus);
Parameters
cMXStatus Specify the destination where the status data is to be returned.
Description
Gets the status data. Packets differ with the style number of the MX100.
Return value
Returns an error number. Error: Not support Unsupported version.
Reference
getNo getPacketVersion getUserTime runCommand
CDAQMX::getSystemConfig
Syntax
int getSystemConfig(CDAQMXSysInfo & cMXSysInfo);
Parameters
cMXSysInfo Specify the destination where the system configuration data is to
be returned.
Description
Gets the system configuration data.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand
2-52 IM MX190-01E
CDAQMX::getTimeData
Syntax
int getTimeData(MXDataNo * dataNo, CDAQMXDateTime & cMXDateTime, MXUserTime * pUserTime = NULL, int * pFlag =NULL);
Parameters
dataNo Specify the destination where the data number is to be returned. cMXDateTime Specify the destination where the time information data is to be returned. pUserTime Specify the destination where the user count is to be returned. pFlag Specify the destination where the flag is to be returned.
Description
Gets the time information data that was declared to be retrieved using the talkChData and talkFIFOData functions in units of data numbers. Analyzes information and stores the data in the return destination. When the last set of data is retrieved, the flag status is set. It is also set when the function ends in error. Do not perform communications using other functions until the data retrieval is completed. After the data is retrieved by this function member, use getChData to retrieve the data for each channel within the data number.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Return value
Returns an error number. Error: Not support The sequence of execution was incorrect.
Reference
incCurDataNo receiveBlock CDAQMXDateTime::setMilliSecond CDAQMXDateTime::setTime
CDAQMX::getUserTime
Syntax
MXUserTime getUserTime(void);
Description
Gets the value in the user count field from the data member.
Return value
Returns the user count.
CDAQMX::getVersionDLL
Syntax
Description
Return value
static const int getVersionDLL(void);
Gets the version number of this DLL.
Returns the version number of this DLL.
2-53
2.5 Details of the MX100 Class
CDAQMX::incCurDataNo
Syntax
MXDataNo incCurDataNo(void);
Description
Gets the value in the current data number field from the data member. Increments the current data number. When the end data number is exceeded, the number is reset to the start data number.
Return value
Returns the current data number.
CDAQMX::incCurFIFOIdx
Syntax
int incCurFIFOIdx(void);
Description
Gets the value in the channel sequence number field in the current FIFO from the data member. Increments the channel sequence number in the current FIFO. When the end channel sequence number in the FIFO is exceeded, the number is reset to the start channel sequence number in the FIFO.
Return value
Returns the channel sequence number in the current FIFO.
CDAQMX::initSystem
Syntax
int initSystem(int iCtrl);
Parameters
iCtrl Specify the system control type.
Description
Executes the operation of the specified system control type. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully. However, the alarm reset time is excluded.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand getConfig setMXConfig CDAQMXConfig::reconstruct
2-54 IM MX190-01E
CDAQMX::isObject
Syntax
virtual int isObject(const char * classname = "CDAQMX");
Parameters
classname Specify the class name using a string.
Description
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overridden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid). If different from this class, checks the parent class.
Return value
Returns a Boolean value.
Reference
CDAQHandler::isObject
2.5 Details of the MX100 Class
2
MX100 -Visual C++
CDAQMX::nop
Syntax
int nop(void);
Description
Executes a command. The MX100 only returns a response.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand
2-55
2.5 Details of the MX100 Class
CDAQMX::open
Syntax
virtual int open(const char * strAddress, unsigned int uiPort = DAQMX_COMMPORT);
Parameters
strAddress Specify the IP address as a string. uiPort Specify the port number.
Description
Connects to the device with the IP address and port number specified by the parameters. The port number can be omitted. If omitted, it is set to the MX100 communication port number. Initializes the data member. Executes the registry command. If execution fails, the connection is dropped.
Return value
Returns an error number.
Reference
clearAttr close registry CDAQHandler::open
CDAQMX::receiveBlock
Syntax
int receiveBlock(unsigned char * pBlock, int lenBlock);
Parameters
pBlock Specify the field where the block is to be stored using a byte array. lenBlock Specify the byte size of the block.
Description
Receives the specified block. Updates the remaining size field.
Return value
Returns an error number. Error: Not data The field size is not consistent.
Reference
receive
2-56 IM MX190-01E
CDAQMX::receiveBuffer
Syntax
int receiveBuffer(unsigned char * pBuf, int lenBuf, int * realLen, int * sizeBuf = NULL)
Parameters
pBuf Specify the field where the data is to be stored using a byte array. lenBuf Specify the number of bytes of the data field. realLen Specify the destination where the byte size of the actual data
received is returned.
sizeBuf Specify the destination where the size information is to be returned.
Description
Receives the data including the size information. Receives and stores the amount of data specified by the size information or the specified number of bytes in the field specified by the parameter. Returns the number of bytes and size information of the
actual data received if the return destination is specified.
Return value
Returns an error number. Error: Not acknowledgeThe size of the response packet is wrong.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Reference
receiveRemain receive
CDAQMX::receivePacket
Syntax
virtual int receivePacket(unsigned char * ackBuf, int lenAck, int * realLen);
Parameters
ackBuf Specify the field where the response packet is to be stored using a
byte array. lenAck Specify the byte size of the response packet. realLen Specify the destination where the byte size that is actually
received is returned.
Description
Receives the specified packet and decodes it. If the received packet is an error packet, the MX100-specific error is stored in the MX100-specific error field.
Return value
Returns an error number. Error: Commands are not processed successfully
Received an error packet.
Reference
receiveBuffer
2-57
2.5 Details of the MX100 Class
CDAQMX::registry
Syntax
int registry(void);
Description
Executes a command. This command notifies the MX100 main unit of the PC information (host name and address). Stores the communication packet version in the communication packet version field of the data member.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand
CDAQMX::resetBalance
Syntax
int resetBalance(CDAQMXBalanceResult & cMXBalanceResult);
Parameters
cMXBalanceResult Specify the destination where the initial balance result is to
be returned.
Description
Resets initial balancing. Stores the reset result, initial balance result, and initial balance value in the specified return destination. Only channels specified as valid are reset. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully. The response to this function may take five seconds or longer.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand startFIFO stopFIFO CDAQMXBalanceResult::getBalanceValid CDAQMXBalanceResult::setBalance CDAQMXBalanceResult::setResult
2-58 IM MX190-01E
CDAQMX::runBalance
Syntax
int runBalance(CDAQMXBalanceResult & cMXBalanceResult);
Parameters
cMXBalanceResult Specify the destination where the initial balance result is to
Description
Executes initial balancing. Stores the execution result, initial balance result, and initial balance value in the specified return destination. Execution takes place only on channels specified as valid. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully. The response to this function may take five seconds or longer.
Return value
Returns an error number.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
be returned.
Reference
getNo getPacketVersion getUserTime runCommand startFIFO stopFIFO CDAQMXBalanceResult::getBalanceValid CDAQMXBalanceResult::setBalance CDAQMXBalanceResult::setResult
CDAQMX::runCommand
Syntax
virtual int runCommand(unsigned char * reqBuf, int lenReq, unsigned char * ackBuf, int lenAck);
Parameters
reqBuf Specify the request packet using a byte array. lenReq Specify the byte size of the request packet. ackBuf Specify the field where the response packet is to be stored using a
byte array. lenAck Specify the byte size of the response packet.
Description
Sends the specified request packet and receives the response packet. The response packet is stored in the specified field.
Return value
Reference
Returns an error number. Error: Not acknowledgeNo response was generated for the request. Not support The request packets were incorrect. Not data The response packet field is insufficient.
receivePacket sendPacket
2-59
2.5 Details of the MX100 Class
CDAQMX::runPacket
Syntax
virtual int runPacket(unsigned char * reqBuf, int lenReq, unsigned char * ackBuf, int lenAck);
Parameters
reqBuf Specify the request packet using a byte array. lenReq Specify the byte size of the request packet. ackBuf Specify the field where the response packet is to be stored using
lenAck Specify the byte size of the response packet.
Description
Sends the specified request packet and receives the response packet. The response packet is stored in the specified field. This is a member provided for non­standard packets. The packets must be processed on the user side. The use of a timeout is not recommended.
Return value
a byte array.
Returns an error number.
Reference
receiveBuffer send
CDAQMX::searchChNo
Syntax
int searchChNo(int fifoNo, int fifoIndex);
Parameters
fifoNo Specify the FIFO number. fifoIndex Specify the channel sequence number in the FIFO.
Description
Searches for the channel number corresponding to the specified value from the information stored in the data member. Returns 0 if it does not exist.
Return value
Returns the channel number.
2-60 IM MX190-01E
CDAQMX::sendPacket
Syntax
virtual int sendPacket(unsigned char * reqBuf, int lenReq);
Parameters
reqBuf Specify the request packet using a byte array. lenReq Specify the byte size of the request packet.
Description
Encodes the specified packet and sends it.
Return value
Returns an error number.
Reference
send
CDAQMX::setAOPWMData
Syntax
int setAOPWMData(CDAQMXAOPWMData & cMXAOPWMData);
Parameters
2.5 Details of the MX100 Class
2
MX100 -Visual C++
cMXAOPWMData Specify the AO/PWM data.
Description
Sets AO/PWM data.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXAOPWMData::getAOPWMValid CDAQMXAOPWMData::getAOPWMValue
2-61
2.5 Details of the MX100 Class
CDAQMX::setBalance
Syntax
int setBalance(CDAQMXBalanceData & cMXBalanceData);
Parameters
cMXBalanceData Specify initial balance data.
Description
Sets initial balance data. Gets the setup data, updates it according to the specified initial balance data, and sends the setup data. Only channels specified as valid are updated.
Return value
Returns an error number.
Reference
getMXConfig setMXConfig CDAQMXBalanceData::getBalanceValid CDAQMXBalanceData::setBalance CDAQMXConfig::getClassMXBalanceData
CDAQMX::setBackup
Syntax
int setBackup(int bBackup);
Parameters
bBackup Specify backup using a Boolean value.
Description
Sets backup on the device.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand
2-62 IM MX190-01E
CDAQMX::setBalance
Syntax
int setBalance(CDAQMXBalanceData & cMXBalanceData);
Parameters
cMXBalanceData Specifies initial balance data.
Description
Sets initial balance data. Gets the setup data, updates it according to the specified initial balance data, and sends the setup data. Only channels specified as valid are updated.
Return value
Returns an error number.
Reference
getMXConfig setMXConfig CDAQMXBalanceData::getBalanceValid CDAQMXBalanceData::setBalance CDAQMXConfig::getClassMXBalanceData
2.5 Details of the MX100 Class
2
MX100 -Visual C++
CDAQMX::setConfig
Syntax
int setConfig(CDAQMXConfig & cMXConfig);
Parameters
cMXConfig Specify the setup data.
Description
Sets the setup data. Sets the basic settings.
Return value
Returns an error number.
Reference
setMXConfig
2-63
2.5 Details of the MX100 Class
CDAQMX::setDateTime
Syntax
virtual int setDateTime(CDAQMXDateTime * pcMXDateTime = NULL);
Parameters
pcMXDateTime Specify the time information data.
Description
Sets time information data on the device. If the parameter’s time information data is omitted, the current date/time of the PC is used. Milliseconds are discarded. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully. The response to this function may take one second or longer. An error occurs if the time is a negative number.
Return value
Returns an error number. Error: Not data Specified value incorrect.
Reference
getNo getPacketVersion getUserTime runCommand startFIFO stopFIFO CDAQMXDateTime::getMilliSecond CDAQMXDateTime::getTime CDAQMXDateTime::setNow
CDAQMX::setDOData
Syntax
int setDOData(CDAQMXDOData & cMXDoData);
Parameters
cMXDoData Specify the DO data.
Description
Sets the DO data. Sets the data of all the channels collectively.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXDOData::getDOONOFF CDAQMXDOData::getDOValid
2-64 IM MX190-01E
CDAQMX::setMXConfig
Syntax
int setMXConfig(CDAQMXConfig & cMXConfig);
Parameters
cMXConfig Specify the setup data.
Description
Sets basic settings on the device. The input data is validated before it is sent. The FIFO stops. If auto control is enabled, the FIFO starts after the function completes successfully. Packets differ with the style number of the main unit. The setting item number of the validation results are stored in the setting item number field of the data member.
Return value
Returns an error number. Error: Not data The input data is not valid. Not support Unsupported version.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Reference
getNo getPacketVersion getUserTime runCommand startFIFO stopFIFO CDAQMXConfig::isCorrect CDAQMXConfig::getItemError
CDAQMX::setOutput
Syntax
int setOutput(CDAQMXOutputData & cMXOutputData);
Parameters
cMXOutputData Specify the output channel data.
Description
Sets the output channel data. Gets the setup data, updates it according to the specified output channel data, and sends the setup data. If the output type is changed, it will not match the channel setup data.
Return value
Returns an error number.
Reference
getMXConfig setMXConfig CDAQMXConfig::getClassMXOutputData
2-65
2.5 Details of the MX100 Class
CDAQMX::setSegment
Syntax
int setSegment(int dispType, int dispTime, CDAQMXSegment & cNewMXSegment, CDAQMXSegment & cOldMXSegment);
Parameters
dispType Specify the display format. dispTime Specify the display time. cNewMXSegment Specify the display pattern. cOldMXSegment Specify the destination where the previous display pattern
Description
Sets the display of the 7-segment LED. Stores the 7-segment LED display pattern before the change if the return destination is specified.
Return value
Returns an error number.
is to be returned.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXSegment::getPattern CDAQMXSegment::setPattern
CDAQMX::setTransmit
Syntax
int setTransmit(CDAQMXTransmit & cMXTransmit);
Parameters
cMXTransmit Specify the transmission output data.
Description
Sets the transmission output data.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand CDAQMXTransmit::getTransmit
2-66 IM MX190-01E
CDAQMX::setUserTime
Syntax
void setUserTime(MXUserTime userTime);
Parameters
userTime Specify the user count.
Description
Stores the specified value in the user count field of the data member.
CDAQMX::startFIFO
Syntax
int startFIFO(void);
Description
Starts the FIFO. Gets the channel information data and sets necessary information in the data member related to the retrieval of the measured data.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Return value
Returns an error number.
Reference
clearData getNo getPacketVersion getUserTime getChInfo runCommand talkChInfo
CDAQMX::stopFIFO
Syntax
int stopFIFO(void);
Description
Stops the FIFO. Stops even if auto control is enabled.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime runCommand
2-67
2.5 Details of the MX100 Class
CDAQMX::talkChData
Syntax
int talkChData(int chNo, MXDataNo startDataNo = DAQMX_INSTANTANEOUS, MXDataNo endDataNo = DAQMX_INSTANTANEOUS);
Parameters
chNo Specify the channel number. startDataNo Specify the start data number. endDataNo Specify the end data number.
Description
Declares the retrieval of the measured data. Gets the measured data in the specified data number range. The range that is actually retrieved is not necessarily equal to the specified range. If the data number is omitted, the instantaneous value is retrieved. After executing this function member, use getTimeData to get the time information data for each data number. Then, use getChData to retrieve the data for each channel within the data number.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime receivePacket sendPacket
CDAQMX::talkChInfo
Syntax
int talkChInfo(int startChNo = 1, int endChNo = DAQMX_NUMCHANNEL);
Parameters
startChNo Specify the start channel number. endChNo Specify the end channel number.
Description
Declares the retrieval of the channel information data from the start channel number to the end channel number. After executing this function member, use the getChInfo function to retrieve the data for each channel.
Return value
Returns an error number.
Reference
getNo getPacketVersion getUserTime receivePacket sendPacket
2-68 IM MX190-01E
CDAQMX::talkConfig
Syntax
int talkConfig(CDAQMXSysInfo & cMXSysInfo, CDAQMXStatus & cMXStatus, CDAQMXNetInfo & cMXNetInfo);
Parameters
cMXSysInfo Specify the destination where the system configuration data is to
be returned. cMXStatus Specify the destination where the status data is to be returned. cMXNetInfo Specify the destination where the network information data is to
be returned.
Description
Declares the retrieval of the setup data. Gets the setup data excluding the channel setup data. After executing this function member, use the getChConfig function to retrieve the data for each channel. Within the setup data, initial balance data and output channel data is retrieved using a separately-named retrieval function.
Return value
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Returns an error number.
Reference
getNo getPacketVersion getStatusData getSystemConfig getUserTime receivePacket sendPacket
CDAQMX::talkFIFOData
Syntax
int talkFIFOData(int fifoNo, MXDataNo startDataNo = DAQMX_INSTANTANEOUS, MXDataNo endDataNo = DAQMX_INSTANTANEOUS);
Parameters
fifoNo Specify the FIFO number. startDataNo Specify the start data number. endDataNo Specify the end data number.
Description
Declares the retrieval of the measured data. Gets the measured data in the specified data number range. The range that is actually retrieved is not necessarily equal to the specified range. If the data number is omitted, the instantaneous value is retrieved. After executing this function member, use getTimeData to get the time information data for each data number. Then, use getChData to retrieve the data for each channel within the data number.
Return value
Reference
Returns an error number.
getNo getPacketVersion getUserTime receivePacket sendPacket
2-69
2.5 Details of the MX100 Class
CDAQMXAOPWMData Class
This class stores the AO/PWM data of the MX100. It is a wrapper class of the MXAOPWMData structure. It is a group of AO/PWM data from all the channels. Each data can be accessed by PWM data number or AO data number. This class can be used as an interface for setting and retrieving AO/PWM data. This class supports the utility that converts the specified output data values and actual output values.
Public Members
Construct/Destruct
CDAQMXAOPWMData Constructs an object. ~CDAQMXAOPWMData Destructs an object.
Structure Manipulation
getMXAOPWMData Gets the data in a structure. setMXAOPWMData Sets the data in a structure. initMXAOPWMData Initializes the data in a structure.
Member Data Manipulation
initialize Initializes the data member. getAOPWMValid Gets the Boolean value. getAOPWMValue Gets the output data value. setAOPWM Sets AO/PWM data.
Operator
operator= Executes substitution.
Utilities
toAOPWMValue Converts the output values to output data values. toRealValue Converts the output data values to output values. isObject Checks an object.
Protected Members
Data Members
m_MXAOPWMData The AO/PWM data storage field.
Member Access
getMXAOPWM Gets the AO/PWM data structure for each channel.
2-70 IM MX190-01E
Private Members
None.
Member Functions
CDAQMXAOPWMData::CDAQMXAOPWMData
Syntax
CDAQMXAOPWMData(MXAOPWMData * pMXAOPWMData = NULL); virtual ~CDAQMXAOPWMData(void);
Parameters
pMXAOPWMData Specify AO/PWM data.
Description
Constructs or destructs an object. When constructing, the data member is set to the specified value. If not specified, the data member is initialized.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Reference
setMXAOPWMData
CDAQMXAOPWMData::getAOPWMValid
Syntax
int getAOPWMValid(int aopwmNo);
Parameters
aopwmNo Specify the AO/PWM data number.
Description
Gets the Boolean value of the specified data number from the data member. If it does not exist, Invalid is returned.
Return value
Returns a Boolean value.
Reference
getMXAOPWM
2-71
2.5 Details of the MX100 Class
CDAQMXAOPWMData::getAOPWMValue
Syntax
int getAOPWMValue(int aopwmNo);
Parameters
aopwmNo Specify the AO/PWM data number.
Description
Gets the output data value of the specified data number from the data member. Returns 0 if it does not exist.
Return value
Returns the output data value.
Reference
getMXAOPWM
CDAQMXAOPWMData::getMXAOPWM
Syntax
MXAOPWM * getMXAOPWM(int aopwmNo);
Parameters
aopwmNo Specify the AO/PWM data number.
Description
Gets the structure of the specified data number from the data member. Returns NULL if it does not exist.
Return value
Returns a pointer to the structure.
CDAQMXAOPWMData::getMXAOPWMData
Syntax
void getMXAOPWMData(MXAOPWMData * pMXAOPWMData);
Parameters
pMXAOPWMData Specify the destination where the AO/PWM data is to be
returned.
Description
Gets the data in a structure. Stores the contents of the data member in the specified structure.
CDAQMXAOPWMData::initialize
Syntax
virtual void initialize(void);
Description
Initializes the data member. The default value as a general rule is 0.
Reference
initMXAOPWMData
2-72 IM MX190-01E
CDAQMXAOPWMData::initMXAOPWMData
Syntax
static void initMXAOPWMData(MXAOPWMData * pMXAOPWMData);
Parameters
pMXAOPWMData Specify AO/PWM data field.
Description
Initializes the specified field. The default value as a general rule is 0.
CDAQMXAOPWMData::isObject
Syntax
virtual int isObject(const char * classname = "CDAQMXAOPWMData");
Parameters
classname Specify the class name using a string.
Description
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Checks whether the specified class name was inherited. If parameters are omitted, checks whether it is this class. Classes that inherit this class must be overridden in order to check their own classes. Returns true (valid) if the class was inherited. Otherwise, returns false (invalid).
Return value
Returns a Boolean value.
CDAQMXAOPWMData::operator=
Syntax
CDAQMXAOPWMData & operator=(CDAQMXAOPWMData & cMXAOPWMData);
Parameters
cMXAOPWMData Specify an object for substitution.
Description
Copies the data member of the specified object.
Return value
Returns the reference to the object.
2-73
2.5 Details of the MX100 Class
CDAQMXAOPWMData::setAOPWM
Syntax
void setAOPWM(int aopwmNo, int bValid, int iAOPWMValue);
Parameters
aopwmNo Specify the AO/PWM data number. bValid Specify the Boolean value. iAOPWMValue Specify the output data value.
Description
Stores the specified value in the field indicated by the specified data number of the data member. If the data number is set to the constant for “Specify All AO/PWM data numbers,” the same value is stored to all data.
Reference
getMXAOPWM
CDAQMXAOPWMData::setMXAOPWMData
Syntax
void setMXAOPWMData(MXAOPWMData * pMXAOPWMData);
Parameters
pMXAOPWMData Specify AO/PWM data.
Description
Sets the data in a structure. Stores the contents of the specified structure in the data member. If not specified, the data member is initialized.
Reference
initMXAOPWMData
CDAQMXAOPWMData::toAOPWMValue
Syntax
static int toAOPWMValue(double realValue, int iRangeAOPWM);
Parameters
realValue Specify the output value. iRangeAOPWM Specify the range type of the AO or PWM range.
Description
Converts the output values to output data values according to the specified range type. Returns 0 if the range type is invalid.
Return value
Returns the output data value.
2-74 IM MX190-01E
CDAQMXAOPWMData::toRealValue
Syntax
static double toRealValue(int iAOPWMValue, int iRangeAOPWM);
Parameters
iAOPWMValue Specify the output data value. iRangeAOPWM Specify the range type of the AO or PWM range.
Description
Converts the output data values to output values according to the specified range type. Returns 0 if the range type is invalid.
Return value
Returns the output value.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
2-75
2.5 Details of the MX100 Class
CDAQMXBalanceData Class
This class stores the initial balance data of the MX100. It is a wrapper class of the MXBalanceData structure. It is a group of initial balance data of all the channels. Each data can be accessed by initial balance data number. The initial balance number is the number of the strain channel. This class can be used as an interface for setting and retrieving initial balance data.
Public Members
Construct/Destruct
CDAQMXBalanceData Constructs an object. ~CDAQMXBalanceData Destructs an object.
Structure Manipulation
getMXBalanceData Gets the data in a structure. setMXBalanceData Sets the data in a structure. initMXBalanceData Initializes the data in a structure.
Member Data Manipulation
initialize Initializes the data member. getBalanceValid Gets the Boolean value. getBalanceValue Gets the initial balance value. setBalance Sets initial balance data.
Operator
operator= Executes substitution.
Utilities
isObject Checks an object.
Protected Members
Data Members
m_MXBalanceData Field for storing the initial balance data.
Member Access
getMXBalance Gets the initial balance data structure for each channel.
2-76 IM MX190-01E
Private Members
None.
Member Functions
CDAQMXBalanceData::CDAQMXBalanceData
Syntax
CDAQMXBalanceData(MXBalanceData * pMXBalanceData = NULL); virtual ~CDAQMXBalanceData(void);
Parameters
pMXBalanceData Specify initial balance data.
Description
Constructs or destructs an object. When constructing, the data member is set to the specified value. If not specified, the data member is initialized.
2.5 Details of the MX100 Class
2
MX100 -Visual C++
Reference
setMXBalanceData
CDAQMXBalanceData::getBalanceValid
Syntax
int getBalanceValid(int balanceNo);
Parameters
balanceNo Specify the initial balance data number.
Description
Gets the Boolean value of the specified data number from the data member. If it does not exist, Invalid is returned.
Return value
Returns a Boolean value.
Reference
getMXBalance
2-77
Loading...