Cat. No. W381-E1-03 3G8F7-DRM21-E DeviceNetTM PCI Board OPERATION MANUAL Trademarks and Copyrights COMBICON is a registered trademark of the Phoenix Contact Company. ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA. Pentium is a trademark of the Intel Corporation. Windows, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows 7, Visual C++, and Visual Basic are registered trademarks of the Microsoft Corporation. Other product names and company names in this manual are trademarks or registered trademarks of their respective companies. The copyright of the DeviceNet PCI Board and related software belongs to OMRON Corporation. 3G8F7-DRM21-E DeviceNet TM PCI Board Operation Manual Revised September 2013 iv Notice: OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual. The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided with them. Failure to heed precautions can result in injury to people or damage to property. !DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Additionally, there may be severe property damage. !WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or serious injury. Additionally, there may be severe property damage. !Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury, or property damage. OMRON Product References All OMRON products are capitalized in this manual. The word “Unit” is also capitalized when it refers to an OMRON product, regardless of whether or not it appears in the proper name of the product. The abbreviation “Ch,” which appears in some displays and on some OMRON products, often means “word” and is abbreviated “Wd” in documentation in this sense. Visual Aids The following headings appear in the left column of the manual to help you locate different types of information. Note Indicates information of particular interest for efficient and convenient operation of the product. 1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc. OMRON, 2000 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of OMRON. No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication. v vi TABLE OF CONTENTS PRECAUTIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 3 4 5 6 7 xiii Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operating Environment Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conformance to EC Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv xiv xiv xv xvi xvii xviii SECTION 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1-1 Product Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-2 DeviceNet PCI Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-3 Scanner SDK Functions and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1-4 Scanner SDK Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1-5 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1-6 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1-7 Board Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1-8 Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 SECTION 2 Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2-1 Installation Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2-2 Installing the Board in the Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2-3 Installing the Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2-4 Installing the Scanner SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2-5 DeviceNet Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 SECTION 3 Using API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3-1 Application Development Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3-2 API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3-3 Checking Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3-4 Checking for Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-5 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-6 Using I/O Communications Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3-7 Using the Explicit Message Client Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3-8 Using the Explicit Message Server Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 3-9 Reset Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 3-10 Error Log Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 3-11 PC Watchdog Timer Management Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 vii TABLE OF CONTENTS SECTION 4 API Function Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4-1 Function Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4-2 Board Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4-3 Board Management API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4-4 Master Function API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4-5 Slave Function API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4-6 Explicit Message API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4-7 Maintenance API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 SECTION 5 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 5-1 Sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 5-2 Using DeviceNet Scanner Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 SECTION 6 Communications Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 6-1 Remote I/O Communications Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 SECTION 7 Error Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 7-1 LED Indicators and Error Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 7-2 Identifying Errors Detected by Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 7-3 Error Log Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 viii About this Manual: This manual describes the installation and operation of the 3G8F7-DRM21-E DeviceNet PCI Board and includes the sections described below. Please read this manual carefully and be sure you understand the information provided before attempting to install and operate the 3G8F7-DRM21-E DeviceNet PCI Board. Section 1 provides an overview of the DeviceNet PCI Board’s functions, specifications, and system configurations. Section 2 explains how to set the DeviceNet PCI Board’s board ID, install the Board in the computer, and connect the communications cable. Section 3 explains how to install the DeviceNet PCI Board’s drivers and Scanner SDK software. Section 4 provides flowcharts showing how to use the API functions as well as precautions to observe when using the API functions. Refer to this section when actually writing the applications required to use the DeviceNet PCI Board. Section 5 provides details on the various API functions in the BusDScan.DLL that are used with the DeviceNet PCI Board. Section 6 describes the sample programs that have been provided as reference when writing programs for the DeviceNet PCI Board. Section 7 describes communications timing in remote I/O communications and message communications. Section 8 describes troubleshooting and error processing procedures needed to identify and correct errors that can occur during DeviceNet PCI Board operation. !WARNING Failure to read and understand the information provided in this manual may result in personal injury or death, damage to the product, or product failure. Please read each section in its entirety and be sure you understand the information provided in the section and related sections before attempting any of the procedures or operations given. ix Terms and Conditions Agreement Read and understand this Manual Please read and understand this catalog before purchasing the products. Please consult your OMRON representative if you have any questions or comments. Warranty, Limitations of Liability Warranties z Exclusive Warranty Omron’s exclusive warranty is that the Products will be free from defects in materials and workmanship for a period of twelve months from the date of sale by Omron (or such other period expressed in writing by Omron). Omron disclaims all other warranties, express or implied. z Limitations OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE. Omron further disclaims all warranties and responsibility of any type for claims or expenses based on infringement by the Products or otherwise of any intellectual property right. z Buyer Remedy Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal to the purchase price of the non-complying Product; provided that in no event shall Omron be responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products unless Omron’s analysis confirms that the Products were properly handled, stored, installed and maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies shall not be liable for the suitability or unsuitability or the results from the use of Products in combination with any electrical or electronic components, circuits, system assemblies or any other materials or substances or environments. Any advice, recommendations or information given orally or in writing, are not to be construed as an amendment or addition to the above warranty. See http://www.omron.com/global/ or contact your Omron representative for published information. Limitation on Liability; Etc OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT, WARRANTY, NEGLIGENCE OR STRICT LIABILITY. Further, in no event shall liability of Omron Companies exceed the individual price of the Product on which liability is asserted. x Application Considerations Suitability of Use Omron Companies shall not be responsible for conformity with any standards, codes or regulations which apply to the combination of the Product in the Buyer’s application or use of the Product. At Buyer’s request, Omron will provide applicable third party certification documents identifying ratings and limitations of use which apply to the Product. This information by itself is not sufficient for a complete determination of the suitability of the Product in combination with the end product, machine, system, or other application or use. Buyer shall be solely responsible for determining appropriateness of the particular Product with respect to Buyer’s application, product or system. Buyer shall take application responsibility in all cases. NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM. Programmable Products Omron Companies shall not be responsible for the user’s programming of a programmable Product, or any consequence thereof. Disclaimers Performance Data Data presented in Omron Company websites, catalogs and other materials is provided as a guide for the user in determining suitability and does not constitute a warranty. It may represent the result of Omron’s test conditions, and the user must correlate it to actual application requirements. Actual performance is subject to the Omron’s Warranty and Limitations of Liability. Change in Specifications Product specifications and accessories may be changed at any time based on improvements and other reasons. It is our practice to change part numbers when published ratings or features are changed, or when significant construction changes are made. However, some specifications of the Product may be changed without any notice. When in doubt, special part numbers may be assigned to fix or establish key specifications for your application. Please consult with your Omron’s representative at any time to confirm actual specifications of purchased Product. Errors and Omissions Information presented by Omron Companies has been checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical or proofreading errors or omissions. xi xii PRECAUTIONS This section provides general precautions for using the DeviceNet PCI Board and related devices. The information contained in this section is important for the safe and reliable application of the DeviceNet PCI Board. You must read this section and understand the information contained before attempting to set up or operate a DeviceNet PCI Board as part of a control system. 1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv 2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv 3 Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv 4 Operating Environment Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv 5 Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi 6 Conformance to EC Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii 6-1 Applicable Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii 6-2 Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii 6-3 Conformance to EC Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii 7 xiii 1 Intended Audience 1 Intended Audience This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent). • Personnel in charge of installing FA systems. • Personnel in charge of designing FA systems. • Personnel in charge of managing FA systems and facilities. 2 General Precautions The user must operate the product according to the performance specifications described in the operation manuals. Before using the product under conditions which are not described in the manual or applying the product to nuclear control systems, railroad systems, aviation systems, vehicles, combustion systems, medical equipment, amusement machines, safety equipment, and other systems, machines, and equipment that may have a serious influence on lives and property if used improperly, consult your OMRON representative. Make sure that the ratings and performance characteristics of the product are sufficient for the systems, machines, and equipment, and be sure to provide the systems, machines, and equipment with double safety mechanisms. This manual provides information for installing and operating the DeviceNet PCI Board. Be sure to read this manual before operation and keep this manual close at hand for reference during operation. !WARNING It is extremely important that all control products be used for the specified purpose and under the specified conditions, especially in applications that can directly or indirectly affect human life. You must consult with your OMRON representative before applying an OMRON control system to the abovementioned applications. 3 Safety Precautions !WARNING Never attempt to disassemble the Board or touch the Board while power is being supplied. Doing so may result in serious electrical shock or electrocution. !WARNING Provide safety measures in external circuits, i.e., not in the Programmable Controller (CPU Unit including associated Units; referred to as “PLC”), in order to ensure safety in the system if an abnormality occurs due to malfunction of the PLC or another external factor affecting the PLC operation. Not doing so may result in serious accidents. 1,2,3... 1. Emergency stop circuits, interlock circuits, limit circuits, and similar safety measures must be provided in external control circuits. 2. The PLC will turn OFF all outputs when its self-diagnosis function detects any error or when a severe failure alarm (FALS) instruction is executed. Unexpected operation, however, may still occur for errors in the I/O control section, errors in I/O memory, and other errors that cannot be detected by the self-diagnosis function. As a countermeasure for all such errors, external safety measures must be provided to ensure safety in the system. xiv Operating Environment Precautions 4 3. The PLC outputs may remain ON or OFF due to deposition or burning of the output relays or destruction of the output transistors. As a countermeasure for such problems, external safety measures must be provided to ensure safety in the system. 4. When the 24-VDC output (service power supply to the PLC) is overloaded or short-circuited, the voltage may drop and result in the outputs being turned OFF. As a countermeasure for such problems, external safety measures must be provided to ensure safety in the system. !WARNING The CPU Unit refreshes I/O even when the program is stopped (i.e., even in PROGRAM mode). Confirm safety thoroughly in advance before changing the status of any part of memory allocated to I/O Units, Special I/O Units, or CPU Bus Units. Any changes to the data allocated to any Unit may result in unexpected operation of the loads connected to the Unit. Any of the following operation may result in changes to memory status. • Transferring I/O memory data to the CPU Unit from a Programming Device. • Changing present values in memory from a Programming Device. • Force-setting/-resetting bits from a Programming Device. • Transferring I/O memory files from a Memory Card or EM file memory to the CPU Unit. • Transferring I/O memory from a host computer or from another PLC on a network. !Caution Confirm safety at the destination node before transferring a program to another node or changing contents of the I/O memory area. Doing either of these without confirming safety may result in injury. 4 Operating Environment Precautions Do not install the PCI Board in any of the following locations. • Locations subject to direct sunlight. • Locations subject to temperatures or humidities outside the range specified in the specifications. • Locations subject to condensation as the result of severe changes in temperature. • Locations subject to corrosive or flammable gases. • Locations subject to dust (especially iron dust) or salt. • Locations subject to exposure to water, oil, or chemicals. • Locations subject to shock or vibration. Provide proper shielding when installing in the following locations: • Locations subject to static electricity or other sources of noise. • Locations subject to strong electromagnetic fields. • Locations subject to possible exposure to radiation. • Locations near to power supply lines. xv 5 Application Precautions 5 Application Precautions Observe the following precautions when using the DeviceNet PCI Board. • Install failsafe safety mechanisms to provide safety in the event of incorrect signals that may result from signal line disconnections or power interruptions. • Always use the power supply voltage specified in this manual. • Mount the Board only after checking the connectors and terminal blocks completely. • Take appropriate measures to ensure that the specified power with the rated voltage and frequency is supplied in places where the power supply is unstable. An incorrect power supply may result in malfunction. • Always connect to a ground of 100 Ω or less when installing. Not connecting to a ground of 100 Ω or less may result in electric shock. • Install external breakers and take other safety measures against short-circuiting in external wiring. Insufficient safety measures against short-circuiting may result in burning. • Always turn OFF the power supply to the computer or slave before attempting any of the following. Not turning OFF the power supply may result in malfunction or electric shock. • Mounting or dismounting DeviceNet PCI Board. • Setting rotary switches. • Assembling the Boards. • Connecting cables or wiring the system. • Connecting or disconnecting the connectors. • Do not attempt to disassemble, repair, or modify any product. • Be sure that all the board mounting screws, cable screws, and cable connector screws are tightened to the torque specified in the relevant manuals. Incorrect tightening torque may result in malfunction. • Use crimp terminals for wiring. Do not connect bare stranded wires directly to terminals. • Double-check all the wiring and switch settings before turning ON the power supply. • Wire all connections correctly. • Observe the following precautions when wiring the cable. • Separate the communications cables from the power lines or high-tension lines. • Do not bend the communications cables. • Do not pull on the communications cables. • Do not place heavy objects on top of the communications cables. • Be sure to wire communications cable inside ducts. • Place communications cables in ducts. • Use the specified communications cables. • Always wire communications and signal lines within the specified connection distances. • Before touching the Board, be sure to first touch a grounded metallic object in order to discharge any static built-up. Not doing so may result in malfunction or damage. xvi 6 Conformance to EC Directives • Test the operation of the ladder program and other user programs completely before starting actual system operation. • Always transfer the contents of any required DM Area words, HR Area words, parameters, or other data to CPU Units, CPU Bus Units, and Special I/O Units before restarting operating after replacing any of these Units. • Be sure that the communications cable connectors, and other items with locking devices are properly locked into place. Improper locking may result in malfunction. • Do not touch circuit boards or the components mounted to them with your bare hands. There are sharp leads and other parts on the boards that may cause injury if handled improperly. • When transporting or storing the product, cover the PCBs with electrically conductive materials to prevent LSIs and ICs from being damaged by static electricity, and also keep the product within the specified storage temperature range. • When transporting or storing circuit boards, cover them in antistatic material to protect them from static electricity and maintain the proper storage temperature. • Always enable the scan list before operating the control system. • Check the baud rate of any new node added to an existing network to be sure that it agrees with the rest of the network. • Do not use the computer’s standby or sleep function while you are using the DeviceNet PCI Board Scanner. If the computer’s standby or sleep function is activated during Scanner usage, communications may be broken or other unexpected errors may occur. • The DeviceNet PCI Board Scanner does not support computer standby or sleep functions. Do not use the computer’s standby or sleep function while you are using the DeviceNet PCI Board Scanner. 6 6-1 Conformance to EC Directives Applicable Directives • EMC Directives 6-2 Concepts EMC Directives OMRON devices that comply with EC Directives also conform to the related EMC standards so that they can be more easily built into other devices or machines. The actual products have been checked for conformity to EMC standards. (See the following note.) Whether the products conform to the standards in the system used by the customer, however, must be checked by the customer. EMC-related performance of the OMRON devices that comply with EC Directives will vary depending on the configuration, wiring, and other conditions of the equipment or control panel in which the OMRON devices are installed. The customer must, therefore, perform final checks to confirm that devices and the overall machine conform to EMC standards. Note Applicable EMC (Electromagnetic Compatibility) standards are as follows: xvii 7 Components EMS (Electromagnetic Susceptibility): EN61131-2 EMI (Electromagnetic Interference): EN61000-6-4 (Radiated emission: 10-m regulations) 6-3 Conformance to EC Directives DeviceNet products that meet EC directives must be installed as follows: 1,2,3... 1. Used reinforced insulation or double insulation for the DC power supplies used for the communications power supply, internal circuit power supply, and the I/O power supplies. 2. DeviceNet products that meet EC directives also meet the common emission standard (EN61000-6-4). When DeviceNet products are built into equipment, however, the measure necessary to ensure that the standard is met will vary with the overall configuration of the control panel, the other devices connected to the control panel, and other conditions. You must therefore confirm that EC directives are met for the overall machine or device, particularly for the radiated emission requirement (10 m). The following examples show means of reducing noise. 1,2,3... 1. Noise from the communications cable can be reduced by installing a ferrite core on the communications cable within 10 cm of the DeviceNet PCI Board. Ferrite Core (Data Line Filter): 0443-164151 (manufactured by Nisshin Electric Co.) Impedance Specifications 25 MHz: 156 Ω 100 MHz: 250 Ω 33 mm 30 mm 13 mm 29 mm Contact: Nisshin Electric Co., Sales Department No. 3 Tel: +81 4-2934-4151 Fax: +81 4-2934-4155 2. Keep DeviceNet communications cables as short as possible and ground to 100 Ω min. 7 Components Be sure that you have received the following components. • One PCI Board (with communications connector) • One installation disk (CD-ROM) for Scanner SDK • One operation manual (this manual) • One User Registration Card (which also serves as the software usage license agreement) xviii SECTION 1 Introduction This section provides an overview of the DeviceNet Scanner SDK functions, specifications, and system configurations. 1-1 Product Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-2 DeviceNet PCI Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1-3 Scanner SDK Functions and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1-4 Scanner SDK Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1-4-1 I/O Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1-4-2 Message Communications Function . . . . . . . . . . . . . . . . . . . . . . . . . 5 1-4-3 Maintenance Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1-5 1-6 Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1-6-1 DeviceNet PCI Board General Specifications . . . . . . . . . . . . . . . . . 8 1-6-2 DeviceNet Communications Specifications . . . . . . . . . . . . . . . . . . . 8 1-6-3 Scanner SDK Communications Specifications . . . . . . . . . . . . . . . . . 9 1-6-4 Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1-6-5 Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1-7 Board Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1-8 Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1 Section 1-1 Product Configuration 1-1 Product Configuration The 3G8F7-DRM21-E DeviceNet PCI Board includes the PCI Board (hardware) and the Scanner SDK software on CD-ROM. 3G8F7-DRM21-E DeviceNet PCI Board Scanner PCI Board 1-2 Scanner SDK DeviceNet PCI Board The PCI Board is used as an interface to other software, such as the DeviceNet Configurator, NetXServer, and Analyzer. DeviceNet PCI Board Scanner DeviceNet Scanner SDK DeviceNet Scanner SDK WS02-CFDC1-E DeviceNet Configurator DeviceNet Configurator [email protected] NetXServer for DeviceNet NetXServer for DeviceNet WS02-ALDF-E DeviceNet Analyzer DeviceNet Analyzer The DeviceNet Scanner SDK (this product) is a library for developing applications that operate as DeviceNet Masters or Slaves. It is supplied as a DLL file for a Windows environment. Use the Scanner SDK to develop Master/Slave applications with industryleading performance and functions. 2 Scanner SDK Functions and Features DeviceNet Configurator Section 1-3 The DeviceNet Configurator is a Windows-based application that supports construction of DeviceNet networks. The Configurator is used not only for setting parameters and monitoring OMRON Master and Slave devices, but also for setting parameters for slaves from other manufacturers, simply by installing the EDS files. The Configurator provides extensive support for managing networks, from design through to maintenance. NetXServer for DeviceNet The NetXServer is middleware that operates in a Windows environment. The NetXServer collects I/O data from a DeviceNet network and provides it to monitoring and other applications. It operates as a DDE server. NetXServer enables I/O data monitoring without affecting Master or Slave communications. The following two types of NetXServer are available: DDE Edition: For monitoring I/O data using a DDE client (e.g., Microsoft Excel) SDK Edition: Library for developing monitoring applications using NetXServer functions DeviceNet Analyzer The DeviceNet Analyzer is a Windows-based application for analyzing message frames on a DeviceNet network. The DeviceNet Analyzer can display the message frames being transmitted on a network and indicate traffic status. It can be used to find the source of errors and for developing DeviceNet-compatible devices. 1-3 Scanner SDK Functions and Features DeviceNet Communications Functions The Scanner SDK is equipped with the following communications functions. • I/O communications functions that exchange I/O data with other DeviceNet nodes: DeviceNet Master function DeviceNet Slave function • DeviceNet explicit messaging functions (client and server functions) In addition to the communications functions above, the Scanner SDK has a status function that reads the status of the node (Master/Slave) and the network and an error log function that records errors and their time of occurrence. Note The DeviceNet network is capable of exchanging I/O with distant Slaves through a single cable. Moreover, Slaves and other Masters can be controlled and monitored by sending and receiving explicit messages. Refer to the DeviceNet Operation Manual (W267) for more details. In this manual, the “client” is the node that sends a message requesting services and the “server” is the node that receives the message, performs the requested processing, and returns a response. DeviceNet Communications Features The Scanner SDK has the following features: Exchange I/O Data with DeviceNet Slaves The status of I/O points on DeviceNet Slaves is mirrored in the DeviceNet PCI Board. I/O can be performed with a specified Slave by calling the functions for reading and writing I/O data. 3 Section 1-4 Scanner SDK Functions Use Other Vendor’s DeviceNet-compatible Devices DeviceNet is a worldwide standard, so any manufacturer’s Slave can be connected as long as it is DeviceNet compatible. I/O Capacity of 37,800 Bytes for Up To 63 Slaves The Scanner SDK provides 37,800 bytes for I/O allocation to up to 63 Slaves (input: 25,200 bytes; output: 12,600 bytes). Use API Functions to Control Devices All Scanner SDK functions are provided as API functions. User applications are created using the API functions. Check Events with Windows Messaging or Polling Events can be checked in two ways: automatic notification by Windows messaging and monitoring (polling) of the Board’s event queue by user applications. Use the method most appropriate for each application. Computer Application program API functions PCI Board One-cable, reduced wiring Max. network length of 500 m Other company's Slaves can be connected. DeviceNet communications cable T-branch Tap Output Slave T-branching and multidrop wiring can be combined freely. Relay Solenoid Input Slave Switch Sensor Connect up to 63 DeviceNet Slaves. 1-4 1-4-1 Scanner SDK Functions I/O Communications Master Function The Scanner SDK Master function provides two 200-byte input areas (100 words or 1,600 points) and one 200-byte output area (100 words or 1,600 points) for allocation to each slave. I/O communications are executed according to the scan list registered by the Scanner SDK. Scan lists record information such as the number of input and output bytes for each slave. 4 Section 1-4 Scanner SDK Functions Maximum Numbers of I/O Points and Slaves The following table shows the max. number of I/O points, max. number of Slaves, and max. number of I/O connections allowed by the Scanner SDK’s Master function. Item Max. number of I/O points Max. number of I/O points per Slave Max. number of Slaves Max. number of I/O connections per Slave Note Slave Function Specification Input: 25,200 bytes (= 12,600 words or 201,600 points) Output: 12,600 bytes (= 6,300 words or 100,800 points) Input: 200 bytes × 2 (= 100 words × 2 or 1,600 points × 2) Output: 200 bytes (= 100 words or 1,600 points) 63 Slaves (Node addresses 0 to 63 can be used.) 2 max. Two input areas have been provided for each slave, but normally only the first area is used. If two connections are used at the same time, then the second input area can be used. The Scanner SDK Slave function provides two 200-byte input areas (100 words or 1,600 bits) and one 200-byte of output area (100 words or 1,600 bits). The following methods can be used to register the Master in the slave scan list. 1,2,3... 1. Use functions to register Slaves individually or in a group. 2. Register Slaves in a group by specifying a parameter file that was created with the OMRON DeviceNet Configurator. A slave scan list must be registered in the Scanner SDK for nodes to operate as Slaves. Maximum Numbers of I/O Points and Masters The following table shows the max. number of I/O points and max. number of Masters allowed by the Scanner SDK’s Slave function. Item Specification Max. number of I/O points Input: 200 bytes × 2 (= 100 words × 2 or 1,600 points × 2) Output: 200 bytes (= 100 words or 1,600 points) Max. number of Masters 1 Master Note 1-4-2 Two input areas have been provided, but normally only the first area is used. If two connections are used at the same time, then the second input area can be used. Message Communications Function Explicit Message Communications The DeviceNet PCI Board supports explicit message communications. As a client, the DeviceNet PCI Board can send explicit messages to control or monitor other nodes in the DeviceNet network when necessary. As a server, the DeviceNet PCI Board can receive explicit messages from other nodes. (The requested processing and responses must be handled in user applications.) Explicit message communications can be used to freely communicate with DeviceNet-compatible devices produced by other companies. 5 Section 1-4 Scanner SDK Functions Maximum Number of Connections 1-4-3 The following table shows maximum number of connections allowed. Item Specification Max. number of client connec- 63 connections (1 connection per server) tions Max. number of server con4 connections (1 connection per client) nections Maintenance Functions Read Status Functions The DeviceNet PCI Board can read the following information, including settings and the operating status of the nodes (Master/Slaves) and network. • Scanner SDK’s DLL version • DeviceNet PCI Board’s driver version • Whether or not the DeviceNet PCI Board is installed • Network status • Operational status in the network/status in remote I/O communications • Communications status • Whether or not each Slave is registered in the scan list • Each Slave’s device status Reset Function The DeviceNet PCI Board can be reset (initialized) with a command from the computer. Communications Cycle Time Management This function can set the communications cycle time (interval between the exchange of the Slave’s I/O) and read or clear the minimum and maximum values. Error Log The DeviceNet PCI Board has an error log function that records information on errors that occur during operation. The error log can be checked to pinpoint errors for faster error processing and recovery. PC Watchdog Timer Management Remote I/O can be made to stop automatically if the application that controls the DeviceNet PCI Board stops for some reason. The Board’s PC watchdog timer is refreshed regularly from the computer (application) to notify the Board that the application is operating normally. 6 Section 1-5 System Configuration 1-5 System Configuration The following diagram shows the various device connections allowed. Input Slave Trunk line (A cable with terminators connected on both ends.) PCI Board DeviceNet Cable Output Slave Slave connected by the multi-drop method Slave connected by the T-branch method using a T-branch Tap T-branch Tap with terminator installed Note Output Slave Input Slave Drop line (A cable branching from the trunk line, 6 m max.) Refer to the following manuals for information on Slaves. • DRT2 Series DeviceNet Slave Operation Manual (W404) • C200HW-DRT21, CQM1-DRT21, and DRT1 Series DeviceNet Slave Operation Manual (W347) • DRT1-COM and GT1 Series DeviceNet MULTIPLE I/O TERMINAL Operation Manual (W348) Baud Rate and Distance The following table shows the relationship between the baud rate and communications distance in the DeviceNet network. Baud rate 500 kbps 250 kbps 125 kbps Slave Connection Methods Maximum network length Thick cable Thin cable 100 m max. 100 m max. 250 m max. 500 m max. Drop line length 6 m max. Total drop line length 39 m max. 78 m max. 156 m max. Slave devices can be connected in two ways. These connection methods can be combined in the same network. Method T-branch Method Multi-drop Method Note Description Slaves are connected to a drop line from the trunk line or branch line created with a T-branch Tap. Slaves are directly connected to the trunk line or the drop line. Refer to the DeviceNet Operation Manual (W267) for details on connection methods and grounding. 7 Section 1-6 Specifications 1-6 1-6-1 Specifications DeviceNet PCI Board General Specifications Item Dimensions Operating voltage range Current consumption Specifications 119.9 × 106.7 mm (W × H) 5 VDC ± 5% (3.3 VDC is not used.) Internal power supply: 290 mA max. at 5 VDC Communications power supply: 30 mA max. at 24 VDC Vibration resistance 10 to 57 Hz, 0.075-mm double amplitude, 57 to 150 Hz, acceleration: 9.8 m/s2 in X, Y, and Z directions for 80 minutes each (Time coefficient; 8 minutes × coefficient factor 10 = total time 80 minutes) DIN Track installation: 2 to 55 Hz, 2.94 m/s2 in X, Y, and Z directions for 20 minutes each Shock resistance Humidity Atmosphere Weight 147 m/s2 three times each in X, Y, and Z directions Operating: 0 to 55°C Storage: –20 to 60°C 10% to 90% (with no condensation) Must be free from corrosive gas 91 g max. Max. number of Boards 3 Boards/computer max. Ambient temperature The DeviceNet PCI Board conforms to PCI Local Bus Specification Rev. 2. 1-6-2 DeviceNet Communications Specifications Item Communications protocol Connection forms Specification DeviceNet Multi-drop and T-branch connections can be used for trunk or drop lines. Terminators must be connected at both ends of the trunk line. Baud rate 500 kbps, 250 kbps, or 125 kbps (Specified with the SCAN_Online function.) Communications media Special 5-wire cables (2 signal lines, 2 power lines, 1 shield line) Communica500 kbps Network length: 100 m max. tions distances Drop line length: 6 m max. Total drop line length: 39 m max. 250 kbps Network length: 250 m max. (see note 1) Drop line length: 6 m max. Total drop line length: 78 m max. 125 kbps Network length: 500 m max. (see note 1) Drop line length: 6 m max. Total drop line length: 156 m max. Communications power supply 11 to 24 VDC, 30 mA (supplied through the communications connector) Max. number of Slaves 63 Slaves Communications cycle time (see Set between 1 and 500 ms with the SCAN_SetScanTimeValue() function. note 2) Error control checks CRC error check, node address duplication check, scan list verification Cable 5 conductors (two signal wires, two power supply wires, and one shield wire) Note 8 Indicates the max. length when thick cables are used. Reduce the network length to 100 m max. when using thin cables. When using both thick and thin cables together, refer to the DeviceNet Operation Manual (W267) for details on the maximum network length. Section 1-6 Specifications 1-6-3 Scanner SDK Communications Specifications Item Supported I/O connections Communications cycle time (See note.) Number of server nodes capable of simultaneous communications as explicit clients Number of client nodes capable of simultaneous communications as explicit servers Data length for explicit messages Response monitoring time for explicit messages (for clients) Retries for explicit messages Note Minimum System Requirements Specifications • Bit Strobe • Polling • Cyclic • Change of State (COS) • Explicit Peer-to-peer Messaging 2 to 500 ms (Can be specified using API functions.) 63 nodes 4 nodes Client: Explicit message request: 552 bytes Explicit message response: 552 bytes Server: Explicit message request: 552 bytes Explicit message response: 552 bytes 2 s (default) (Can be specified using API functions.) 0 (Retries must be performed by the user application.) The communications cycle time is the maximum time from when remote I/O communications are executed by the Master to a Slave until remote I/O communications are executed again for the same Slave. Hardware Requirements IBM PC/AT or Compatible • At least one PCI bus slot (PCI bus Rev. 2.0 or later) • 5 MB min. free hard disk space (plus additional space for the user program) • One CD-ROM drive is required to install the software. • VGA or better display functions. The processor, memory capacity, and other specifications not listed above should conform to the recommendations for the operating system used. OS Microsoft Windows 95, 98, Me, NT 4.0, 2000, XP, 7, 3.1, and NT 3.5 are not supported. 1-6-4 Development Environment Recommended Development Environment Other Development Environments Microsoft Visual C++ (Ver. 6.0 or later.) • Microsoft Visual Basic Some functions are limited. Refer to Precautions when Using Other Development Environments under 3-1 Application Development Environments for details. • Borland C++ Builder Refer to Refer to Precautions when Using Other Development Environments under 3-1 Application Development Environments for details. 9 Section 1-7 Board Components 1-6-5 Dimensions The following diagram shows the dimensions of the DeviceNet PCI Board. (The height of components on the Board is within specifications for a single PCI slot.) 132.3 mm 21.6 mm 119.9 mm 106.7 mm 126.4 mm 14.7 mm (The height of the component surface will fit in one PCI bus slot.) 1-7 Board Components LED indicators (MS and NS) These are the DeviceNet MS (module status) and NS (network status) indicators. Board ID switch When two or more DeviceNet PCI Boards are installed in a computer, the computer uses the board ID settings to distinguish the Boards from each other. Set unique decimal board IDs between 0 and 7. 10 Communications connector Connects the Board to the DeviceNet communications cable. PCI interface Connects the Board to the computer's PCI slot. Section 1-8 Preparation for Operation LED Indicators The following table explains the operation of the LED indicators. Indicator status MS NS OFF OFF Flashing green OFF Lit green OFF Lit green Flashing green Lit green Board ID Lit green Meaning Boot program initialization is in progress. Scanner firmware initialization is in progress. Waiting for online request. A connection was established and I/O communications are in progress. Waiting for a connection from the Master. I/O communications or message communications are in progress. When two or more DeviceNet PCI Boards are installed in a computer, the computer uses the board ID settings to distinguish the Boards from each other. Specify the board ID in API functions to identify the desired board. Set the board ID in decimal as shown in the following diagram. The allowed setting range is 0 to 7. (The factory setting is 0.) Up to 3 DeviceNet PCI Boards can be installed in one computer. Note 1-8 Any board ID from 0 to 7 can be set, as long as the ID is not set on another DeviceNet PCI Board in the computer. (It is physically possible to set board IDs 8 and 9, but the Board cannot be used properly with these settings.) Preparation for Operation Hardware Settings If more than one DeviceNet PCI Board is being installed in one computer, set the board IDs on the Boards’ rotary switches so that the different Boards can be distinguished from one another. Refer to 2-2 Installing the Board in the Computer for details. Always set the rotary switches before turning ON the computer. Installation on Computer Install the Board in the computer. Refer to 2-2 Installing the Board in the Computer for details. Software Installation Install the DeviceNet PCI Board driver and software required to use the Board from the computer. Refer to 2-3 Installing the Drivers and 2-4 Installing the Scanner SDK for details. Writing the Program Write the programs (user applications) that make software settings and control the Board. Refer to SECTION 3 Using API Functions through SECTION 7 Error Processing for details. Reference Information Refer to 2-5 DeviceNet Connections for information on communications cable connections. Refer to the DeviceNet Operation Manual (W267) for information on wiring DeviceNet networks. Refer to the DeviceNet Slave Operation Manuals (W404 and W347) and the DeviceNet MULTIPLE I/O TERMINAL Operation Manual (W348) for information on Slaves. 11 Preparation for Operation 12 Section 1-8 SECTION 2 Software Installation This section explains how to install the DeviceNet PCI Board in a computer, how to install the software, and how to connect the communications cables. 2-1 Installation Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2-2 Installing the Board in the Computer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2-3 Installing the Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2-4 Installing the Scanner SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2-5 DeviceNet Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2-5-1 Attaching Connectors to the DeviceNet Cable . . . . . . . . . . . . . . . . . 34 2-5-2 Connecting Communications Cables . . . . . . . . . . . . . . . . . . . . . . . . 36 13 Section 2-1 Installation Procedure 2-1 Installation Procedure There procedure for installing the DeviceNet PCI Board and its software is outlined below. Installing the Board in the Computer Set the board ID (rotary switch) and install the Board in the computer. Windows 95, 98, Me, 2000, XP, or 7 Windows NT 4.0 Installing the Driver Install the DeviceNet PCI Board driver. Installing the Scanner SDK Software Install the provided Scanner SDK software. Note 2-2 For Windows 2000, XP, or 7, you must log in with administrator rights to install the driver and Scanner SDK Software. Installing the Board in the Computer This section explains how to make the required settings on the DeviceNet PCI Board and install the Board in the computer. Preparation for Installation The DeviceNet PCI Board is plug-and-play compatible with MicroSoft Windows. Check the following points before installing the Board. Check point Available PCI slot IRQ conflict Note 1,2,3... Description Make sure that the computer has an available PCI slot. The DeviceNet PCI Board uses an IRQ. IRQ settings are allocated automatically to the PCI bus, but not to the ISA bus. In computers with ISA slots, the computer may not boot completely if there is an IRQ conflict with the ISA bus. In this case, make one of the following changes in the BIOS settings: • Enter the BIOS setup and specify a non plug-and-play (PnP) operating system. • Enter the BIOS setup and reserve the IRQ numbers (disable automatic allocation of these IRQ numbers) that are used by the ISA bus so that these IRQ numbers will not be allocated automatically to the PCI bus. Refer to the computer’s User’s Guide for details on entering the BIOS setup and changing the settings. (See note below for details on identifying IRQ numbers.) Use the following procedure to identify which IRQ numbers are being used by the ISA bus. 1. Start the computer without the DeviceNet PCI Board installed. 2. Start the Device Manager (Control Panel/System/Device Manager). 3. Open the properties of the relevant devices and check their IRQ (Interrupt Request) settings in the Resources tab. 14 Section 2-2 Installing the Board in the Computer Board ID Setting Set the board ID on the DeviceNet PCI Board’s rotary switch before installing the board. Note Static electricity can damage the DeviceNet PCI Board’s electronic components. Do not touch the Board’s connector or components. Set a board ID between 0 and 7. If two or more DeviceNet PCI Boards are being installed in the computer, be sure that each Board has a unique board ID setting. The factory setting is 0. Installing the Board in the Computer Note Install the DeviceNet PCI Board in one of the computer’s PCI slots. Refer to your computer’s User’s Guide for details on installing a PCI card in the computer. (1) Turn OFF the computer power supply before installing the DeviceNet PCI Board. (2) Take precautions against static electricity. 1,2,3... 1. Disconnect all cables from the DeviceNet PCI Board. 2. Turn OFF the computer in which the board is being installed and unplug the computer’s power cord. 3. Remove the computer’s case and make any other preparations needed to install a PCI board. (Refer to your computer’s User’s Guide for details.) 4. Align the Board with the computer’s PCI slot, slide it into position, and press it firmly into the slot. Check that the Board’s PCI interface is completely and evenly installed into the PCI slot. Do not use much force when pressing the board; it should slide into the slot with little resistance. (a) (b) 5. Pull on the Board lightly to check that it is installed securely and won’t slip out. 6. Secure the Board by tightening the retaining screw, indicated by (b) in the diagram, to 0.5 N⋅m. 7. Attach the case to the computer and turn ON the power. 8. The installation method differs depending on the type of Windows operating system used. Refer to the following during installation. • Windows 95, 98, Me, 2000, XP, or 7 After the computer is started, the Board will be detected as new hardware and the InstallShield Wizard will start. Refer to 2-3 Installing the Drivers for the rest of the installation procedure. • Windows NT 4.0 The PCI Board will not be recognised when the computer is started. Install the driver for the PCI Board at the same time as Scanner SDK. Refer to 2-4 Installing the Scanner SDK for the rest of the installation procedure. 15 Section 2-3 Installing the Drivers 2-3 Installing the Drivers After the Board is installed in the computer and the computer is started, the Board will be detected as new hardware (except for Windows NT computers, see note). Install the driver to ensure correct operation of the Board. The installation method and windows displayed when installing the driver will differ depending on the Windows operating system used. This section describes driver installation for Windows 98, XP, and 7. Note The Board will not be automatically detected with Windows NT 4.0. The driver must be installed with Scanner SDK. Perform the installation procedure described in 2-4 Installing the Scanner SDK. Windows 98 Installation 1,2,3... 1. After the Board is installed in the computer and the computer is started, the Board will be detected as new hardware and the Add New Hardware Wizard will start automatically as shown in the following diagram. Click the Next Button. 2. A window will be displayed to select the driver search method. Select Display a list of all ... and click the Next Button. 16 Section 2-3 Installing the Drivers 3. Select Other devices as the device type and click the Next Button. 4. Click the Have Disk Button to specify the hardware model. 17 Installing the Drivers Section 2-3 5. Insert the Scanner SDK CD-ROM disk in the CD-ROM drive. 6. Specify the CD-ROM drive’s Win98 directory as the source location and click the OK Button. (You can click the Browse Button to display a list of the actual directories and select the Win98 directory from that list. The following example window shows the CD-ROM drive as drive A.) 7. When the driver information has been read from the CD-ROM, select OMRON 3G8F7-DRM21-E PCI Adapter as shown in the following diagram. Click the Next Button. 18 Installing the Drivers Section 2-3 8. Check the displayed message and click the Next Button if the correct driver is displayed. The drivers will be installed. 9. A completion message will be displayed when installation of the Windows 98 drivers is completed. Click the Finish Button to complete the installation. 19 Section 2-3 Installing the Drivers Windows XP Installation Note 1,2,3... You must login to Windows XP with Administrator rights to install the driver. 1. After the Board is installed in the computer and the computer is started, the Board will be detected as new hardware and the Found New Hardware Wizard will start automatically as shown in the following diagram. Select Install from a list or specific location (Advanced), as shown in the following diagram, and then click the Next Button. 2. Insert the Scanner SDK CD-ROM into the CD-ROM drive. 20 Section 2-3 Installing the Drivers 3. Select Search for the best driver in these locations for the search and install option, and select the Include this location in the search option. Click the Browse Button, specify the CD-ROM drive’s Win2000 folder (see following diagram), and then click the Next Button. Note In this example, the CD-ROM drive is drive F. 4. The driver installation will start. 21 Installing the Drivers Section 2-3 5. The following window will be displayed during installation, but it does not indicate an error. Click the Continue Button to continue the installation. 6. A completion message will be displayed when installation of the driver has been completed (see diagram.) Click the Finish Button to complete the installation procedure. 22 Installing the Drivers Section 2-3 Windows 7 Installation Note 1,2,3... For Windows 7, you must log in with administrator rights to install the driver. 1. After the Board is installed in the computer, start the Device Manager. New hardware will be detected automatically. Open the Device Manager,*1 and double-click Other devices. *1.To open the Device Manager, click the Windows Start Button and select Control Panel, Hardware and Sound, and Device Manager in that order. 23 Installing the Drivers Section 2-3 2. The Network Controller will appear under Other devices. Right-click Network Controller and then select Update Driver Software from the menu. 3. How do you want to search for driver software? will be displayed. Click Browse my computer for driver software. 4. Place the CD-ROM containing the Scanner SDK into the CD-ROM drive. 24 Installing the Drivers Section 2-3 5. Browse for driver software on your computer will be displayed. Click the Browse Button, specify the Win2000 folder on the CD-ROM drive (see following figure), and click the Next Button * The following figure shows an example for which drive D is the CD-ROM drive. 6. The following dialog box will be displayed. Click Install this driver software anyway to start installation. 25 Section 2-3 Installing the Drivers 7. The installation will start. 8. A completion message (see the following figure) is displayed after the installation process is completed. Click the Close Button to complete driver installation. 26 Section 2-4 Installing the Scanner SDK 2-4 Installing the Scanner SDK This section describes how to install the Scanner SDK. Note The procedure and displays will vary with the Windows OS that you are using. This procedure is for Windows 7. To install software on Windows 7, you must log in with administrator rights. Installation Procedure 1,2,3... 1. End all applications that are currently running. 2. Place the CD-ROM containing the Scanner SDK into the CD-ROM drive. 3. Click the Windows Start Menu and select Search for programs and files. 27 Section 2-4 Installing the Scanner SDK 4. Enter d:\setup in the Search for programs and files box that is displayed. Specify the drive into which you inserted the CD-ROM drive. For example, if you inserted the CD-ROM to the F drive, enter f:\setup. 5. Click setup in the search results. 6. The User Account Control Dialog Box will be displayed. Click the Yes Button to continue unless there is a problem. 7. Installation of the software will start. The InstallShield will start preparations for installation. 28 Section 2-4 Installing the Scanner SDK 8. When the setup dialog box is displayed, click the Next Button. 9. The software license agreement will be displayed. Check all of the items in the agreement and click the Yes Button if you agree to the license agreement. If you do not agree, click the No Button. Note If you do not agree, the installation will be stopped. 29 Installing the Scanner SDK Section 2-4 10. Select the installation folder. The following folder is the default installation folder. C:\Program Files\OMRON\DeviceNet Scanner SDK To change the folder, click the Browse Button and specify the drive and folder. (If you specify a folder that does not exist, it will be created automatically.) After you specify the drive and folder, click the Next Button. A dialog box is displayed to specify the folder in which to register the program in the Windows Start Menu. 30 Installing the Scanner SDK Section 2-4 11. Specify the program folder in the Windows Start Menu in which to create a shortcut to the DeviceNet Scanner SDK. The default is to create shortcut in a program folder called DeviceNet Scanner SDK. To change the program folder, select from the existing folders or enter the folder name directly. (If the specified folder does not exist, it will be created automatically.) After you specify the drive and folder, click the Next Button. The installation will be executed and the files will be copied. The progress of the installation will be displayed as a percentage. 31 Section 2-4 Installing the Scanner SDK 12. A completion message (see the following figure) is displayed after the installation process is completed. Click the Finish Button to complete the installation. Installed Files When the Scanner SDK is installed, the following folders are created and the required files are installed. The following table shows the folders and files that are created and installed when the default folders are used.: Removing the DeviceNet Scanner SDK Software 1,2,3... Default Folder \Program Files\OMRON\DeviceNet Scanner SDK\Manual\ \Program Files\OMRON\DeviceNet Scanner SDK\Program\ \Program Files\OMRON\DeviceNet Scanner SDK\SDK\Include\ \Program Files\OMRON\DeviceNet Scanner SDK\SDK\Lib\ Contents The PDF file of this manual is installed. Execution files for the sample program are installed. A sample Include file is installed. \Program Files\OMRON\DeviceNet Scanner SDK\SDK\Sample\ A sample program is installed. The library files used for static links in Microsoft Visual C++ are installed. If the DeviceNet Scanner SDK Software is no longer needed, the files and other information can be removed with the following procedure. (Only the installed files and information will be removed. Files created later will not be removed.) 1. Select Start/Settings/Control Panel from the Windows Start Button. 2. Double-click the Add/Remove Programs Icon in the Control Panel. 3. Select DeviceNet Scanner SDK from the list. Click the Add/Remove Button. 32 Section 2-4 Installing the Scanner SDK 4. A confirmation message will be displayed. Click the OK Button to proceed. 5. Removal of the application will start. 6. During removal, messages asking if detected shared files are to be deleted may be displayed (see diagram below). • If other DeviceNet applications, such as the Configurator, NetXServer, or Analyzer, are installed, click the No Button. Do not delete the shared files. 33 Section 2-5 DeviceNet Connections • If no other DeviceNet applications are installed, click the Yes Button. The shared files can be deleted. 7. A completion message will be displayed when removal of the driver has been completed (see diagram.) Click the Finish Button to complete the installation procedure. 2-5 DeviceNet Connections Connect the DeviceNet communications cables after installing the Board. This section explains how to prepare and connect the communications cables to the DeviceNet PCI Board only. Refer to the DeviceNet Operation Manual (W267) for details on connecting cables to Slaves. 2-5-1 Attaching Connectors to the DeviceNet Cable This section explains how to attach connectors to the network communications cables. Use the following procedures prepare the communications cables and attach connectors. 34 Section 2-5 DeviceNet Connections 1,2,3... 1. Remove about 30 mm of the cable sheathing, being careful not to damage the woven shielding underneath. Do not remove too much sheathing; removing too much of the sheathing can result in short circuits and increase the effect of noise. Approx. 30 mm 2. Carefully peel back the woven shielding. The cable contains a shielding wire along with the signal lines and power lines. The shielding wire is stiffer than the woven shielding, so it can be identified by touch. Shielding wire 3. Remove the exposed woven shielding, remove the aluminum tape from the signal and power lines, and strip the covering from the signal and power lines to the proper length for the crimp terminal connectors being used. Twist the wire strands on each of the signal and power lines so that there are no loose strands. Strip to match the crimp terminals 4. Attach the crimp terminals (solderless pin terminals) to the lines and use the proper Crimping Tool to crimp the terminal securely. Crimp terminal Note We recommend using the following crimp terminals and crimping tools. • AI Series from Phoenix Contact Connector XW4B-05C1H1-D XW4B-05C1V1R-D MSTB2.5/5Cable type ST-5.08AU Thin cable Signal lines AI 0.25-6YE Power lines AI 0.5-6WH Thick Signal lines AI -6 cable Power lines AI 2.5-8BU XW4B05C4-TF-D XW4B05C4-T-D AI 0.25-8YE AI 0.5-10WH AI 10 AI 2.5-10BU XW4G05C1-H1-D XW4G05C4-TF-D Crimping Tool AI 0.25-8YE CRIMPFOX AI 0.5-10WH ZA3 AI 10 AI 2.5-10BU 35 Section 2-5 DeviceNet Connections 5. Cover the end of the cable with electrical tape or heat-shrink tubing as shown in the following diagram. Electrical tape or heat-shrink tubing 2-5-2 Connecting Communications Cables 1,2,3... 1. Remove the connector from the Board’s DeviceNet Communications Connector. (It isn’t necessary to remove the connector from the Board if it can be wired in place.) 2. Orient the connector properly and then insert the lines in order from left to right: black, blue, shield, white, and then red. Blue (CAN low) Black (-V) Red (+V) White (CAN high) Shield Note (1) Loosen the screws for securing the connector wires before inserting signal lines, power lines, or the shield wire. If the screws are not loosened sufficiently, the wires cannot be inserted into the correct position. They will enter the gap at the back where they cannot be secured in place. (2) The connector and Board have colored stickers that match the wire colors. The wire colors can be checked against the sticker color to check that the cables are wired correctly. (3) The wire colors are listed in the following table. Color Black Blue --White Red Signal Communications power supply (negative) Signal LOW side Shield Signal HIGH side Communications power supply (positive) Symbol V− CAN L S CAN H V+ 3. Tighten the line set screws for each line in the connector. Tighten the screws to a torque between 0.25 and 0.3 N⋅m. 36 Section 2-5 DeviceNet Connections You will not be able to tighten these screws with a normal screwdriver, which tapers at the end. You will need a screwdriver that does not taper at the end, such as a large precision screwdriver. When using a Thick Cable, allow sufficient cable to ensure that the tension of the cable does not disconnect the connector. Use a flat-blade screwdriver that does not taper at the end. Note The following diagram shows the dimensions of the OMRON XW4Z-00C screwdriver, which is ideal for these DeviceNet connectors. Side 0.6 mm Front 3.5 mm 4. Align the connector to the Board’s Connector and then insert the connector until it is securely set in place. Firmly tighten the screws at both ends of the connector. Tighten the connector mounting screws to a torque between 0.25 and 0.3 N⋅m. Standard Connector (Thin Cables Only) When thin cable is being used, a multi-drop connection can be made by inserting each pair of wires into a single same pin terminal and crimping them together. 37 Section 2-5 DeviceNet Connections Note We recommend using the following PHOENIX CONTACT terminal for this type of multi-drop connection. Connector XW4B-05C1-H1-D MSTB2.5/5-ST-5.08 XW4B-05C1-V1R-D Crimp terminals AI-TWIN2×0.5-8WH from Phoenix Contact XW4G-05C1-H1-D H0.5/16.5 ZH from Weidmuller Crimping Tool CRIMPFOX UD6 or CRIMPFOX ZA3 Multi-drop Connector The following OMRON Multi-drop Connectors (sold separately) can be used to make a multi-drop connection with either thin or thick cable. • XW4B-05C4-T-D Straight Multi-drop Connector without Attachment Screws • XW4B-05C4-TF-D Straight Multi-drop Connector with Attachment Screws • XW4G-05C4-TF-D Straight Multi-drop Clamp Connector with Attachment Screws In some cases, the Multi-drop Connector cannot be used because there is not enough space and other Units or connectors get in the way. Note 1. Before connecting the communications cables, turn OFF the power supply to all PCs, Slaves, and communications power supplies. 2. Use crimp terminals for wiring. Connecting bare twisted wires can cause the cables to come OFF, break, or short circuit, most likely resulting in incorrect operation and possibly damage to the Units. 3. Use suitable crimp tools and crimping methods when attaching crimp terminals. Consult the manufacturer of the tools and terminals you are using. Inappropriate tools or methods can result in broken wires. 4. Be extremely careful to wire all signal lines, power lines, and shielding wire correctly. 38 DeviceNet Connections Section 2-5 5. Tighten all set screws firmly. Tighten to a torque of between 0.25 and 0.3 N⋅m. 6. Wire the signal lines, power lines, and shielding wire so that they do not become disconnected during communications. 7. Do not pull on communications cables with excessive force. They may become disconnected or wires may break. 8. Allow leeway so that communications cables do not have to be bent further than natural. The Cables may become disconnected or wires may break if the cables are bent too far. 9. Never place heavy objects on communications cables. They may break. 10. Double-check all wiring before turning ON the power supply. 39 DeviceNet Connections 40 Section 2-5 SECTION 3 Using API Functions This section provides flowcharts showing how to use the API functions as well as precautions to observe when using the API functions. Refer to this section when actually writing the applications required to use the DeviceNet PCI Board. 3-1 Application Development Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3-2 API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3-3 Checking Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3-3-1 Board Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3-3-2 Checking for Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3-4 Checking for Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-5 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3-6 Using I/O Communications Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3-7 Using the Explicit Message Client Function . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3-8 Using the Explicit Message Server Function. . . . . . . . . . . . . . . . . . . . . . . . . . 51 3-9 Reset Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 3-10 Error Log Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 3-11 PC Watchdog Timer Management Function . . . . . . . . . . . . . . . . . . . . . . . . . . 54 41 Section 3-1 Application Development Environments 3-1 Application Development Environments Recommended Development Environment Microsoft Visual C++ (Ver. 6.0 or later) Precautions when Using Other Development Environments Whether API can be used depends on the development environment. Some examples are given below for development environments. Confirm details with the provider of the development environment. Microsoft Visual C++ Version 6.0 • API functions can be used without declaring them. Microsoft Visual Basic 6.0 • API functions other than explicit messages can be used, but they must be declared. Microsoft Visual Basic 2005 • API functions cannot be used (even if you declare them). 3-2 API Functions The PCI Board provides the following API functions. API Functions for Managing the Board Board Service API Functions Board Service API Functions check the Scanner SDK and driver versions, open/close the Board, and connect/disconnect the Board to/from the network. The PCI Board must be open and connected to the network to be used for communications. PCI Board Interrupt Service API Functions Interrupt Service API functions detect interrupts from the PCI Board. Two kinds of interrupts can be detected. Interrupt BD_WDT Name Board Watchdog Timer Timeout Interrupt SCAN One-scan (Communications Cycle) Completed Interrupt Function This interrupt occurs when the Board stops operation as a result of an error. The error can be cleared by detecting this interrupt. This interrupt occurs each time one communications cycle is completed during I/O communications. The latest input data (IN data) can be retrieved when this interrupt occurs. For interrupts to be detected, the interrupt control register must be set for the Board to send interrupts to the computer. There are two ways the computer can detect interrupts. Refer to 3-3 Checking Events for detection methods. Master API Functions Scan List Operation API Functions Slave information must be registered in a scan list to use the Master function to perform I/O communications with Slaves. The Scan List Operation API functions are used to create scan lists. Refer to Parameter Operation API Functions on page 47 for information on the relationship between a scan list and the Scan List Operation API functions. I/O Communications Service API Functions I/O Communications Service API functions are used to start and stop I/O communications using the Master function, set the communications cycle time, obtain real Slave information, etc. 42 Section 3-2 API Functions I/O Data Access Service API Functions I/O Data Access Service API functions are used to read and write I/O data. The PCI Board has two memory areas: the I/O area which can be read from or written to using functions, and the Board’s internal buffer. Only the internal buffer is used during I/O communications. Set to write all OUT data first, refresh data between the two areas, and then obtain all IN data when I/O data is to be used by user applications. Slave Function API Functions Slave Scan List Operation API Functions To use the Slave function, information to enable operation as a slave must be registered in a slave scan list. The Slave Scan List Operation API functions are used to register a slave scan list. Refer to Parameter Operation API Functions on page 47 for information on the relationship between slave scan lists and Slave Scan List Operation API function. I/O Communications Service API Functions I/O Communications Service API functions are used to temporarily stop/start I/O communications with Masters when using the Slave function. I/O Data Access Service API Functions These functions are the same as the I/O Data Access Service API functions for the Master function, but are used with the Slave function. Explicit Message API Functions Message Monitoring Timer Service API Functions The message monitoring timer monitors the time from when a explicit message request is sent until an explicit message response is received from the remote node. If the response is not be received within the response time, the request is timed out. The Message Monitoring Timer Service API functions are used to set the message monitoring timer for each remote device. The default message time is 2 s (2,000 ms). Set a longer time if the response from the remote nodes will take longer. The next request to the same device cannot be sent while waiting for a response. Client Message Service API Functions Client Message Service API functions are used to sent explicit request messages and receive responses, to set parameters for any device, and to monitor information for that device. When the Scanner SDK receives a response for the sent request, it automatically stores it in the response queue in the DLL file. There is a response queue for each remote device and the response is queued for as long as there is free memory on the computer. The response should be removed from the queue as soon as possible after it is received. Noise or other interference may cause the explicit message to be lost. Also, the message may not be received, depending on the remote device. Always enable retries when sending explicit requests. There are two methods for detecting reception of explicit response messages. Refer to 3-3 Checking Events for information on detection methods. Server Message Service API Functions Server Message Service API functions receive explicit request messages and send responses to implement any device profile. 43 Section 3-3 Checking Events When Scanner SDK receives a request addressed to a registered object, that request is automatically stored in the response queue in the DLL file. There is a response queue for each registered object and the response is queued for as long as there is free memory on the computer. The response should be removed from the queue as soon as possible after it is received. There are two methods for detecting reception of explicit request messages. Refer to 3-3 Checking Events for information on detection methods. Maintenance API Functions Status Service API Functions Status Service API functions are used to monitor errors during I/O or explicit message communications and monitor the communications cycle time for the Master function. Monitor error status when creating user applications and perform error processing as required. Error Log Access Service API Functions Error Log Access Service API functions read and clear the error log registered in the Board. Refer to 3-10 Error Log Functions for details. PC Watchdog Timer Service API Functions PC Watchdog Timer Service API functions monitor operation of user applications by the Board. Refer to 3-11 PC Watchdog Timer Management Function for details. 3-3 3-3-1 Checking Events Board Events The following table shows the kinds of events that occur in the Scanner SDK. Event Description Interrupt from Board This event occurs when an interrupt is sent from the Board to the computer. (An interrupt control register must be set.) Explicit client This event occurs when a response is received from the server response received after an explicit client request message is sent. Explicit server This event occurs when an explicit server request message is request received received for a registered object. 3-3-2 Checking for Events There are two ways to check events in the Board. Use the method that is easiest for your application and system conditions. • Detecting events with Windows messaging • Checking events by polling Detecting Events with Windows Messaging A Windows message is sent automatically when an event occurs. A thread or window can be specified as the destination for the event notification. The notification can include event specific information such as the interrupt status or reception data length. When the user application receives the event notification, it will read (receive) the event after preparing a data buffer to hold the event data. When you use Windows messaging for event notification, the notification message settings must be made in advance with the SCAN_RegIrqEvtNotifyMessage(), SCAN_RegClientEvtNotifyMessage(), and SCAN_RegServerEvtNotifyMessage() functions. 44 Section 3-4 Checking for Errors Once event notification has been received by the user application, execute the corresponding event processing. For example, when an explicit client response is received, prepare a data buffer to hold the received service data and read the response. Checking Events by Polling The event queue can be checked from a user application with the SCAN_PeekIrqEvent(), SCAN_PeekClientEvent(), and SCAN_PeekServerEvent() functions. If the check shows an event in the event queue, execute the corresponding event processing. For example, for an explicit client response event, check the received data size using the SCAN_ClientEventLength() function, prepare a data buffer to hold the received service data, and read the response. 3-4 Checking for Errors Checking for Errors with Function Return Values The value returned by the function shows whether an error occurred. The Scanner SDK’s API functions are all bool type functions and the result of the function’s execution is returned as one of the following boolean values: FALSE: The function was completed with an error. TRUE: The function was completed normally. If an error occurred, detailed error information can be obtained with the GetLastError() function. Refer to 7-2 Identifying Errors Detected by Functions for the meaning of the error codes obtained with the GetLastError() function and appropriate error processing. Note GetLastError is a Windows API function. Detailed error information can be obtained by calling GetLastError immediately after executing the DeviceNet PCI Board API function, as shown below. Example: Using GetLastError() Function with Board Open API Call DWORD dwErrCode; //DeviceNet PCI Board Open API function call if(SCAN_Open(DeviceNo,Handle)==false){ //Gets the detailed error code //when the function returns an error. dwErrCode=GetLastError(); } 3-5 Parameters Parameter Types The PCI Board has the parameters listed in the following table. Name Message Monitoring Timer List Communications Cycle Time Meaning A list of message monitoring timers for all node addresses. The monitoring time is from when the explicit request message is sent until the response is received. Used with the Master function. The communications cycle time is the cycle for I/O communications. Initial Value 0 (2 s) is set for all node addresses as the default. 0 (automatic) is set as the default. 45 Section 3-5 Parameters Name (Master) Scan List Slave Scan List 46 Meaning Used with the Master function. The scan list is the list of slave node addresses for I/O communications. The list also registers the parameters required for I/O communications for each node. Used with the Slave function. The slave scan list registers the parameters required for nodes to operate as a slave. Initial Value The default is no scan list. API functions are required to register a scan list. The default is no slave scan list. API functions are required to register a slave scan list. Section 3-5 Parameters Parameter Operation API Functions RAM (parameters actually used) Non-volatile memory (storage area) Message monitoring timer list SCAN_SetMessageTimerValue Get SCAN_GetMessageTimerValue Register (1 node) Read (1 node) Set (Whole list) SCAN_LoadMessageTimerValueList Read (Whole list) Read (Whole list) SCAN_StoreMessageTimerValueList Save (Whole list) Download Upload Communications cycle time SCAN_SetScanTimeValue Get SCAN_GetScanTimeValue Set Read SCAN_LoadScanTimeValue SCAN_StoreScanTimeValue Read Save Download Upload Configurator SCAN_RegisterSlaveDevice SCAN_Register SlaveDeviceEx Get Get Scan list Register (1 slave) SCAN_SetScanlist Register (Multiple slaves) SCAN_RemoveDevice Remove (1 slave) SCAN_GetSlaveDevice SCAN_GetSlaveDeviceEx Read (1 slave) Set (Whole list) SCAN_ClearScanlist SCAN_LoadScanlist Read (Whole list) Clear (Whole list) Read (Whole list) SCAN_StoreScanlist Save (Whole list) Download Upload Slave scan list SCAN_RegisterSelfSlaveDevice SCAN_RemoveSelfSlaveDevice Get SCAN_GetSelfSlaveDevice Set SCAN_LoadSlaveScanlist Read Clear Read SCAN_StoreSlaveScanlist Download Save Upload 47 Section 3-6 Using I/O Communications Functions 3-6 Using I/O Communications Functions Procedure for Using Master Function Use the procedure shown in the following diagram to use API functions when using the Master function of the Scanner SDK. Refer to SECTION 4 API Function Reference for details on using API functions. A Open Board SCAN_Open( ); Check Network Status SCAN_GetScannerStatus( ); Register Scan List Error Error processing Normal (There are several ways to register scan lists. Refer to Parameter Operation API Functions on page 47 for details.) Other Get Slave Status SCAN_GetSlaveDeviceStatus( ); Error processing Performing I/O communications Join Network SCAN_Online( ); Output Data to Slave SCAN_SetOutData( ) Start I/O Communications SCAN_StartScan( ); Error Repeat output for number of target slaves. Data I/O processing Initialization SCAN_RegisterSlaveDevice( ); Refresh I/O data. SCAN_IoRefresh( ); A Other Get Slave Status SCAN_GetSlaveDeviceStatus( ); Error Error processing Performing I/O communications Get Slave Data SCAN_GetInData( ) Repeat for number of input slaves. No Finished? Stop I/O Communications SCAN_StopScan( ); Disconnect from Network SCAN_Offline( ); End processing Yes Close Board SCAN_Close( ); Note 48 Several seconds are required after SCAN_StartScan() is called until I/O communications actually start. Section 3-7 Using the Explicit Message Client Function Procedure for Using Slave Function Use the procedure shown in the following diagram to use API functions when using the Slave function of the Scanner SDK. Refer to SECTION 4 API Function Reference for details on how to use API functions. Initialization Open Board SCAN_Open( ); Register Slave Scan List SCAN_RegisterSelfSlaveDevice( ); (There are several ways to register scan lists. Refer to Parameter Operation API Functions on page 47 for details.) Join Network SCAN_Online( ); Slave data input Error Check status of Slave functions. SCAN_GetSlaveModeStatus( ); Other Error processing (e.g., waiting for connection Performing I/O communications with Master) Get Slave Input Data SCAN_SetSlaveInData( ); Refresh I/O Data SCAN_SlaveIoRefresh( ); Get Slave Output Data SCAN_GetSlaveOutData( ); No Finished? End processing Yes Stop Slave Function (Clear Slave Scan List) SCAN_RemoveSelfSlaveDevice( ); Disconnect from Network SCAN_Offline( ); Close Board SCAN_Close( ); 3-7 Using the Explicit Message Client Function There are two ways to detect response reception when using the explicit message client function of the Scanner SDK. Each method uses API functions in the procedures outlined in the following diagrams. Refer to SECTION 4 API Function Reference for details. Note Always execute retries with explicit message communications. Sometimes messages cannot be received due to the status of the remote node or an error response is returned. 49 Section 3-7 Using the Explicit Message Client Function Using Windows Messages for Event Notification Open Board Initialization SCAN_Open( ); Join Network SCAN_Online( ); Register Client Event Notification Message SCAN_RegClientEvtNotifyMessage( ); Send Client Explicit Message Message client processing SCAN_SendClientExplicit( ); Offline Check Network Status SCAN_GetScannerStatus( ); Error processing Online No message Receive Windows Message PeekMessage( ); (Windows function) Receive message Unexpected message Expected message? Expected message Wait for Set Time Sleep( ); (Windows function) Receive Client Explicit Message SCAN_ReceiveClientExplicit( ); Error response Normal response? Normal response Yes Retry? No Error processing End processing Clear Client Event Notification Message SCAN_UnRegClientEvtNotifyMessage( ); Disconnect from Network SCAN_Offline( ); Close Board SCAN_Close( ); 50 Section 3-8 Using the Explicit Message Server Function Checking Events by Polling the Event Queue Initialization Open Board. SCAN_Open( ); Join Network. SCAN_Online( ); Message client processing Send Client Explicit Message. SCAN_SendClientExplicit( ); Offline Check Network Status. SCAN_GetScannerStatus( ); Error processing Online Check Response Received. SCAN_PeekClientEvent( ); Wait Set Time. Sleep( ); (Windows function) Response received Get Explicit Response Message. SCAN_ReceiveClientExplicit( ); Error response Normal response? Normal response Yes Retry? No End processing Error processing 3-8 Disconnect from Network. SCAN_Offline( ); Close Board. SCAN_Close( ); Using the Explicit Message Server Function There are two methods for detecting request messages when using the explicit message server function with Scanner SDK. Each method uses API functions in the procedures shown in the following diagram. Refer to SECTION 4 API Function Reference for details. 51 Section 3-8 Using the Explicit Message Server Function Using Windows Messages for Event Notification A Open Board. SCAN_Open( ); Clear Request Notification Event. SCAN_UnRegServerEvtNotifyMessage( ); Initialization Join Network. Clear Application Object Class. SCAN_UnRegObjectClass( ); Register Application Object Class. SCAN_RegObjectClass( ); Disconnect from Network. Register Request Notification Events SCAN_Offline( ); SCAN_RegServerEvtNotifyMessage( ); Close Board. SCAN_Close( ); Check Network Status. SCAN_GetScannerStatus( ); Offline Online Message server processing Receive Windows Message. PeekMessage( ); (Windows function) Message received Unexpected message Expected message? Expected message Get Explicit Request Message. SCAN_ReceiveServerExplicit( ); Server processing. Send Explicit Response Message. SCAN_SendServerExplicit(); Wait Set Time. Sleep( ); (Windows function) No Server functions finished? Yes A 52 No message End processing SCAN_Online( ); Section 3-8 Using the Explicit Message Server Function Checking Events by Polling the Event Queue Initialization Open Board. SCAN_Open( ); Join Network. SCAN_Online( ); Register application object class. SCAN_RegObjectClass( ); Message server processing Check Network Status. SCAN_GetScannerStatus( ); Offline Online Check Request Received. SCAN_PeekServerEvent(); No request Request received Get Explicit Request Message. SCAN_ReceiveServerExplicit( ); Server processing Send Explicit Response Message. SCAN_SendServerExplicit(); Wait Set Time. Sleep( ); (Windows function) No Server functions finished? Yes End processing Clear Application Object Class. SCAN_UnRegObjectClass( ); Disconnect from Network. SCAN_Offline( ); Close Board. SCAN_Close( ); 53 Section 3-9 Reset Function 3-9 Reset Function Use the SCAN_Reset() function to reset the Board and initialize the Board to the same status it had at startup. When the Board is reset, all of the resources set aside for the Board will be cleared and all of the information set from user applications will be lost. All required information must be set again after executing SCAN_Reset(). Note The Board reset will be completed when the TRUE return value is returned from SCAN_Reset(). The next function can be executed immediately after the TRUE return value is recognized. 3-10 Error Log Functions The PCI Board provides an error log function that records and holds error information. When an error occurs, one record per error is stored in the Board’s internal RAM error log table, up to a maximum of 64 records. When the maximum number of 64 records has been stored in the error log table, the oldest record will be discarded when another error occurs and the new error data will be recorded in the table. The following information is recorded in the error log table. • Error code (Refer to Error Log Data on page 126.) • Details code (Refer to Error Log Data on page 126.) • Data and time of error (The computer time and data information is used.) Saving Error Logs When an error is detected, the error log and the date and time of the error are recorded in the Board’s internal RAM. Serious errors are also recorded in EEPROM. (Refer to Error Code Table on page 126.) Error logs stored in EEPROM are held even if the computer power is turned OFF or the Board is reset. When the Board is started, the error log recorded in EEPROM is copied to RAM. API functions can be used to read the error logs held in RAM. When error logs are cleared, the error logs held in both RAM and EEPROM are cleared. Reading and Clearing Error Logs Function SCAN_GetErrorLog() SCAN_ClearErrorLog() The functions listed in the following table are used to read and clear error logs stored in the Board. Name Read Error Log Clear Error Log Operation Reads all of the error records stored in the Board. Clears all of the error records stored in the Board. Page 101 102 3-11 PC Watchdog Timer Management Function The DeviceNet PCI Board is equipped with a PC watchdog timer function that can stop remote I/O communications automatically if the application that controls the Board stops for some reason. While the PC watchdog timer function is running, remote I/O communications will be stopped automatically if the PC watchdog timer value is not refreshed from the user application within the set timeout detection period. The Board’s PC watchdog timer is refreshed regularly from the computer (application) to notify the Board that the application is operating normally. The timeout detection period is 2 × (the monitoring time + 10 ms). Use the API functions as outlined in the following flowchart when using the PC watchdog timer function. 54 Section 3-11 PC Watchdog Timer Management Function Open Board SCAN_Open(); Initialization Enable PC Watchdog Timer SCAN_EnablePCWDTTimer(); PC watchdog timer monitoring Refresh PC Watchdog Timer Value SCAN_RefreshPCWDTTimer(); Disable PC Watchdog Timer SCAN_EnablePCWDTTimer(); End processing Close Board SCAN_Close(); Note The Board’s PC watchdog timer function is disabled when the Board starts operation. It is also disabled by the SCAN_Reset() function. When using the PC watchdog timer function, execute the SCAN_Enable PCWDTTimer() to enable the PC watchdog timer and refresh the timer value. If the timer isn’t refreshed, the function will determine that the application has stopped and will stop remote I/O communications if the set time has elapsed since the last refresh. 55 PC Watchdog Timer Management Function 56 Section 3-11 SECTION 4 API Function Reference This section provides details on the various API functions in the DN 3G8F7 Scanner.DLL that are used with the DeviceNet PCI Board. 4-1 Function Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4-2 Board Status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4-3 Board Management API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4-3-1 Board Service API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4-3-2 4-4 4-5 4-6 4-7 PC Board Interrupt Service API Functions . . . . . . . . . . . . . . . . . . . . 65 Master Function API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4-4-1 Scan List Operation API Functions. . . . . . . . . . . . . . . . . . . . . . . . . . 68 4-4-2 I/O Communications Service API Functions . . . . . . . . . . . . . . . . . . 73 4-4-3 I/O Data Access Service API Functions . . . . . . . . . . . . . . . . . . . . . . 78 Slave Function API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4-5-1 Slave Scan List Operation API Functions. . . . . . . . . . . . . . . . . . . . . 80 4-5-2 I/O Communications Service API Functions . . . . . . . . . . . . . . . . . . 82 4-5-3 I/O Data Access Service API Functions . . . . . . . . . . . . . . . . . . . . . . 83 Explicit Message API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4-6-1 Message Monitoring Timer Service API Functions . . . . . . . . . . . . . 85 4-6-2 Client Message Service API Functions. . . . . . . . . . . . . . . . . . . . . . . 87 4-6-3 Server Message Service API Functions . . . . . . . . . . . . . . . . . . . . . . 90 Maintenance API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 4-7-1 Status Service API Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 4-7-2 Error Log Access Service API Functions . . . . . . . . . . . . . . . . . . . . . 101 4-7-3 PC Watchdog Timer Service API Functions . . . . . . . . . . . . . . . . . . . 102 57 Section 4-1 Function Lists 4-1 Function Lists Board Management API Functions Board Service API Functions Use the following API functions for initialization and end processes such as reading the DLL version, reading the driver version, opening the Board, or closing the Board. API function SCAN_GetVersion SCAN_GetDriverVersion SCAN_IsExistCard SCAN_Open SCAN_Close SCAN_Online SCAN_Offline SCAN_Reset Operation Reads the Scanner Software’s DLL version. Reads the Board’s driver version. Checks whether a Board is installed. Opens the Board. Closes the Board. Adds the Board to the network (online). Removes the Board from the network (offline). Resets the Board. PC Board Interrupt Service API Functions Use the following API functions to set interrupts from the Board to the PC, set the interrupt notification message, and clear the interrupt notification message. API function SCAN_GetIrqControl SCAN_SetIrqControl SCAN_RegIrqEvtNotifyMessage SCAN_UnRegIrqEvtNotifyMessage SCAN_PeekIrqEvent SCAN_ClearIrqEvent Master Function API Functions Operation Reads the PC interrupt control register. Sets the PC interrupt control register. Registers the interrupt notification message. Clears the interrupt notification message. Checks the PC interrupt status Clears the PC interrupt status. Scan List Operations API Functions Use the following API functions for scan list operations when the Master function is operating. API function SCAN_RemoveDevice SCAN_StoreScanlist SCAN_LoadScanlist SCAN_SetScanlist SCAN_ClearScanlist SCAN_RegisterSlaveDevice SCAN_GetSlaveDevice SCAN_RegisterSlaveDeviceEx SCAN_GetSlaveDeviceEx Operation Removes a Slave from the scan list. Saves the scan list to non-volatile memory. Loads the scan list from non-volatile memory. Registers multiple slaves to the scan list. Deletes the scan list. Registers a Slave in the scan list. Reads Slave information from the scan list. Registers a Slave in the scan list (detailed information.) Reads Slave information from the scan list (detailed information.) I/O Communications Service API Functions Use the following API functions for operations such as starting remote I/O communications (Master function), stopping remote I/O communications (Master function), or establishing a connection. API function SCAN_StartScan SCAN_StopScan 58 Operation Starts remote I/O. Stops remote I/O. Section 4-1 Function Lists API function SCAN_GetActualSlaveDevice SCAN_ConnectSlaveDevice SCAN_DisconnectSlaveDevice SCAN_SetScanTimeValue SCAN_GetScanTimeValue SCAN_StoreScanTimeValue SCAN_LoadScanTimeValue Operation Reads existing Slave information. Starts I/O communications with a specified Slave. Stops I/O communications with a specified Slave. Sets the communications cycle time. Reads the communications cycle time. Writes the communications cycle time to nonvolatile memory. Loads the communications cycle time from non-volatile memory. I/O Data Access Service API Functions Use the following API functions to refresh, set, and read I/O data when using the Master function. API function SCAN_IoRefresh SCAN_GetInData SCAN_SetOutData SCAN_SendMasterCosToSlave Slave Function API Functions Operation Executes I/O refreshing. Reads Slave input data. Sets Slave output data. Immediately sends output data to Slaves from the Master performing COS communications. Slave Scan List Operations API Functions Use the following API functions for scan list operations when the Slave function is operating. API function SCAN_RegisterSelfSlaveDevice SCAN_RemoveSelfSlaveDevice SCAN_GetSelfSlaveDevice SCAN_StoreSlaveScanlist SCAN_LoadSlaveScanlist Operation Registers the Slave scan list. Deletes the Slave scan list. Reads the Slave scan list information. Saves the Slave scan list to non-volatile memory. Loads the Slave scan list from non-volatile memory. I/O Communications Service API Functions Use the following API functions for operations such as starting remote I/O communications (Slave function), stopping remote I/O communications (Slave function), or establishing a connection. API function SCAN_ConnectMasterDevice SCAN_DisconnectMasterDevice Operation Starts I/O communications with a Master. Stops I/O communications with a Master. I/O Data Access Service API Functions Use the following API functions to refresh, set, and read I/O data. API function SCAN_SlaveIoRefresh SCAN_GetSlaveOutData SCAN_SetSlaveInData SCAN_SendSlaveCosToMaster Operation Executes Slave I/O refreshing. Reads Master output data. Sets Master input data. Immediately sends input data to the Master from Slaves performing COS communications. 59 Section 4-1 Function Lists Explicit Message API Functions Message Monitoring Timer Service API Functions Use the following API functions to manage the explicit message monitoring timer. API function SCAN_SetMessageTimerValue SCAN_GetMessageTimerValue SCAN_StoreMessageTimerValueList SCAN_LoadMessageTimerValueList Operation Sets the message monitoring timer. Reads the message monitoring timer. Saves the message monitoring timer list to non-volatile memory. Loads the message monitoring timer list from non-volatile memory. Client Message Service API Functions Use the following API functions when the Board is operating as an explicit message client. API function SCAN_RegClientEvtNotifyMessage SCAN_UnRegClientEvtNotifyMessage SCAN_SendClientExplicit SCAN_ReceiveClientExplicit SCAN_PeekClientEvent SCAN_GetClientEventLength Operation Registers the client response event notification message. Clears the client response event notification message. Sends an explicit client message. Receives an explicit client message. Checks the client response event. Reads the size of the client response. Server Message Service API Functions Use the following API functions when the Board is operating as an explicit message server. API function SCAN_RegObjectClass SCAN_UnRegObjectClass SCAN_RegServerEvtNotifyMessage Operation Registers the object class ID. Clears the object class ID. Sets the server request event notification message. SCAN_UnRegServerEvtNotifyMessage Clears the server request event notification message. SCAN_SendServerExplicit Sends an explicit server message. SCAN_ReceiveServerExplicit Gets an explicit server message. SCAN_PeekServerEvent Checks the server request event. SCAN_GetServerEventLength Reads the size of the server request. Maintenance API Functions Status Service API Functions Use the following API functions to read various kinds of status information. API function SCAN_GetNetworkStatus SCAN_GetScannerStatus SCAN_GetMasterModeStatus SCAN_GetSlaveModeStatus SCAN_IsScanlistSlaveDeviceRegist SCAN_IsDeviceConnection SCAN_GetSlaveDeviceStatus 60 Operation Reads the network status. Reads the scanner status. Reads the Master function status. Reads the Slave function status. Checks if a Slave is registered in the scan list. Checks that the connection with a Slave is open. Reads the Slave’s status. Section 4-2 Board Status API function SCAN_GetCycleTime Operation Reads the present value of the communications cycle time. Reads the maximum value of the communications cycle time. Reads the minimum value of the communications cycle time. Clears the maximum and minimum communications cycle times. SCAN_GetMaxCycleTime SCAN_GetMinCycleTime SCAN_ClearCycleTime Error Log Access Service API Functions Use the following API functions to read and clear the error log. API function SCAN_GetErrorLog SCAN_ClearErrorLog Operation Reads the error log. Clears the error log. PC Watchdog Timer Service API Functions Use the following API functions to control the PC watchdog timer function. API function SCAN_EnablePCWDTTimer SCAN_RefreshPCWDTTimer 4-2 Operation Enables or disables the PC watchdog timer. Refreshes the PC watchdog timer. Board Status The following diagram shows how the Board status is changed by API functions. There are restrictions on what API functions can be used, depending on the Board status. Refer to Application Range under each function description for details. Closed state Open state Offline state Online state I/O communications stopped I/O communications active (Master functions) Start Remote I/O Scan SCAN_StartScan Open Board SCAN_Open Close Board SCAN_Close Join Network SCAN_Online Disconnect from Network SCAN_Offline Stop Remote I/O Scan SCAN_StopScan Start Master I/O Communications SCAN_ConnectMasterDevice Stop Master I/O Communications SCAN_DisconnectMasterDevice I/O communications active (Slave functions) 61 Section 4-3 Board Management API Functions Closed State All of the Board’s resources are disengaged in this status. Control operations cannot be performed on the Board in this status. The Board will be in this status after it is started or reset. Open State All of the Board’s resources are engaged in this status. Control operations can be performed on the Board in this status. The Board’s “device handle” is determined when the Board is switched to open status by the SCAN_Open() function. Specify the Board with the device handle to use the API functions while the Board is open. Offline State The Board is open but is not participating in the DeviceNet network. Online State The Board is open and participating in the DeviceNet network. Remote I/O Stopped State The Board is open and participating in the DeviceNet network but remote I/O communications are stopped. Remote I/O Active State The Board is open, participating in the DeviceNet network, and performing remote I/O communications. 4-3 4-3-1 Board Management API Functions Board Service API Functions Reading the DLL Version: SCAN_GetVersion() Application Range Unlimited (Can be executed in closed status.) Function Reads the version information for the API (DN 3G8F7 Scanner.DLL) that is being used. Call Format BOOL SCAN_GetVersion(DWORD *Version) Arguments Type DWORD* Name Version Contents Buffer address for obtaining version information. Return Value TRUE is returned when the function is completed normally and FALSE is returned when an error occurs during processing. Detailed error information can be read with the GetLastError() function. Description Use this function when the DLL version needs to be checked. The DLL version is stored in BCD in the following format: 31 16 15 Major version 0 Minor version For example, DLL version 1.13 will be represented as 0x00010013. Reading the Driver Version: SCAN_GetDriverVersion() Application Range 62 Open status Section 4-3 Board Management API Functions Function Reads the version information for the driver being used for the DeviceNet PCI Board. Call Format BOOL SCAN_GetDriverVersion(DWORD Handle, DWORD *Version) Arguments Type DWORD DWORD* Name Handle Version Contents Device handle obtained by SCAN_Open() Buffer address for obtaining version information. Return Value TRUE is returned when the function is completed normally and FALSE is returned when an error occurs during processing. Detailed error information can be read with the GetLastError() function. Description Use this function when the driver version needs to be checked. The driver version is stored in BCD in the following format: 31 16 15 Major version 0 Minor version For example, DLL version 1.13 will be represented as 0x00010013. Checking the Board: SCAN_lsExistCard() Application Range Unlimited (Can be executed in closed status.) Function Checks whether or not there is a DeviceNet PCI Board with the specified board ID. Call Format BOOL SCAN_lsExistCard(DWORD BoardId) Arguments Type DWORD Name BoardId Contents Board ID of the Board that you want to check Setting range: 0x0 to 0x7 (0 to 7) Return Value TRUE is returned if there is a DeviceNet PCI Board with the specified board ID and FALSE is returned if there is not. Detailed error information can be read with the GetLastError() function. Description Use to check the ID of the mounted Board. Set the board ID with the Board’s rotary switch. Opening the Board: SCAN_Open() Application Range Closed status Function Opens the DeviceNet PCI Board with the specified board ID and makes it usable. Call Format BOOL SCAN_Open(DWORD BoardId, DWORD *Handle) Arguments Type DWORD Name BoardId DWORD* Handle Contents Board ID of the Board that you want to open Setting range: 0x0 to 0x7 (0 to 7) Buffer address for obtaining device handle. 63 Section 4-3 Board Management API Functions Return Value TRUE is returned if the DeviceNet PCI Board with the specified board ID was opened successfully. FALSE is returned if an error occurred or there is not a Board with the specified board ID. Detailed error information can be read with the GetLastError() function. Description The Board must be open before it can be used. Each Board can be opened from one application (process) only. The Board ID is the value set using the rotary switch on the Board. Closing the Board: SCAN_Close() Application Range Open status Function Closes the specified device handle and makes the Board unusable. Call Format BOOL SCAN_Close(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the specified device handle was closed successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description When this function is executed, the device handle is released, the Board is reset, and all set information is cleared. Perform any end processing for the application before executing this function. Joining the Network (Online): SCAN_Online() Application Range Offline status Function Adds the specified DeviceNet PCI Board to the network and puts it in online status. Call Format BOOL SCAN_Online(DWORD Handle, WORD Macld, WORD BaudRate) Arguments Type DWORD WORD Name Handle Macld WORD BaudRate Contents Device handle obtained by SCAN_Open() Node address setting for the Board Setting range: 0x00 to 0x3F (0 to 63) Communications speed setting for the Board Setting range: ONLINE125K(0): 125 kbps ONLINE250K(1): 250 kbps ONLINE500K(2): 500 kbps Return Value TRUE is returned if the specified Board was successfully switched to online status. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description It takes approximately 3 seconds for online processing to be completed. FALSE is returned and the Board is not switched to online status in the following cases. Use GetLastError() to find the source of the error, clear the error, and execute the function again. • Bus OFF error • Node address duplication • Network power supply error 64 Section 4-3 Board Management API Functions • Send timeout A network error may occur if the other nodes in the network have a different baud rate setting. When connecting to slaves with an automatic baud rate recognition function, a transmission timeout may occur. If this error occurs, perform SCAN_Online() retry processing. Leaving the Network (Offline): SCAN_Offline() Application Range Online status Function Removes the specified DeviceNet PCI Board from the network and puts it in offline status. Call Format BOOL SCAN_Offline(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the specified Board was successfully switched to offline status. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Resetting the Board: SCAN_Reset() Application Range Open status Function Resets the specified DeviceNet PCI Board. Call Format BOOL SCAN_Reset(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the processing was completed properly. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description When this function is executed the Board will be reset and all of the information that has been set will be cleared. It will be necessary to redo all of the procedures that were executed since the Board was opened. The TRUE return value is returned when initialization of the Board is completed, so other functions can be executed immediately after TRUE is returned. If remote I/O functions are being used and the Board is communicating with other nodes as a client, a communications timeout will occur at the remote node and the NS indicator will flash red when the Board is reset. 4-3-2 PC Board Interrupt Service API Functions Reading the Interrupt Control Register: SCAN_GetIrqControl() Application Range Open status Function Reads the value of the interrupt control register that determines whether or not the computer is notified of interrupts that occur in the specified DeviceNet PCI Board. 65 Section 4-3 Board Management API Functions Call Format BOOL SCAN_GetIrqControl(DWORD Handle, BYTE *IrqReg) Arguments Type DWORD BYTE* Name Handle IrqReg Contents Device handle obtained by SCAN_Open() Buffer address for obtaining interrupt control register. Return Value TRUE is returned if the register value was read from the specified Board successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Use this function to check the value set in the interrupt control register. The interrupt control register value is stored in IrqReg with the following format: Bit name Bit 7 Bit 6 Reserved Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BD_ WDT Bit 0 SCAN BD_WDT: Board watchdog timer interrupt SCAN: One-scan completed interrupt Writing the Interrupt Control Register: SCAN_SetIrqControl() Application Range Open status Function Sets the value of the interrupt control register that determines whether or not the computer is notified of interrupts that occur in the specified DeviceNet PCI Board. Call Format BOOL SCAN_SetIrqControl(DWORD Handle, BYTE IrqReg) Arguments Type DWORD BYTE Name Handle IrqReg Contents Device handle obtained by SCAN_Open() New register value setting (The data format is the same as it is in SCAN_GetIrqControl().) Return Value TRUE is returned if the register value was written to the specified Board successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Once the interrupt control register has been set, the computer will be notified when the corresponding interrupts occur. Registering an Interrupt Notification Message: SCAN_RegIrqEvtNotifyMessage() Application Range Open status Function Registers the Windows message that notifies that an interrupt from the Board occurred. Call Format BOOL SCAN_RegIrqEvtNotifyMessage(DWORD Handle, DWORD ThreadId, HWND hWnd, UNIT Msg) 66 Section 4-3 Board Management API Functions Arguments Type DWORD DWORD Name Handle ThreadId HWND hWnd UNIT Msg Contents Device handle obtained by SCAN_Open() The thread ID to notify. (No setting = NULL) Specifies the window handle to notify. (No setting = NULL) Notification message Range: WM_USER + 0x100 to WM_USER + 0x7FFF Return Value TRUE is returned if registration of the notification message was completed successfully. FALSE is returned if an error occurred such as null values for both the thread ID and window handle. Detailed error information can be read with the GetLastError() function. Description Specifies the thread ID or window handle for the event notification. The interrupt status and notification message are sent to WPARAM and the notification message is sent to LPARAM. Clearing an Interrupt Notification Message: SCAN_UnRegIrqEvtNotifyMessage() Application Range Open status Function Clears the notification message. Call Format BOOL SCAN_UnRegIrqEvtNotifyMessage(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the registered notification message was cleared successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Reading Interrupt Event: SCAN_PeekIrqEvent() Application Range Open status Function Reads the cause of the interrupt that occurred in the specified Board. Call Format BOOL SCAN_PeekIrqEvent(DWORD Handle, BYTE *IrqStatus) Arguments Type DWORD BYTE* Name Handle IrqStatus Contents Device handle obtained by SCAN_Open() Buffer address for obtaining the cause of the interrupt. (The data format is the same as it is in SCAN_GetIrqControl().) Return Value TRUE is returned if the status value was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description To check the interrupt status of a specified Board, use the SCAN_ SetIrqControl() function and specify notification to the computer of the interrupt that occurred in the Board. 67 Section 4-4 Master Function API Functions Clearing Interrupt Status: SCAN_ClearIrqEvent() Application Range Open status Function Clears the cause of the interrupt that occurred in the specified Board. Call Format BOOL SCAN_ClearIrqEvent(DWORD Handle, BYTE IrqClrMask) Arguments Type DWORD BYTE Name Handle IrqClrMask Contents Device handle obtained by SCAN_Open() Interrupt mask to clear Clearing is specified when the corresponding interrupt bit position is ON. (The data format is the same as it is in SCAN_GetIrqControl().) Return Value TRUE is returned when the value was successfully written in the specified Board’s register. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Use this function to clear the cause of an interrupt after an interrupt has been detected by event notification or by SCAN_PeekIrqEvent() and the corresponding processing has been executed. 4-4 4-4-1 Master Function API Functions Scan List Operation API Functions Registering a Slave in the Scan List: SCAN_RegisterSlaveDevice() Application Range Open status Function Registers information in the scan list for a specified Slave. Call Format BOOL SCAN_RegisterSlaveDevice(DWORD Handle, WORD, MacId, WORD Outsize, WORD Insize) Arguments Type DWORD WORD Name Handle MacId WORD Outsize WORD Insize Contents Device handle obtained by SCAN_Open() Address to register in the scan list. Setting range: 0x00 to 0x3F (0 to 63) Output data size (bytes) Setting range: 0x00 to 0xC8 (0 to 200) Input data size (bytes) Setting range: 0x00 to 0xC8 (0 to 200) Return Value TRUE is returned if the specified Slave was successfully registered in the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description I/O communications can be performed with Slaves registered in the scan list. Slaves do not need to be registered in the scan list for message communications unless they are involved in I/O communications. Previously registered Slaves will be overwritten when re-registered. The scan type for Slaves registered using this function will be automatically selected. Use SCAN_RegisterSlaveDeviceEx() to specify the scan type. 68 Section 4-4 Master Function API Functions The I/O data for Slaves registered using this function will be output data 1 and input data 1. Reading a Scan List Slave: SCAN_GetSlaveDevice() Application Range Open status Function Reads Slave information registered in the scan list. Call Format BOOL SCAN_GetSlaveDevice(DWORD Handle, WORD, MacId, WORD*Outsize, WORD*Insize) Arguments Type DWORD WORD Name Handle MacId WORD WORD Outsize Insize Contents Device handle obtained by SCAN_Open() Node address for obtaining Slave information. Setting range: 0x00 to 0x3F (0 to 63) Buffer address for receiving output data size. Buffer address for receiving input data size. Return Value TRUE is returned if the specified Slave information was successfully read from the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description When this function is completed, the output data size and input data size (both in bytes, between 0 and 200) will be stored in the buffer at the specified addresses. Removing a Slave from the Scan List: SCAN_RemoveDevice() Application Range Open status Function Deletes the specified Slave’s registration information from the scan list. Call Format BOOL SCAN_RemoveDevice(DWORD Handle, WORD MacId) Arguments Type DWORD WORD Return Value Name Handle MacId Contents Device handle obtained by SCAN_Open() Slave’s node address Setting range: 0x00 to 0x3F (0 to 63) TRUE is returned if the specified Slave was successfully removed from the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Clearing the Scan List: SCAN_ClearScanlist() Application Range Open status Function Deletes the scan list as a group. Call Format BOOL SCAN_ClearScanlist(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the specified Board’s scan list was deleted successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. 69 Section 4-4 Master Function API Functions Storing the Scan List: SCAN_StoreScanlist() Application Range Open status Function Saves the scan list information to non-volatile memory. Call Format BOOL SCAN_StoreScanlist(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the scan list was successfully written to non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The scan list information saved to non-volatile memory can be read using SCAN_LoadScanlist() and registered as the scan list. Loading the Scan List: SCAN_LoadScanlist() Application Range Open status Function Loads the scan list information from non-volatile memory and registers it as the scan list. Call Format BOOL SCAN_LoadScanlist(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the scan list was successfully loaded from non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Use SCAN_StoreScanlist() to save the scan list information to non-volatile memory. When scan list information is loaded, the previous scan list is overwritten and the newly read scan list is enabled. SCAN_DEV Structure 70 This structure defines the format of the registration information used when registering a node (Master) in the scan list. This structure is used in the SCAN_RegisterSlaveDeviceEx() and SCAN_GetSlaveDeviceEx() functions. When nodes are registered in the scan list as a group, the FSCAN_DEV and FILE_SCAN_DEV structures are used. Type WORD Name VendorID WORD ProductType WORD ProductCode Contents Vendor ID Scan list disabled mode:0xFFFF (65535) Specify the vendor ID to be verified when performing a vender ID verification check. Product type Scan list disabled mode:0xFFFF (65535) Specify the product type to be verified when performing a product type verification check. Product code Scan list disabled mode:0xFFFF (65535) Specify the product code to be verified when performing a product code verification check Section 4-4 Master Function API Functions Type WORD Name ScanType Contents Scan type Specifies the type of connection to be used. Up to two can be selected. However, COS and cyclic connections cannot be selected at the same time. Specify 0×8000 (32768) for automatic selection. Bit 5 Bit 4 Bit 3 CY COS Reserved Bit 2 Bit 1 BS Poll Bit 0 Reserved BS: Bit Strobe CY: Cyclic WORD WORD WORD Output1 Input1 Output2 WORD Input2 WORD ConnectAccept WORD HeatBeatTime WORD WORD WORD WORD WORD Output1PathLen Output1Path[16] Input1PathLen Input1Path[16] Output2PathLen WORD WORD Output2Path[16] Input2PathLen WORD WORD WORD Input2Path[16] Reserve Reserve2 Size of output data 1 in bytes 0x00 to 0xC8 (0 to 200) Size of input data 1 in bytes 0x00 to 0xC8 (0 to 200) Size of output data 2 in bytes 0x00 to 0xC8 (0 to 200) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Size of input data 2 in bytes 0x00 to 0xC8 (0 to 200) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Connected/Not connected Not connected:0xFFFF (65535) Connected: Some other value Normally set to 0 (when connected). Select 0xFFFF (when not connected) if Slaves are to be added later or reserved in the scan list. When 0xFFFF is selected, I/O communications do not occur even if the Slave is registered in the scan list. No communications errors will occur either. Once the Slave has been added use SCAN_ConnectSlaveDevice() to start I/O communications. COS/cyclic send interval time (ms) Setting range: 0x0000 (0): Default (1 s) 0x000A to 0xFFFF (10 to 65535): 10 to 65,535 ms The actual HeatBeatTime will be the greater of the following values: • The value set here • Communications cycle time x 2 • 10 ms Output 1 connection path size: 0x00 to 0x10 (0 to 16) Output 1 connection path Input 1 connection path size: 0x00 to 0x10 (0 to 16) Input 1 connection path Output 2 connection path size: 0x00 to 0x10 (0 to 16) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Output 2 connection path Input 2 connection path size: 0x00 to 0x10 (0 to 16) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Input 2 connection path Reserved area, so set to 0. Reserved area, so set to 0. 71 Section 4-4 Master Function API Functions Note When not specifying a connection path, set the connection path size to 0 and the connection path to NULL. Registering a Slave in the Scan List (Detailed): SCAN_RegisterSlaveDeviceEx() Application Range Open status Function Registers detailed information in the scan list for a Slave. Call Format BOOL SCAN_RegisterSlaveDeviceEx(DWORD Handle, WORD, MacId, SCAN_DEV *DeviceInfo) Arguments Type DWORD WORD Name Handle MacId SCAN_DEV * Device Contents Device handle obtained by SCAN_Open() Node address to register in the scan list. Setting range: 0x00 to 0x3F (0 to 63) Buffer address where detailed Slave information is stored. Return Value TRUE is returned if the specified Slave was successfully registered in the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Slave information that is already registered in the scan list will be overwritten. Reading a Scan List Slave (Detailed): SCAN_GetSlaveDeviceEx() Application Range Open status Function Reads detailed Slave information registered in the scan list. Call Format BOOL SCAN_GetSlaveDeviceEx(DWORD Handle, WORD, MacId, SCAN_ DEV *DeviceInfo) Arguments Type DWORD WORD Name Handle MacId SCAN_DEV * Device Contents Device handle obtained by SCAN_Open() Node address to register Slave information. Setting range: 0x00 to 0x3F (0 to 63) Buffer address where detailed Slave information is stored. Return Value TRUE is returned if the specified Slave information was successfully read from the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. FSCAN_DEV Structure This structure defines the format of the individual Slave information used when nodes are registered in the scan list as a group. This structure is used within the FILE_SCAN_DEV structure and in the SCAN_SetScanList() function. Type WORD SCAN_DEV 72 Name MacId ScanDevice Contents Node address to register Slave information Section 4-4 Master Function API Functions FILE_SCAN_DEV This structure defines the format of the grouped Slave information used when nodes are registered in the scan list as a group. This structure is used in the SCAN_SetScanList() function. Type WORD FSCAN_DEV Name DeviceCount Device[DEVICE_MAX] Contents Number of Slaves set Scan Slave information Registering Multiple Slaves in the Scan List: SCAN_SetScanlist() Application Range Open status Function Registers multiple Slaves in the scan list as a group. Call Format BOOL SCAN_SetScanlist(DWORD Handle, LPCTSTR FilePath,) Arguments Type DWORD LPCTSTR Return Value 4-4-2 Name Handle LPCTSTR Contents Device handle obtained by SCAN_Open() Buffer address of the scan list file path (FILE_SCAN_DEV structure format file) TRUE is returned if the scan list was registered successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. I/O Communications Service API Functions Starting Remote I/O Communications: SCAN_StartScan() Application Range Online status Function Starts remote I/O communications. Call Format BOOL SCAN_StartScan(DWORD Handle, BOOL ErrStop) Arguments Type DWORD BOOL Name Handle ErrStop Contents Device handle obtained by SCAN_Open() Specifies whether to continue or stop remote I/O when a communications error occurs. TRUE: Stop after a communications error FALSE: Continue after a communications error Return Value TRUE is returned if remote I/O communications started normally in the specified Board. FALSE is returned if an error occurred, such as the lack of a corresponding event. Detailed error information can be read with the GetLastError() function. Description Performs remote I/O communications with the Slaves registered in the scan list. Several seconds are required after this function is called before I/O communications will actually start. Scan list operation API Functions must be used to create a scan list before this function is called. When TRUE has been specified for the ErrStop variable, remote I/O communications with all of the Slaves will be stopped if a communications error occurs during remote I/O communications. 73 Section 4-4 Master Function API Functions Stopping Remote I/O Communications: SCAN_StopScan() Application Range I/O communications execution status Function Stops remote I/O communications. Call Format BOOL SCAN_StopScan(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if remote I/O communications stopped normally in the specified Board. FALSE is returned if an error occurred, such as the lack of a corresponding event. Detailed error information can be read with the GetLastError() function. Writing the Communications Cycle Time: SCAN_SetScanTimeValue() Application Range Open status Function Sets the communications cycle time. Call Format BOOL SCAN_SetScanTimeValue(DWORD Handle, WORD ScanTime) Arguments Type DWORD WORD Name Handle ScanTime Contents Device handle obtained by SCAN_Open() Communications cycle time (ms) Setting range: 0x000 (0): Automatic (Always executed at the fastest speed.) 0x0001 to 0x01F4 (1 to 500): 1 to 500 ms Return Value TRUE is returned if the communications cycle time was set successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The default communications cycle time is automatic (maximum). The communications cycle time for the automatic setting is calculated using the formula listed in 6-1-1 Communications Cycle Time. If a value shorter than the communications cycle time used under the automatic setting is set, the set value changes to that specified value but the actual communications use the communications cycle time from the automatic setting. Reading the Communications Cycle Time: SCAN_GetScanTimeValue() Application Range Open status Function Reads the set communications cycle time. Call Format BOOL SCAN_GetScanTimeValue(DWORD Handle, WORD*ScanTime) 74 Section 4-4 Master Function API Functions Arguments Type DWORD WORD Name Handle ScanTime Contents Device handle obtained by SCAN_Open() Buffer address for receiving the communications cycle time Receiving range: 0x0000 (0): Automatic (Always executed at the fastest speed.) 0x0001 to 0x01F4 (1 to 500): 1 to 500 ms Return Value TRUE is returned if the communications cycle time was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function gets the set value (in ms). Use SCAN_GetCycleTime(), SCAN_GetMaxCycleTime(), or SCAN_GetMin CycleTime() to get the real cycle time. Storing the Communications Cycle Time: SCAN_StoreScanTimeValue() Application Range Open status Function Saves the set communications cycle time to non-volatile memory. Call Format BOOL SCAN_StoreScanTimeValue(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the communications cycle time was successfully written to non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The value for the communications cycle time saved to non-volatile memory is enabled when SCAN_LoadScanTimeValue() is used. Loading the Communications Cycle Time: SCAN_LoadScanTimeValue() Application Range Open status Function Loads the communications cycle time from non-volatile memory and uses it as the set value. Call Format BOOL SCAN_LoadScanTimeValue(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the communications cycle time was successfully loaded from non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description If this function is used without executing SCAN_SetScanTimeValue(), the communications cycle time will be the default (automatic). 75 Section 4-4 Master Function API Functions ACTUAL_SLAVE_INFO Structure This structure stores information obtained when reading information about the Slaves connected to the network. This structure is used in the SCAN_Get ActualSlaveDevice() function. Type WORD Name VendorID WORD ProductType WORD ProductCode WORD ScanType Contents Vendor ID Scan list disabled mode:0xFFFF (65535) No Slaves connected:0xFF00 (65280) Product type Scan list disabled mode:0xFFFF (65535) No Slaves connected:0xFF00 (65280) Product code Scan list disabled mode:0xFFFF (65535) No Slaves connected:0xFF00 (65280) Scan type 0x8000 (32768) for automatic selection Bit 5 Bit 4 Bit 3 CY COS Reserved Bit 2 Bit 1 BS Poll Bit 0 Reserved BS: Bit Strobe CY: Cyclic WORD Output1 WORD Input1 WORD Output2 WORD Input2 Size of output data 1 in bytes No Slaves connected: 0xFF00 (65280) Size of input data 1 in bytes No Slaves connected: 0xFF00 (65280) Size of output data 2 in bytes Two I/O connections not set: 0×000 (0) No slaves connected: 0×FF00 (65280) Size of input data 2 in bytes Two I/O connections not set: 0×000 (0) No slaves connected: 0×FF00 (65280) Reading Slave Information: SCAN_GetActualSlaveDevice() Application Range I/O communications execution status Function Reads information about the specified Slave. Call Format BOOL SCAN_GetActualSlaveDevice(DWORD Handle, WORD MacId, ACTUAL_SLAVE_INFO*SlaveInfo) Arguments Type DWORD WORD Name Handle MacId ACTUAL_SLAVE_ SlaveInfo INFO* Contents Device handle obtained by SCAN_Open() Node address of the Slave whose information is being read Buffer address for receiving slave information Slave information is stored to the buffer address specified here when the function is completed. Return Value TRUE is returned if the Slave information was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function gets information from Slaves connected to the network. Information can even be obtained for Slaves with verification errors. 76 Section 4-4 Master Function API Functions Use SCAN_GetSlaveDevice() or SCAN_GetSlaveDeviceEx() to get Slave information for Slaves registered on the scan list. Starting Slave I/O Communications: SCAN_ConnectSlaveDevice() Application Range I/O communications execution status Function Starts I/O communications with the specified Slave. Call Format BOOL SCAN_ConnectSlaveDevice(DWORD Handle, WORD MacId) Arguments Type DWORD WORD Name Handle MacId Contents Device handle obtained by SCAN_Open() Slave’s node address Return Value TRUE is returned if the I/O communications with the specified Slave were started successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function can be used in I/O communications execution status. During execution of I/O communications, this function clears I/O communications stop status (withdrawal status) for a specific Slave and starts I/O communications. Use this function with SCAN_DisconnectSlaveDevice() when replacing Slaves or to make reservations for expected additional Slaves (when registering to the scan list but not performing I/O communications). Stopping Slave I/O Communications: SCAN_DisconnectSlaveDevice() Application Range I/O communications execution status Function Stops I/O communications with the specified Slave. Call Format BOOL SCAN_DisconnectSlaveDevice(DWORD Handle, WORD MacId); Arguments Type DWORD WORD Name Handle MacId Contents Device handle obtained by SCAN_Open() Slave’s node address Return Value TRUE is returned if the I/O communications with the specified Slave were stopped successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function can be used in I/O communications execution status. During execution of I/O communications, this function clears I/O communications stop status (withdrawal status) for a specific Slave and stops I/O communications. Use this function with SCAN_ConnectSlaveDevice() when replacing Slaves or to make reservations for expected additional Slaves (when registering to the scan list but not performing I/O communications). Slaves for which I/O communications were stopped (withdrawn) using this function will not have verification or communications errors. 77 Section 4-4 Master Function API Functions 4-4-3 I/O Data Access Service API Functions Refreshing Master I/O Data: SCAN_IoRefresh() Application Range Open status Function Refreshes the all Slave data in the I/O area of the Board’s Master function. Call Format BOOL SCAN_IoRefresh(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the input and output areas of the specified Board’s Master function were successfully refreshed. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function executes data exchange between the I/O areas accessible using API functions and I/O areas on the Board used for actual communications, and refreshes these I/O areas. This function refreshes all Slave I/O areas. Use the SCAN_GetInData() after this function is completed to get the input data. For output data, first execute SCAN_SetOutData() for the required Slaves, and then execute this function. IO_DATA_CTL Structure This structure defines the data format used when accessing the Board’s I/O areas. This structure is used in the SCAN_GetInData(), SCAN_SetOutData(), SCAN_GetSlaveOutData(), and SCAN_SetSlaveInData() functions. Type DWORD Name DataSize BYTE Data[200] Contents Amount of data in bytes Setting range: 0x00 to 0xC8 (0 to 200 bytes) Buffer where data is stored Specify the read data size or write data size under DataSize. Reading Slave Input Data: SCAN_GetInData() Application Range Open status Function Reads the specified Slave’s input data from the Board’s input area. Call Format BOOL SCAN_GetInData(DWORD Handle, WORD MacId, IO_DATA_CTL *InData1, IO_DATA_CTL *InData2) Arguments 78 Type DWORD WORD Name Handle MacId IO_DATA_CTL* IO_DATA_CTL* InData1 InData2 Contents Device handle obtained by SCAN_Open() Node address to read Setting range: 0x00 to 0x3F (0 to 63) Buffer address where input data 1 is stored Buffer address where input data 2 is stored (NULL when not used.) Section 4-4 Master Function API Functions Return Value TRUE is returned if the specified input data was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The most recent Slave inputs will not be reflected in the Board’s input area unless this function is executed after SCAN_IoRefresh(). Specify NULL as the input data 2 storage buffer address if only one I/O connection is used with Slaves (e.g., when using SCAN_RegisterSlaveDevice()). Specify the input data size for the specified node address as the data size for the IO_DATA_CTL structure. The read I/O data is stored in the data storage buffer of the IO_DATA_CTL structure. Writing Slave Output Data: SCAN_SetOutData() Application Range Open status Function Writes the specified Slave’s output data to the Board’s output area. Call Format BOOL SCAN_SetOutData(DWORD Handle, WORD MacId, IO_DATA_CTL *OutData1, IO_DATA_CTL *OutData2) Arguments Type DWORD WORD Name Handle MacId IO_DATA_CTL* IO_DATA_CTL* OutData1 OutData2 Contents Device handle obtained by SCAN_Open() Node address to write Setting range: 0x00 to 0x3F (0 to 63) Buffer address where output data 1 is stored Buffer address where output data 2 is stored (NULL when not used.) Return Value TRUE is returned if the specified output data was written successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The Board’s output area will not be reflected in the most recent Slave outputs unless SCAN_IoRefresh() is executed after this function. Specify NULL as the input data 2 storage buffer address if only one I/O connection is used with Slaves (e.g., when using SCAN_RegisterSlaveDevice()). Specify the output data size for the specified node address as the data size for the IO_DATA_CTL structure. The output data to Slaves is stored in the data storage buffer of the IO_DATA_CTL structure. Sending COS Output Data: SCAN_SendMasterCosToSlave() Application Range I/O communications executing status Function Sends output data to a Slave communicating through a COS connection. Call Format BOOL SCAN_SendMasterCosToSlave(DWORD Handle DWORD MacId) Arguments Type DWORD DWORD Return Value Name Handle MacId Contents Device handle obtained by SCAN_Open() Node address to write output data Designation range: 0X0 to 0X3F (0 to 63) TRUE is returned if the transmission of output data to the Slave proceeded normally. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. 79 Section 4-5 Slave Function API Functions Description Before output data is sent to Slaves through a COS connection, the SCAN_SetOutData() function must be used to set the output data. COS connections do not always produce immediate communications. Transmission may be delayed when several nodes are using COS communications. 4-5 4-5-1 Slave Function API Functions Slave Scan List Operation API Functions SELF_DEV Structure This structure defines the format of the registration information used when registering I/O information in the Slave’s scan list. This structure is used in the SCAN_RegisterSelfSlaveDevice() and SCAN_GetSelfSlaveDevice() functions. When nodes are registered in the scan list as a group, the FSCAN_DEV and FILE_SCAN_DEV structures are used. Type WORD Name ScanType Contents Scan type Specifies the connection type used. Up to 2 scan types can be selected, although COS and cyclic cannot be selected simultaneously. 0x8000 (32768) for automatic selection Bit 5 CY Bit 4 Bit 3 COS Reserved Bit 2 BS Bit 1 Poll Bit 0 Reserved BS: Bit Strobe CY: Cyclic 80 WORD Output1 WORD Input1 WORD Output2 WORD Input2 WORD ConnectAccept WORD ErrorOutData Output data 1 (Master to Slave) Size (bytes): 0x00 to 0xC8 (0 to 200) Input data 1 (Slave to Master) Size (bytes): 0x00 to 0xC8 (0 to 200) Output data 2 (Master to Slave) Size (bytes): 0x00 to 0xC8 (0 to 200) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Input data 2 (Slave to Master) Size (bytes): 0x00 to 0xC8 (0 to 200) Set this area to 0 if specifying automatic selection for the scan type or specifying only one connection. Connected/Not connected Not connected:0xFFFF (65535) Connected:Some other value Normally set to 0 (when connected). Set to 0xFFFF (when not connected) if not performing I/O communications even though the slave is registered in the scan list. A “No Slave” error will occur on the Master. Indicates whether output data is retained or cleared when a communications error occurs. Retain output data: 0xFFFF (65535) Clear output data: Some other value Specifies the output data (Master to Slave) status for when a communications error occurs with the Master. Section 4-5 Slave Function API Functions Registering a Slave Scan List: SCAN_RegisterSelfSlaveDevice() Application Range Open status Function Registers Slave function information in the Slave scan list. Call Format BOOL SCAN_RegisterSelfSlaveDevice(DWORD Handle, SELF_DEV* DeviceInfo) Arguments Type DWORD SELF_DEV* Name Handle DeviceInfo Contents Device handle obtained by SCAN_Open() Buffer address where Slave function information is stored. Return Value TRUE is returned if the specified Slave information was successfully registered in the scan list. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description If connection is specified, I/O communications will automatically start if a request to establish a connection is received from the Master after this function is completed. Deleting a Slave Scan List: SCAN_RemoveSelfSlaveDevice() Application Range Open status Function Deletes the Slave scan list information. Call Format BOOL SCAN_RemoveSelfSlaveDevice(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the Slave scan list was successfully deleted. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Reading a Slave Scan List: SCAN_GetSelfSlaveDevice() Application Range Open status Function Reads the Slave scan list information. Call Format BOOL SCAN_GetSelfSlaveDevice(DWORD Handle, SELF_DEV* DeviceInfo) Arguments Type DWORD SELF_DEV* Name Handle DeviceInfo Contents Device handle obtained by SCAN_Open() Buffer address for receiving the Slave function information. Return Value TRUE is returned if the Slave scan list was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The Slave scan list information is stored in the SELF_DEV structure when this function is completed. 81 Section 4-5 Slave Function API Functions Storing a Slave Scan List: SCAN_StoreSlaveScanlist() Application Range Open status Function Saves the Slave scan list information to non-volatile memory. Call Format BOOL SCAN_StoreSlaveScanlist(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the Slave scan list was successfully written to non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The Slave scan list information saved to non-volatile memory can be registered as the Slave scan list by using SCAN_LoadSlaveScanlist(). Loading a Slave Scan List: SCAN_LoadSlaveScanlist() Application Range Open status Function Loads the Slave scan list information from non-volatile memory and registers the information as the Slave scan list. Call Format BOOL SCAN_LoadSlaveScanlist(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the Slave scan list was successfully loaded from non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Use SCAN_StoreSlaveScanlist() to save the Slave scan list to non-volatile memory. 4-5-2 I/O Communications Service API Functions Starting Master I/O Communications: SCAN_ConnectMasterDevice() Application Range Online status Function Starts I/O communications with the specified Master. Call Format BOOL SCAN_ConnectMasterDevice(DWORD Handle, WORD ErrorOutData) Arguments Type DWORD WORD Name Handle ErrorOutData Contents Device handle obtained by SCAN_Open() Holds/clears output data at communications errors Hold output data: 0×FFFF (65535) Clear: Any other value Return Value TRUE is returned if the I/O communications with the specified Master were started successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Starts I/O communications with Masters that have stopped communications. 82 Section 4-5 Slave Function API Functions Slave information must be registered using SCAN_RegisterSelfSlaveDevice() to use this function. Stopping Master I/O Communications: SCAN_DisconnectMasterDevice() Application Range I/O communications execution status Function Stops I/O communications with the specified Master. Call Format BOOL SCAN_DisconnectMasterDevice(DWORD Handle); Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the I/O communications with the specified Master were stopped successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Stops I/O communications with Masters. The Master will have a communications error. The stopped I/O communications can be restarted using SCAN_Connect MasterDevice(). 4-5-3 I/O Data Access Service API Functions Refreshing Slave I/O Data: SCAN_SlaveIoRefresh() Application Range Open status Function Refreshes the input and output areas of the Board’s Slave function with the most recent data from remote I/O communications. Refreshes the data in the I/O areas of the Slave function. Call Format BOOL SCAN_SlaveIoRefresh(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the input and output areas of the specified Board’s Slave function were successfully refreshed. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description This function executes data exchange between the Slave function’s I/O areas accessible using API functions and Slave function’s I/O areas on the Board used for actual communications, and refreshes these I/O areas. Use the SCAN_GetSlaveOutData() after this function is completed to get the input data. For output data, first execute SCAN_SetSlaveInData() for the required Slaves, and then execute this function. 83 Section 4-5 Slave Function API Functions IO_DATA_CTL Structure This structure defines the data format used when accessing the Board’s I/O areas. This structure is used in the SCAN_GetInData(), SCAN_SetOutData(), SCAN_GetSlaveOutData(), and SCAN_SetSlaveInData() functions. Type DWORD Name DataSize BYTE Data[256] Contents Amount of data in bytes Setting range: 0x00 to 0xC8 (0 to 200 bytes) Buffer where data is stored Specify the read data size or write data size under DataSize. Reading Master Output Data: SCAN_GetSlaveOutData() Application Range Open status Function Reads output data from the Master from the Board’s Slave function output area. Call Format BOOL SCAN_GetSlaveOutData(DWORD Handle, IO_DATA_CTL *OutData1, IO_DATA_CTL *OutData2) Arguments Type DWORD IO_DATA_CTL* IO_DATA_CTL* Name Handle OutData1 OutData2 Contents Device handle obtained by SCAN_Open() Buffer address where output data 1 is stored Buffer address where output data 2 is stored (NULL when not used.) Return Value TRUE is returned if the specified output data was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The Board’s Slave function output area will not reflect in the most recent outputs from the Master unless this function is executed after SCAN_ SlaveIoRefresh(). Specify NULL as the output data 2 storage buffer address if only one I/O connection is used with the Slave function. Specify the output data size from the Master when using the Slave function (OUT size) as the data size for the IO_DATA_CTL structure. The output data read from the Master is stored in the data storage buffer of the IO_DATA_CTL structure. Writing Master Input Data: SCAN_SetSlaveInData() Application Range Open status Function Writes input data to the Master to the Board’s Slave function input area. Call Format BOOL SCAN_SetSlaveInData(DWORD Handle, WORD MacId, IO_DATA_ CTL *InData1, IO_DATA_CTL *InData2) Arguments Type DWORD IO_DATA_CTL* IO_DATA_CTL* 84 Name Handle InData1 InData2 Contents Device handle obtained by SCAN_Open() Buffer address where input data 1 is stored Buffer address where input data 2 is stored (NULL when not used.) Section 4-6 Explicit Message API Functions Return Value TRUE is returned if the specified input data was written successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The Board’s Slave function input area will not reflect in the most recent Master inputs unless SCAN_IoRefresh() is executed after this function. Specify NULL as the input data 2 storage buffer address if only one I/O connection is used with the Slave function. Specify the input size (IN size) for the Master using the Slave function as the data size for the IO_DATA_CTL structure. The input data to the Master is stored in the data storage buffer of the IO_DATA_CTL structure. Sending COS Input Data: SCAN_SendSlaveCosToMaster() Application Range I/O communications executing status Function Sends input data to a Master communicating through a COS connection. Call Format BOOL SCAN_SendSlaveCosToMaster(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the transmission of input data to the Master proceeded normally. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The SCAN_SetSlaveInData() function must be used to set the input data before the input data is sent to the Master through a COS connection. COS connections do not guarantee immediate communications. Transmission may be delayed when several nodes are using COS communications. 4-6 4-6-1 Explicit Message API Functions Message Monitoring Timer Service API Functions Registering the Message Monitoring Timer: SCAN_SetMessageTimerValue() Application Range Open status Function Registers the message monitoring timer value of the explicit client connection with the specified node address. Call Format BOOL SCAN_SetMessageTimerValue(DWORD Handle, WORD MacId, WORD Epr) Arguments Return Value Type DWORD WORD Name Handle MacId WORD Epr Contents Device handle obtained by SCAN_Open() Desired node address Setting range: 0x00 to 0x3F (0 to 63) Message monitoring timer value to be registered (ms) Setting range: 0x1F4 to 0x7530 (500 to 30,000) TRUE is returned when the message monitoring timer value was successfully registered. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. 85 Section 4-6 Explicit Message API Functions Description Use this function to change the message monitoring timer value. The default value (2 s, or 2,000 ms) will be used when 0 is set as the message monitoring timer value. Reading the Message Monitoring Timer: SCAN_GetMessageTimerValue() Application Range Open status Function Reads the message monitoring timer value of the explicit client connection with the specified node address. Call Format BOOL SCAN_GetMessageTimerValue(DWORD Handle, WORD MacId, WORD *Epr) Arguments Type DWORD WORD Name Handle MacId WORD* Epr Contents Device handle obtained by SCAN_Open() Desired node address Setting range: 0x00 to 0x3F (0 to 63) Buffer address for obtaining the message monitoring timer value (ms). Return Value TRUE is returned when the message monitoring timer value was successfully read. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Use this function to check the current message monitoring timer value. The default message monitoring timer value, 0 (2 s), will be read when the value is not set using SCAN_SetMessageTimerValue(). Storing the Message Monitoring Timer List: SCAN_StoreMessageTimerValueList() Application Range Open status Function Saves the explicit client connection’s message monitoring timer list to non-volatile memory. Call Format BOOL SCAN_StoreMessageTimerValueList(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned when the message monitoring timer list was successfully saved to non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Message monitoring timer values for all node addresses are saved. The message monitoring timer list saved to non-volatile memory is enabled when SCAN_LoadMessageTimerValueList() is used. Loading the Message Monitoring Timer List: SCAN_LoadMessageTimerValueList() Application Range Open status Function Reads the explicit client connection monitoring timer list from non-volatile memory and registers it as the message monitoring timers. Call Format BOOL SCAN_LoadMessageTimerValueList(DWORD Handle) 86 Section 4-6 Explicit Message API Functions Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned when the message monitoring timer list was successfully loaded from non-volatile memory. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The message monitoring timer values for all node addresses are refreshed using the saved values. If this function is used without SCAN_StoreMessageTimerValueList() being executed, the default value, 0 (2 s), will be used as the message monitoring timer value for all node addresses. 4-6-2 Client Message Service API Functions Registering a Client Response Message: SCAN_RegClientEvtNotifyMessage() Application Range Open status Function Registers the Windows message sent when a client response reception event occurs from the specified node address. Call Format BOOL SCAN_RegClientEvtNotifyMessage(DWORD Handle, WORD MacId, DWORD ThreadId, HWND hWnd, UINT Msg) Arguments Type DWORD WORD Name Handle MacId DWORD ThreadId HWND HWnd UINT Msg Contents Device handle obtained by SCAN_Open() Node address to check for events Setting range: 0x00 to 0x3F (0 to 63) The thread ID to notify. (No setting = NULL) Specifies the window handle to notify. (No setting = NULL) Notification message (event ID) Range: WM_USER + 0x100 to WM_USER + 0x7FFF Return Value TRUE is returned if the message registration was completed successfully. FALSE is returned if an error occurred such as null values for both the thread ID and window handle. Detailed error information can be read with the GetLastError() function. Description The client response source (remote) node address is sent to WPARAM with the notification message. The reception response size (in bytes) is sent to LPARAM with the notification message. Clearing a Client Response Message: SCAN_UnRegClientEvtNotifyMessage() Application Range Open status Function Clears the registered notification message of the specified node address. Call Format BOOL SCAN_UnRegClientEvtNotifyMessage(DWORD Handle, WORD MacId) 87 Section 4-6 Explicit Message API Functions Arguments Type DWORD WORD Return Value Name Handle MacID Contents Device handle obtained by SCAN_Open() Desired node address TRUE is returned if the message registration was cleared successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Checking for Client Response Events: SCAN_PeekClientEvent() Application Range Online status Function Checks whether there is a client response event. Call Format BOOL SCAN_PeekClientEvent(DWORD Handle, WORD MacId,) Arguments Type DWORD WORD Return Value Name Handle MacId Contents Device handle obtained by SCAN_Open() Node address being checked for response destination (remote) Setting range: 0x00 to 0x3F (0 to 63) TRUE is returned if there is a client response event in the event queue. FALSE is returned if an error occurred or there is not a client response event in the event queue. Detailed error information can be read with the GetLastError() function. Reading the Length of a Client Response: SCAN_GetClientEventLength() Application Range Online status Function Determines the length of the client response. Call Format BOOL SCAN_GetClientEventLength(DWORD Handle, WORD MacId, DWORD*Length) Arguments Type DWORD WORD Name Handle MacId DWORD* Length Contents Device handle obtained by SCAN_Open() Destination (remote) node address for response for which response size is being read. Buffer address where response size is received. Return Value TRUE is returned if the size of the event was read successfully. FALSE is returned if an error occurred, such as the lack of a client event. Detailed error information can be read with the GetLastError() function. Description Before getting the response message using SCAN_ReceiveClientExplicit(), set aside a buffer for storing service data that is at least as large as the response read using this function. 88 Section 4-6 Explicit Message API Functions CLIENT_REQ Structure This structure defines the format of client request explicit messages. It is used with the SCAN_SendClientExplicit() function. Type DWORD Name MessageID WORD WORD WORD WORD WORD MacId ServiceCode ClassID InstanceID DataLength BYTE* ServiceData Contents Message ID Set a value to enable the application to identify the message. Set 0 if no identification is required. Destination (remote) node address Service code Class ID Instance ID The amount of service data in bytes Setting range: 0x0 to 0x228 (0 to 552) Buffer address where the service data is stored. The buffer stores the number of bytes of service data specified under Data Length. Sending a Client Explicit Message: SCAN_SendClientExplicit() Application Range Online status Function Sends a client request message. Call Format BOOL SCAN_SendClientExplicit(DWORD Handle, CLIENT_REQ*Msg) Arguments Type Name DWORD Handle CLIENT_REQ* Msg Contents Device handle obtained by SCAN_Open() Buffer address where the request message is stored Return Value TRUE is returned if the send event registration was completed successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The message ID, destination node address, service data size, the data for the service being sent as a request (service code, class ID, instance ID, and service data) needs to be saved in the CLIENT_REQ structure. Set a value to the message ID in the CLIENT_REQ structure when the message needs to be identified by the application. Set 0 if the message doesn’t need to be identified. The set message ID is saved in the CLIENT_RES structure’s message ID after SCAN_ReceiveClientExplicit() has been completed. Note Always enable retries when sending explicit messages because explicit messages may not be received, depending on the type of destination Slave. CLIENT_RES Structure This structure defines the format of client response explicit messages. This structure is used in the SCAN_ReceiveClientExplicit() function. Type DWORD Name MessageID WORD MacId Contents Message ID The message ID set when the request was sent is stored when the function is completed. Destination (remote) node address Specifies the remote node address for the client response to be obtained before calling the function. 89 Section 4-6 Explicit Message API Functions Type WORD Name ServiceCode WORD DataLength BYTE* ServiceData Contents Service code Stores the service code when function processing is completed. The size (in bytes) of the buffer containing the service data Setting range: 0x0 to 0x228 (0 to 552) Specifies the size of the buffer for storing the service data before calling the function. A buffer for storing service data must be reserved that is the size of the reception response buffer obtained using the client response communications message or SCAN_GetClientEventLength(). When the function is completed, the number of bytes of service data that was actually stored will be set. Buffer address where service data is stored. A buffer of the number of bytes specified under DataLength must be set aside before the function is called. When the function is completed, the received service data is stored to the buffer address specified here. Reading a Client Explicit Message: SCAN_ReceiveClientExplicit() Application Range Online status Function Gets a client response message from the reception queue. Call Format BOOL SCAN_ReceiveClientExplicit(DWORD Handle, CLIENT_RES*Msg) Arguments Type DWORD CLIENT_RES* Name Handle Msg Contents Device handle obtained by SCAN_Open() Buffer address where the response message is stored Return Value TRUE is returned if the response message was read successfully from the specified node address. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The CLIENT_RES structure’s destination (remote) node address, service data storage buffer size, and service data storage buffer address must be set when calling this function. Reserve a buffer large enough to store the response message. Check the event data length with the notification message or SCAN_GetClient EventLength() function. If this function is completed normally, the message ID, service code, and size of the buffer containing service data are saved in the CLIENT_RES structure and the received service data (response) is stored in the specified service data storage buffer. 4-6-3 Server Message Service API Functions Registering an Object Class ID: SCAN_RegObjectClass() Application Range Open status Function Registers the object class implemented in the application program. 90 Section 4-6 Explicit Message API Functions Call Format BOOL SCAN_RegObjectClass(DWORD Handle, WORD ClassId) Arguments Type DWORD WORD Name Handle ClassId Contents Device handle obtained by SCAN_Open() Registers object class ID. Return Value TRUE is returned if the object class ID was successfully registered to the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description To register an object, a server request message addressed to that object must be received and a response returned. The following list shows the object class IDs that can be registered. Up to 16 can be registered. 0x0000 to 0x0063 (excluding 0x0002, 0x0003, 0x0005, 0x002B, and 0x002F), 0x0064 to 0x007F, 0x0088 to 0x008F, 0x0098 to 0x009F, 0x00A8 to 0x00AF, 0x00B8 to 0x00BF, 0x00C0 to 0x00C7 When Identity Object Class (ID=1) is registered, the service code must support Reset processing. Clearing an Object Class ID: SCAN_UnRegObjectClass() Application Range Open status Function Clears registration of an object class. Call Format BOOL SCAN_UnRegObjectClass(DWORD Handle, WORD ClassId) Arguments Type DWORD WORD Return Value Name Handle ClassId Contents Device handle obtained by SCAN_Open() Object class ID of the object class being deleted. TRUE is returned if the object class ID was successfully deleted from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Registering a Server Notification Message: SCAN_RegServerEvtNotifyMessage() Application Range Open status Function Registers the Windows message that notifies when a server request reception event for the registered object has occurred. Call Format BOOL SCAN_RegServerEvtNotifyMessage(DWORD Handle, WORD ClassId, DWORD ThreadId, HWND hWnd, UINT Msg) Arguments Type DWORD WORD Name Handle ClassId DWORD ThreadId Contents Device handle obtained by SCAN_Open() Object class ID used in server request reception event. The thread ID to notify. (No setting = NULL) 91 Section 4-6 Explicit Message API Functions Type HWND Name hWnd UINT Msg Contents Specifies the window handle to notify. (No setting = NULL) Notification message Range: WM_USER + 0x100 to WM_USER + 0x7FFF Return Value TRUE is returned if registration of the notification message was completed successfully. FALSE is returned if an error occurred such as null values for both the thread ID and window handle. Detailed error information can be read with the GetLastError() function. Description Along with the notification message, notification of the object class ID of the server request recipient is sent as WPARAM and notification of the reception request size (in bytes) is sent as LPARAM. Clearing a Server Notification Message: SCAN_UnRegServerEvtNotifyMessage() Application Range Open status Function Clears registration of the notification message for the specified object class ID. Call Format BOOL SCAN_UnRegServerEvtNotifyMessage(DWORD Handle, WORD ClassId,) Arguments Type DWORD WORD Return Value Name Handle ClassId Contents Device handle obtained by SCAN_Open() Object class ID being cleared TRUE is returned if registration of the notification message was cleared successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Checking Server Request Events: SCAN_PeekServerEvent() Application Range Open status Function Checks whether there is a server request event addressed to the specified class ID. Call Format BOOL SCAN_PeekServerEvent(DWORD Handle, WORD ClassId,) Arguments Type DWORD WORD Return Value Name Handle ClassId Contents Device handle obtained by SCAN_Open() Class ID being checked for event TRUE is returned if there is a server request event addressed to the specified class ID; FALSE is returned if an error occurred or there is not. Detailed error information can be read with the GetLastError() function. Reading the Server Request Size: SCAN_GetServerEventLength() Application Range Open status Function Gets the server request size (in bytes) for the specified object class ID. Call Format BOOL SCAN_GetServerEventLength(DWORD Handle, WORD ClassId, DWORD*Length) 92 Section 4-6 Explicit Message API Functions Arguments Type DWORD WORD Name Handle ClassId DWORD* Length Contents Device handle obtained by SCAN_Open() Class ID of the destination for the request for which the request size is being read. Buffer address for receiving the request size. Return Value TRUE is returned if the size of the event was read successfully. FALSE is returned if an error occurred, such as the lack of a corresponding event. Detailed error information can be read with the GetLastError() function. Description Set aside a buffer for storing service data that is at least as large as the request obtained using this function, before using SCAN_Receive ServerExplicit() to get the request message. SERVER_REQ Structure This structure defines the format of server request explicit messages. This structure is used in the SCAN_ReceiveServerExplicit() function. Type DWORD Name MessageID WORD ServiceCode WORD ClassID WORD InstanceID WORD DataLength BYTE* ServiceData Contents Message ID Stores the server request message ID when the function is completed. Service code Stores the service code for the server request when the function is completed. Class ID Specifies the class ID for the server request to be obtained, before the function is called. Instance ID Stores the instance ID for the server request when the function is completed. The size (in bytes) of the buffer containing the service data Setting range: 0x0 to 0x228 (0 to 552) Specifies the size of the buffer reserved for storing the service data before calling the function. A buffer for storing service data must be reserved that is the size of the reception request buffer obtained using the server notification message or SCAN_GetServerEventLength(). When the function is completed, the number of bytes of service data that was actually stored will be set. Service data storage buffer address The number of bytes of service data specified under DataLength must be set aside. When the function is completed, the received service data is stored in the buffer at the address specified here. Reading a Server Explicit Message: SCAN_ReceiveServerExplicit() Application Range Online status Function Gets a server request message from the reception queue. Call Format BOOL SCAN_ReceiveServerExplicit(DWORD Handle, SERVER_REQ*Msg) 93 Section 4-6 Explicit Message API Functions Arguments Type DWORD SERVER_REQ* Name Handle Msg Contents Device handle obtained by SCAN_Open() Buffer address where the request message is stored Return Value TRUE is returned if the request message was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The SERVER_REQ structure’s ClassID, size of the service data storage buffer, and address of the service data storage buffer must be set before calling this function. Reserve a buffer large enough to store the request message. Check the event data length with the notification message or SCAN_GetServerEventLength() function. When this function is completed normally, the message ID automatically set by the Board and the service code, class ID, instance ID, and service data size sent from the client will be stored in the SERVER_REQ structure. The received service data (request) will be stored in the specified service data storage buffer. Specify the obtained message ID as the message ID for the SERVER_RES structure when sending the server response corresponding to the server request. SERVER_RES Structure This structure defines the format of server response explicit messages. This structure is used in the SCAN_SendServerExplicit() function. Type DWORD Name MessageID WORD ServiceCode WORD DataLength BYTE* ServiceData Contents Message ID Specifies the request message ID obtained by SCAN_ReceiveServerExplicit(). Service code Specifies the service code sent as the response. For normal responses: Turns ON the leftmost bit (bit 15) of the service code obtained using SCAN_ReceiveServerExplicit and uses it as the response service code. For error responses: Specifies 0×94(148) as the service code for the error response. The amount of service data in bytes Setting range: 0x0 to 0x228 (0 to 552) Provide the number of bytes of service data indicated by the DataLength parameter. Sending a Server Explicit Message: SCAN_SendServerExplicit() Application Range Online status Function Sends a server response message. Call Format BOOL SCAN_SendServerExplicit(DWORD Handle, SERVER_RES*Msg) 94 Section 4-7 Maintenance API Functions Arguments Type Name DWORD Handle SERVER_RES* Msg Contents Device handle obtained by SCAN_Open() Buffer address where the response message is stored Return Value TRUE is returned if the send event registration was completed successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The message ID, service code, service data size, and buffer address where the service data must be saved in the SERVER_RES structure. The data corresponding to the service to be sent as the response (service data) must be stored in the specified service data storage buffer. Make sure that the value saved as MessageID in the SERVER_REQ structure when SCAN_ReceiveServerExplicit() is completed is saved as the message ID for the SERVER_RES structure. 4-7 4-7-1 Maintenance API Functions Status Service API Functions Reading Network Status: SCAN_GetNetworkStatus() Application Range Open status Function Gets the network (CAN) status. Call Format BOOL SCAN_GetNetworkStatus(DWORD Handle, WORD *Status) Arguments Type DWORD WORD * Name Handle Status Contents Device handle obtained by SCAN_Open() Buffer address for receiving the status. Return Value TRUE is returned if the specified Board’s network status was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The following table shows the location and meaning of the network status flags. The flags are contained within 16 bits. Bit 0 1 8 9 10 11 12 14 15 Code B00 B01 B08 B09 B10 B11 B12 B14 --- Meaning CAN active Network frame detected Network power supply error Transmission timeout error Reception overwrite occurred Reception overload warning Transmission overload warning Bus off error Not used The status obtained using this function is not required for control, but is useful for determining whether or not a communications error originated in the network. 95 Section 4-7 Maintenance API Functions Reading Scanner Status: SCAN_GetScannerStatus() Application Range Open status Function Gets the scanner status. Call Format BOOL SCAN_GetScannerStatus(DWORD Handle, DWORD *Status) Arguments Type DWORD DWORD * Name Handle Status Contents Device handle obtained by SCAN_Open() Buffer address for receiving the status. Return Value TRUE is returned if the specified Board’s scanner status was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The following table shows the location and meaning of the scanner status flags. The flags are contained within 32 bits. Bit 0 1 2 3 4 5 6 7 8 9 to 12 13 14 and 15 16 17 18 to 20 21 22 23 to 30 31 Code B00 B01 --B03 B04 B05 B06 B07 B08 --B13 --B16 B17 --B21 B22 --B31 Meaning Scanner function error occurred Master function error occurred Not used Slave function error occurred Memory error Bus off error MAC ID duplication error Network power supply error Transmission timeout error Not used Invalid message monitoring timer Not used Online Scanning (I/O communications being executed) Not used Slave function enabled mode Automatic setting of Slave scan type Not used Error log in use Monitor scanner status bit 0 to check if errors have occurred when using Master or Slave functions to perform I/O communications. Bits 0 to 13 notify if errors have occurred. Bit 0 is an OR of bits 1 to 13. Bit 1 turns ON if an error occurs with the Master function. Bit 1 is an OR of bits 0 and 2 of the Master function status obtained using SCAN_Get MasterModeStatus(). Bit 3 turns ON if an error occurs with the Slave function. Bit 3 is an OR of bits 2 and 3 of the Slave function status obtained using SCAN_Get SlaveModeStatus(). Reading Master Function Status: SCAN_GetMasterModeStatus() Application Range Open status Function Gets the Master function status. 96 Section 4-7 Maintenance API Functions Call Format BOOL SCAN_GetMasterModeStatus(DWORD Handle, WORD *Status) Arguments Type DWORD WORD * Name Handle Status Contents Device handle obtained by SCAN_Open() Buffer address for receiving the status. Return Value TRUE is returned if the specified Board’s Master function status was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The following table shows the location and meaning of the Master function status flags. The flags are contained in 16 bits. Bit Code 0 B00 1 --2 B02 3 to 14 --15 B15 Meaning Verification error Not used I/O communications error Not used I/O communications in progress Bit 15 indicates that the node has started I/O communications as the Master. Execute I/O data I/O processing with Slaves only after checking the status of each Slave using SCAN_GetSlaveDeviceStatus(). Check verification error details for each Slave using SCAN_Get SlaveDeviceStatus(). Bits 0 and 2 indicate Master function errors. When either bit 0 or 2 turn ON, bit 1 of the scanner status obtained using SCAN_GetScannerStatus() will turn ON. Reading Slave Detailed Status: SCAN_GetSlaveDeviceStatus() Application Range Open status Function Gets the specified Slave’s detailed status. Call Format BOOL SCAN_GetSlaveDeviceStatus(DWORD Handle, WORD MacId, WORD *Status) Arguments Type DWORD WORD Name Handle MacId WORD * Status Contents Device handle obtained by SCAN_Open() Node address for reading detailed Slave status. Setting range: 0x00 to 0x3F (0 to 63) Buffer address for receiving status. Return Value TRUE is returned if the specified Slave’s device status was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The following table shows the location and meaning of the Slave device status flags. Bit 0 1 2 3 Code B00 B01 B02 B03 Meaning Error occurred Verification error Invalid Slave Vendor ID discrepancy 97 Section 4-7 Maintenance API Functions Bit 4 5 6 7 8 10 15 Code B04 B05 B06 B07 B08 B10 B15 Meaning Product type discrepancy Product code discrepancy Unsupported connection I/O size discrepancy Connection path discrepancy I/O communications error I/O communications in progress Bit 0 is an OR of bits 1 and 10. Bit 1 is an OR of bits 2 to 8. The details of the verification error are indicated by bits 2 to 8. Check that bit 15 is ON before performing I/O processing with Slaves using the Master function. Checking Slave Registration: SCAN_IsScanlistSlaveDeviceRegist() Application Range Open status Function Checks whether or not a Slave is registered in the scan list. Call Format BOOL SCAN_IsScanlistSlaveDeviceRegist(DWORD Handle, WORD MacId) Arguments Type DWORD WORD Return Value Name Handle MacId Contents Device handle obtained by SCAN_Open() Node address to check Setting range: 0x00 to 0x3F (0 to 63) TRUE is returned if the specified Slave is registered in the scan list; FALSE is returned if an error occurred or the Slave is not registered in the scan list. Detailed error information can be read with the GetLastError() function. Checking Slave Connection Established: SCAN_IsDeviceConnection() Application Range Open status Function Checks whether or not a connection has been established with a Slave. Call Format BOOL SCAN_IsDeviceConnection(DWORD Handle, WORD MacId) Arguments Type DWORD WORD Return Value Name Handle MacId Contents Device handle obtained by SCAN_Open() Node address for which the connection is to be checked. Setting range: 0x00 to 0x3F (0 to 63) TRUE is returned if a connection has been established successfully with the specified device. FALSE is returned if a connection has not been opened normally. Detailed error information can be read with the GetLastError() function. Reading the Current Communications Cycle Time: SCAN_GetCycleTime() Application Range Open status Function Gets the present value of the communications cycle time. Call Format BOOL SCAN_GetCycleTime(DWORD Handle, WORD *CycleTime) 98 Section 4-7 Maintenance API Functions Arguments Type DWORD WORD * Name Handle CycleTime Contents Device handle obtained by SCAN_Open() Buffer address for receiving the present value for the communications cycle time. Return Value TRUE is returned if the communications cycle time was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The present value of the communications cycle time will be stored in ms. Reading the Maximum Communications Cycle Time: SCAN_GetMaxCycleTime() Application Range Open status Function Gets the maximum value of the communications cycle time. Call Format BOOL SCAN_GetMaxCycleTime(DWORD Handle, WORD *CycleTime) Arguments Type DWORD WORD * Name Handle CycleTime Contents Device handle obtained by SCAN_Open() Buffer address for receiving the maximum communications cycle time. Return Value TRUE is returned if the maximum communications cycle time was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The maximum value after the SCAN-ClearCycleTime() function is executed, power is turned ON, or the Board is reset is held as the maximum communications cycle time. Reading the Minimum Communications Cycle Time: SCAN_GetMinCycleTime() Application Range Open status Function Gets the minimum value of the communications cycle time. Call Format BOOL SCAN_GetMinCycleTime(DWORD Handle, WORD *CycleTime) Arguments Type DWORD WORD * Name Handle CycleTime Contents Device handle obtained by SCAN_Open() Buffer address for receiving the minimum communications cycle time. Return Value TRUE is returned if the minimum communications cycle time was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The minimum value after the SCAN_CycleTime function is executed, the power is turned ON, or the Board is reset is held in the minimum communications cycle time. Clearing the Minimum and Maximum Communications Cycle Time: SCAN_ClearCycleTime() Application Range Open status 99 Section 4-7 Maintenance API Functions Function Clears the maximum and minimum communications cycle time values held in the Board. Call Format BOOL SCAN_ClearCycleTime(DWORD Handle) Arguments Type DWORD Return Value Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the maximum and minimum communications cycle times were cleared successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Reading Slave Function Status: SCAN_GetSlaveModeStatus() Application Range Open status Function Gets the Slave function status. Call Format BOOL SCAN_GetSlaveModeStatus(DWORD Handle, WORD *Status, WORD *MacId) Arguments Type DWORD WORD* WORD* Name Handle Status MacId Contents Device handle obtained by SCAN_Open() Buffer address for receiving the status. Buffer address for receiving the Master node address. Return Value TRUE is returned if the specified Board’s Slave function status was read successfully. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description The following table shows the location and meaning of the Slave function status flags. The flags are contained in 16 bits. Bit 0 and 1 2 3 4 to 11 12 13 14 15 Code --B02 B03 --B12 B13 B14 B15 Meaning Not used I/O communications error (Output data 1 and input data 1) I/O communications error (Output data 2 and input data 2) Not used Connection 2 established Connection 1 established I/O communications in progress (Output data 2 and input data 2) I/O communications in progress (Output data 1 and input data 1) The correct value for the Master node address is stored when bit 12 or bit 13 turns ON. Bits 2 and 3 indicate Slave function errors. When either bit 2 or 3 turns ON, bit 3 of the scanner status obtained using SCAN_GetScannerStatus() turns ON. Check that bits 14 or 15 is ON before performing I/O data I/O processing using the Slave function. 100 Section 4-7 Maintenance API Functions 4-7-2 Error Log Access Service API Functions ERROR_TIME Structure This structure defines the format of the error time stamp data. This structure is used within the ERROR_INFO structure and in the SCAN_GetErrorLog() function. Type BYTE BYTE BYTE BYTE BYTE BYTE Name Second Minute Hour Day Month Year Contents (BCD) Second when error occurred Minute when error occurred Hour when error occurred Day when error occurred Month when error occurred Year when error occurred ERROR_INFO Structure This structure defines the format of the error log data. This structure is used within the ERROR_LOG structure and in the SCAN_GetErrorLog() function. Type WORD WORD ERROR_TIME Name ErrorCode DetailCode Time Contents Error code Detail code Time when error occurred ERROR_LOG Structure This structure consolidates all of the error log data. It is used with the SCAN_GetErrorLog() function. Type WORD ERROR_INFO Name ErrorCount ErrorInfo[64] Contents Number of error records contained in the error log Error log information Reading an Error Log: SCAN_GetErrorLog() Application Range Open status Function Reads the error log from the specified Board. Call Format BOOL SCAN_GetErrorLog(DWORD Handle, ERROR_LOG *Log) Arguments Type DWORD ERROR_LOG * Name Handle Log Contents Device handle obtained by SCAN_Open() Buffer address for receiving the error log data. Return Value TRUE is returned if the error log was read successfully from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Refer to 7-3 Error Log Function for details on the error log function such as the meaning of error codes. Error logs not saved to non-volatile memory are held only in open status. The error log is cleared when the Board is closed, the power turned OFF, or the Board is reset. Error logs saved to non-volatile memory can be read again even after the Board is re-opened or restarted. 101 Section 4-7 Maintenance API Functions Clearing an Error Log: SCAN_ClearErrorLog() Application Range Open status Function Clears the error log from the specified Board. Call Format BOOL SCAN_ClearErrorLog(DWORD Handle) Arguments Type DWORD Name Handle Contents Device handle obtained by SCAN_Open() Return Value TRUE is returned if the error log data was successfully cleared from the specified Board. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Clears the error log stored in non-volatile memory. 4-7-3 PC Watchdog Timer Service API Functions Setting the PC WDT: SCAN_EnablePCWDTTimer() Application Range Open status Function Enables or disables the Board’s PC watchdog timer management function. Call Format BOOL SCAN_EnablePCWDTTimer(DWORD Handle, BOOL Enable, WORD Timer) Arguments Type DWORD BOOL Name Handle Enable WORD Timer Contents Device handle obtained by SCAN_Open() PC watchdog timer setting TRUE: Enabled (PC-WDT is used.) FALSE: Disabled (PC-WDT is stopped.) Monitoring time setting 0x0 to 0xFFFF (0 to 65535) (Monitoring time = Set value × 10 ms) Return Value TRUE is returned if the processing was completed normally. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Description Refer to 3-11 PC Watchdog Timer Management Function for details on the PC watchdog timer management function. Refreshing the PC WDT: SCAN_RefreshPCWDTTimer() Application Range Open status Function Refreshes the PC watchdog timer’s timer value in the specified Board. Call Format BOOL SCAN_RefreshPCWDTTimer(DWORD Handle) Arguments Type DWORD Return Value 102 Name Handle Contents Device handle obtained by SCAN_Open() TRUE is returned if the processing was completed normally. FALSE is returned if an error occurred. Detailed error information can be read with the GetLastError() function. Maintenance API Functions Description Section 4-7 When using the PC watchdog timer management function, be sure to refresh the timer value with this function within the PC-WDT timer value. Remote I/O communications will stop if the set timer value elapses before the timer value is refreshed. Refer to 3-11 PC Watchdog Timer Management Function for details on the PC watchdog timer management function. 103 Maintenance API Functions 104 Section 4-7 SECTION 5 Sample Programs This section describes the sample programs that have been provided as reference when writing programs for the DeviceNet PCI Board. 5-1 Sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 5-2 Using DeviceNet Scanner Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 5-2-1 DeviceNet Scanner Demo Functions . . . . . . . . . . . . . . . . . . . . . . . . 106 5-2-2 Usage Example for I/O Communications . . . . . . . . . . . . . . . . . . . . . 107 5-2-3 Usage Example for Explicit Message Communications . . . . . . . . . . 114 105 Section 5-1 Sample 5-1 Sample The following sample programs are extracted into the “Sample” directory when the Scanner SDK is installed. Path Sample\BusDELog Sample\DemoToo Function This sample program displays the Scanner’s error log. This sample program operates the Scanner function and executes remote I/O communications and message communications. The sample programs can be started from the program folder specified when the Scanner SDK Software was installed. The following diagram shows the starting window of the Scanner Error History Viewer. MicroSoft Visual C++ version 6.0 or higher is required to build the sample program. The sample programs are provided to show how to use the API functions; they are not intended to be used as-is. 5-2 5-2-1 Using DeviceNet Scanner Demo DeviceNet Scanner Demo Functions The DeviceNet Scanner Demo program performs the following functions: • Opens the Board. • Closes the Board. • Connects to network (goes online). 106 Using DeviceNet Scanner Demo Section 5-2 • Disconnects from the network (offline). • Creates scan lists. • Registers scan lists. • Refreshes and monitors output and input data. • Starts I/O communications. • Stops I/O communications. • Sends explicit client request messages and receives responses. 5-2-2 Usage Example for I/O Communications This section provides an example of performing I/O communications with Slaves using the DeviceNet Scanner Demo program. Opening the Board Use the following procedure to open the Board and prepare it for use. 1,2,3... 1. Select Open from the Board menu. 2. The following Open Board Window will be displayed. 3. Select the Board to be used and click Open. 4. The specified Board will be opened and ready for use. The Board number (Board ID) will be displayed on the status bar. Creating Scan Lists Use the following procedure to create a scan list in the DeviceNet Scanner Demo program. 1,2,3... 1. Select Register to ScanList from the Edit menu. 2. The following Add Device Window for registering Slaves will be displayed. 107 Using DeviceNet Scanner Demo Section 5-2 3. Set the Slave node address (MAC ID) and I/O size (OUT Size and IN Size). Select User Setup to specify the I/O connection, and set the connection to be used and the I/O size. 4. Click OK to register the Slave in the main window. 5. Once all the Slaves have been registered, click Cancel, to display the created scan list in the main window, as shown below. Note Registering Scan Lists 1,2,3... The icons in the MAC ID column will be displayed in gray until the scan list is registered to the Board. Use the following procedure to register the created scan list to the Board. 1. Select Set ScanList from the Board menu. 2. The icons in the MAC ID column will change from gray, as shown below, when the scan list is registered correctly. 108 Using DeviceNet Scanner Demo Connecting to the Network Section 5-2 Use the following procedure to connect the Board to the DeviceNet network (i.e., go online). 1,2,3... 1. Select Online from the Scanner menu. 2. The following Go Online Window will be displayed. 3. Set the Board’s node address (MAC ID) and baud rate, and click OK. 4. The Board will go online, i.e., will be connected to the DeviceNet network. The status bar will indicate the online status (“OL” at the far right) and the node address will be displayed next to the Board number. Note Setting Initial Output Data 1,2,3... I/O communications have not started yet, even though the Board is online. Use the following procedure to set the initial output data before starting I/O communications. 1. Select the Slave with the output data. 2. Select I/O Data from the Scanner menu. 3. The following window will be displayed. 109 Using DeviceNet Scanner Demo Section 5-2 4. Enter the output data to be set and click Write. Note The output data will not be sent yet. 5. Perform the above operation for all Slaves that have output data. Starting I/O Communications Use the following procedure to start I/O communications with Slaves. 1,2,3... 1. Select Start Cycle from the Scanner menu. 2. The following Start Cycle Window will be displayed. 3. Set the communications cycle time (Cycle Time) and click OK. Specify 0 to automatically set the communications cycle time. 4. I/O communications will start. The status will be displayed in the Status column for each Slave, as shown in the following diagram, if I/O communications have been started correctly. 110 Using DeviceNet Scanner Demo Note Refreshing and Monitoring Output and Input Data 1,2,3... Section 5-2 It takes several seconds for a connection to be established (and until the status is displayed). Use the following procedure to refresh output data and monitor input data for each Slave during I/O communications. 1. Select the desired Slave. 2. Select I/O Data from the Scanner menu. 3. The I/O Data Window will be displayed, as shown below. 111 Section 5-2 Using DeviceNet Scanner Demo • Output Data • Input Data The input data will be displayed. 4. Multiple I/O data setting and monitoring windows can be displayed at the same time. Automatically Refreshing Output Data Use the following procedure to automatically refresh output data to be sent to Slaves. 1,2,3... 1. Display the I/O Data Window for the corresponding Slave. 2. Click Increment. 3. The current output data will be automatically incremented and sent. 112 Using DeviceNet Scanner Demo Section 5-2 4. Click Stop to stop automatic refresh. Changing Input Data Monitor Interval and Output Data Automatic Refresh Interval Use the following procedure to change the monitor interval for input data and the automatic refresh interval for output data. 1,2,3... 1. Display the I/O Data Window for the corresponding Slave. 2. Click Option. 3. The following Option Window will be displayed. 4. Set the Monitor Interval or Increment Interval timer value, and click OK. 5. The input data monitoring and output data automatic refresh will be performed at the set intervals. Stopping I/O Communications Use the following procedure to stop I/O communications with Slaves. 1,2,3... 1. Select Stop Cycle from the Scanner menu. 2. I/O communications with Slaves will be stopped. Disconnecting from the Network 1,2,3... Use the following procedure to disconnect from the DeviceNet network (i.e., go offline). 1. Select Offline from the Scanner menu. 2. The PCI Board will go offline, i.e., be disconnected from the DeviceNet network. The status bar will no longer show “OL” at the far right and the node address will no longer be displayed next to the Board number. Closing Boards Use the following procedure to close the Board. 1,2,3... 1. Select Close from the Board menu. 2. The following confirmation message will be displayed. 3. Click Yes to close the Board. 113 Using DeviceNet Scanner Demo 5-2-3 Section 5-2 Usage Example for Explicit Message Communications The DeviceNet Scanner Demo program has explicit message client functions. Explicit request messages can be sent to remote nodes and responses received. Use the following procedure to send explicit request messages and receive explicit response messages. 1,2,3... 1. Open the Board and connect online to the network. Explicit request messages can be sent regardless if I/O communications are being performed or are stopped. 2. Select Send Explicit Message from the Scanner menu. 3. The following Send Explicit Message Window will be displayed. 4. Set the destination node address (MAC ID) and explicit request message parameters, and click Send. 5. The explicit request message will be sent and the response data displayed. 6. Click Close to finish sending explicit request messages. 114 SECTION 6 Communications Timing This section describes communications timing in remote I/O communications and message communications. 6-1 Remote I/O Communications Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 116 6-1-1 Communications Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 6-1-2 More than One Master in Network . . . . . . . . . . . . . . . . . . . . . . . . . . 118 115 Section 6-1 Remote I/O Communications Characteristics 6-1 Remote I/O Communications Characteristics This section describes the characteristics of remote I/O communications when a DeviceNet PCI Board is used with OMRON Slaves. Use this section for reference when planning operations that require precise I/O timing. The equations provided here are valid under the following conditions: 1,2,3... 1. All of the required Slaves are participating in communications. 2. No errors have occurred in any of the nodes in the network. 3. There are no I/O refreshing requests or command requests from the computer to the board. Note 6-1-1 The values provided by these equations may not be accurate if the conditions described above are not satisfied. Communications Cycle Time The communications cycle time is the time from the completion of a Slave’s remote I/O communications processing until remote I/O communications with the same Slave are processed again. The communications cycle time is used to calculate the maximum I/O response time. The communications cycle time depends on a variety of factors such as the number of Masters in the Network and on whether or not message communications are being performed. The following explanation is for a network with one Master. For networks with two or more Masters, refer to 6-1-2 More than One Master in Network. Communications cycle time (ms) Communications Cycle Time Graph The following graph plots the communications cycle time against the number of Slaves, for a mixture of 16-output point Slaves and 16-input point Slaves. Bit-strobe input and poll connection output are used. 60 50 40 30 20 10 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 No. of Slaves Communications cycle time (500 kbps) [ms] Equations for Calculating Communications Cycle Time : Communications cycle time (250 kbps) [ms] : Communications cycle time (125 kbps) [ms] Use the equations shown below to calculate the communications cycle time (TRM) for a network with one Master. (The minimum communications cycle time is actually 2 ms even if the result of this calculation is less than 2 ms.) TRM = Σ (Communications time per Slave) + High-density Unit processing time + Explicit message processing time + COS/Cyclic connection communications time [ms] + 0.01 × N + 1.0 [ms] 116 Remote I/O Communications Characteristics Section 6-1 Communications Time Per Slave: This is the communications time required for a single Slave (see below). “Σ (Communications time per Slave)” represents the total of the “Communications time per Slave” for all the Slaves in the network. High-density Unit Processing Time: 3.5 [ms] This is added if there are any Slaves in the network that use at least 8 bytes for input, output, or both. Explicit Message Processing Time: (0.11 × TB) × n [ms] Only added when explicit communications (transmission or reception) are performed. n: Number of explicit messages that occur at the same time during one CPU Unit cycle (including transmission and reception). TB = Baud rate factor (TB = 2 for 500 kbps, TB = 4 for 250 kbps, and TB = 8 for 125 kbps) COS/Cyclic Connection Communications Time [ms]: {(0.05 + 0.008 × S) × TB} × n [ms] S: Total input and output size (in bytes) for COS/Cyclic connection. TB = 2 for 500 kbps, TB = 4 for 250 kbps, and TB = 8 for 125 kbps n: Number of nodes for COS/Cyclic connections that are used at the same time in one communications cycle. N: Number of Slaves Communications Time/ Slave The communications time per Slave is the time required for communications with a single Slave. Use the following equations to calculate the communications time/Slave (TRT) for each kind of Slave. Output Slaves with less than 8 Bytes of Output TRT = 0.016 ×TB × SOUT1 + 0.11 × TB + 0.07 [ms] SOUT1: The number of Output Slave output words Baud rate factor T B: (TB = 2 for 500 kbps, TB = 4 for 250 kbps, and TB = 8 for 125 kbps) Input Slaves with less than 8 Bytes of Input TRT = 0.016 ×TB × SIN1 + 0.06 × TB + 0.05 [ms] SIN1: T B: The number of Input Slave input words Baud rate factor (TB = 2 for 500 kbps, TB = 4 for 250 kbps, and TB = 8 for 125 kbps) Mixed I/O Slaves with less than 8 Bytes each of Input and Output TRT = 0.016 × TB × (SOUT2 + SIN2) + 0.11 × TB + 0.07 [ms] SOUT2: The number of Mixed I/O Slave output words SIN2: The number of Mixed I/O Slave input words Baud rate factor T B: (TB = 2 for 500 kbps, TB = 4 for 250 kbps, and TB = 8 for 125 kbps) Slaves with more than 8 Bytes of Input or Output or both TRT = TOH + TBYTE-IN × BIN + TBYTE-OUT × BOUT [ms] 117 Section 6-1 Remote I/O Communications Characteristics TOH : TBYTE-IN : BIN : TBYTE-OUT : BOUT : Protocol overhead The input byte transmission time The number of input bytes The output byte transmission time The number of output bytes Baud rate 500 kbps 250 kbps 125 kbps TOH 0.306 ms 0.542 ms 1.014 ms TBYTE-IN 0.040 ms 0.073 ms 0.139 ms TBYTE-OUT 0.036 ms 0.069 ms 0.135 ms For Input Slaves use BOUT = 0, and for Output Slaves use BIN = 0. 6-1-2 More than One Master in Network This section explains how to calculate the remote I/O communications cycle time (TRM) when there is more than one Master in the Network. In this example there are two Master Units in the Network. First, the Network is divided into two groups: Master A and the Slaves in remote I/O communications with it and Master B and the Slaves in remote I/O communications with it. Slave A Group A Group B Master A Master B Slave B Slave C Slave D Slaves in remote I/O communications with Master A Note Slave E Slave F Slaves in remote I/O communications with Master B The Slaves are physically separated into two groups for clarity in this diagram, but the actual physical positions in the Network are irrelevant. Next, we refer to the equations introduced in 6-1-1 Communications Cycle Time and calculate the communications cycle time for each group as if they were separate Networks. Group B Group A Master B Master A Slave A Slave B Slave C Slave D Group A communications cycle time: TRM-A Slave E Slave F Group B communications cycle time: TRM-B In a Network with two Masters, the communications cycle time for the entire Network is the sum of the communications cycle times for the two groups. TRM = TRM-A + TRM-B 118 Remote I/O Communications Characteristics Section 6-1 Although this example shows only two Masters in the Network, the total communications cycle time for any Network can be calculated by dividing it into groups and adding the communications cycle times of all groups. 119 Remote I/O Communications Characteristics 120 Section 6-1 SECTION 7 Error Processing This section describes troubleshooting and error processing procedures needed to identify and correct errors that can occur during DeviceNet PCI Board operation. 7-1 LED Indicators and Error Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 7-2 Identifying Errors Detected by Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 7-3 Error Log Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 121 Section 7-1 LED Indicators and Error Processing 7-1 LED Indicators and Error Processing The DeviceNet PCI Board have an MS (Module Status) indicator that indicates the status of the Board itself and an NS (Network Status) indicator that indicates the status of the Network. These indicators show when an error has occurred and what type of error it is. This section explains the meaning of the LED indicators and the processing required when an error has occurred. This explanation assumes that the Board has been installed and set up properly. Indicator Status during Normal Operation Indicator status MS NS OFF OFF Flashing OFF (green) ON OFF (green) The following table shows the status of the MS and NS indicators during normal operation. Network/Board status Comments Waiting for initialization Waiting for start of scanner program MAC ID (node address) duplication check in progress ON (green) Flashing (green) Remote I/O communications stopped and message communications not established. ON (green) ON (green) Remote I/O or message communications in progress. Indicator Status when an Error has Occurred Indicator status MS NS Flashing No (red) change Waiting for online request or the request has been received and a node address duplication check is in progress between the Board and other nodes in the network. Communications have not been established with other nodes even though the Board is online. With message communications, this indicates that the local node has not sent a message to another node and that a message has not been received from another node. Indicates normal communications when remote I/O and/or message communications are active. The following table shows the status of the MS and NS indicators when an error has occurred and lists probable causes for the errors. Error Hardware error (EEPROM) Flashing (red) OFF PC watchdog timer error ON (red) OFF Hardware error (Watchdog timer or RAM) No change ON (red) Node address duplication Bus off detected 122 Boot program initialization processing is being executed. Scanner firmware initialization processing is being executed. Probable cause and remedy An EEPROM error occurred. Replace the Board. The Board’s PC watchdog timer management function detected a PC watchdog timer error. (The computer application has stopped.) Restart the computer application or the computer itself. One of the following hardware errors occurred: • Board watchdog timer error • RAM error Replace the Board The Board’s node address has been set on another node. Change the node address settings to eliminate the duplication. Restart the computer or reset the Board. Communications were stopped because a large number of data errors occurred. • Check the communications baud rate settings in all of the nodes. • Check that the cable lengths (trunk and drop lines) are within specifications. • Check for loose or broken cables. • Check that there are Terminating Resistors at each end of the trunk line and nowhere else in the network. • Check for excessive noise. Section 7-2 Identifying Errors Detected by Functions Indicator status MS NS No change OFF Error Send error: Network power supply error Send error: Transmission timeout No change Flashing (red) Verification error: Slave doesn’t exist Unsupported Slave Verification error: Slave I/O size mismatch I/O Communications error OFF 7-2 OFF System error Probable cause and remedy The communications power supply isn’t being supplied properly. Check the network power supply and network cable wiring. A transmission couldn’t be completed successfully for one of the following reasons: • There are no Slaves in the network. • There is another Master in the Network. • There is an error in the CAN controller. • The Master and Slave baud rate settings don’t agree. Check the following: • Check the communications baud rate settings in all of the nodes. • Check that the cable lengths (trunk and drop lines) are within specifications. • Check for loose or broken cables. • Check that there are Terminating Resistors at each end of the trunk line and nowhere else in the network. • Check for excessive noise. A Slave registered in the scan list does not exist in the network. Check the following: • Check the communications baud rate settings in all of the nodes. • Check that the cable lengths (trunk and drop lines) are within specifications. • Check for loose or broken cables. • Check that there are Terminating Resistors at each end of the trunk line and nowhere else in the network. • Check for excessive noise. A Slave is connected that has an I/O size exceeding 200 bytes. Remove Slaves from the network if they have an I/O size greater than 200 bytes. The I/O size of a Slave registered in the scan list doesn’t match the actual Slave in the network. Check the Slave and create the scan list again. A timeout occurred in I/O communications. Check the following: • Check the communications baud rate settings in all of the nodes. • Check that the cable lengths (trunk and drop lines) are within specifications. • Check for loose or broken cables. • Check that there are Terminating Resistors at each end of the trunk line and nowhere else in the network. • Check for excessive noise. Replace the Board. Identifying Errors Detected by Functions This section lists the errors that can be identified using the Board’s Master API functions. The return value returned by API functions indicates when an error has occurred during execution of the function. (Refer to Checking for Errors with Function Return Values on page 45) Error Codes All of the Board’s Master API functions are bool-type functions, so FALSE is returned as the return value when an error has occurred during execution. When FALSE is returned, the GetLastError() function can be used to read more detailed error information (the error code.) 123 Identifying Errors Detected by Functions Section 7-2 The following table lists the error codes and the and the probable causes for those errors. Note Refer to Checking for Errors with Function Return Values on page 45 for information on how to check errors using error codes. Error code SCAN_INVALID_HANDLE Value 0x20000001 SCAN_ALREADY_USED 0x20000002 SCAN_ERROR_DRIVER_FUNCTION 0x20000003 SCAN_NOT_EXIST_DEVICE 0x20000004 SCAN_TIMEOUT 0x20000005 SCAN_NOT_MODULE_PATH 0x20000006 SCAN_NOT_EXIST_MODULE SCAN_NOT_ALLOCATE_MEMORY 0x20000007 0x20000008 SCAN_NOT_OPEN_DRIVER 0x20000009 SCAN_NOT_CREATE_EVENT SCAN_INVALID_PARAMETER 0x2000000A 0x2000000B SCAN_NOT_EXECUTECOMMAND 0x2000000C SCAN_NOT_DOWNLOAD 0x2000000D SCAN_NOT_ENOUGH_BUFFER 0x20001000 SCAN_RES_NOT_RECEIVED SCAN_REQ_NOT_RECEIVED SCAN_INVALID_REGISTHANDLE 0x20001001 0x20001002 0x20001003 SCAN_INVALID_REGISTMSG 0x20001004 SCAN_NOT_EVENTDATA SCAN_NOT_EVENT SCAN_FILE_IO_ERROR 0x20001005 0x20001006 0x20001007 SCAN_INVALID_CMD SCAN_SYSTEM_BUSY SCAN_OFF_LINE 0x20010010 0x20010011 0x20010020 SCAN_PROCESSING_ON_LINE 0x20010021 SCAN_ON_LINE 0x20010022 SCAN_SCANNING 0x20010023 SCAN_NOT_SCANNING 0x20010024 124 Likely cause and remedy The driver handle is invalid. Specify a valid driver handle and execute the function again. The specified driver is already being used by another application. Execute the function again after the other application ends. An error occurred in the driver function. Check the parameters and execute the function again. There isn’t a Board with the specified Board ID. Specify the Board ID set on a Board in the computer. The command timed out. Reset the Board and execute the function again. The communications module path cannot be found. Install again. The communications module cannot be found. Install again. Memory cannot be allocated. Close other applications and execute the function again. The driver cannot be opened. Check that the driver is installed properly and execute the function again. The interrupt event cannot be created. A parameter is invalid. Specify the parameter correctly and execute the function again. An error occurred during execution of the command. Check the parameters and execute the function again. An error occurred while downloading the communications module. Check that there isn’t a problem with the hardware and execute the function again. There isn’t enough buffer space to store the data. Increase the size of the buffer. The client response has not been received. The server request has not been received. The window or thread handle being registered is invalid. Specify a valid handle. The notification message being registered is invalid. Specify a valid message. There is no event data. There isn’t such an event. An error occurred during file access. Check that the file exists and isn’t corrupted and then execute the function again. The command code is invalid. Specify a valid code. The system is busy. The function can’t be executed because the Board is offline. Switch online and execute the function again. The function can’t be executed because the connection is initializing. Wait a moment and execute the function again. The function can’t be executed because the Board is online. Switch offline and execute the function again. The function can’t be executed because scanning is in progress. Stop scanning and execute the function again. The function can’t be executed because scanning is stopped. Start scanning and execute the function again. Section 7-3 Error Log Function Error code Value SCAN_AUTO_SCANNING 0x20010025 SCAN_FIXED_SCANNING SCAN_BUS_OFF 0x20010026 0x20010029 SCAN_CONNECTED SCAN_DISCONNECTED SCAN_NO_NET_POWER 0x2001002A 0x2001002B 0x2001002C SCAN_TX_TIME_OUT 0x2001002D SCAN_DUP_MAC_ERROR 0x2001002E SCAN_INVALID_BAUD_RATE 0x20010040 SCAN_INVALID_MAC_ID SCAN_INVALID_SCAN_TYPE 0x20010041 0x20010042 SCAN_INVALID_IO_SIZE 0x20010043 SCAN_INVALID_CLASS_ID SCAN_INVALID_INSTANCE_ID SCAN_INVALID_ATTRIBUTE_ID SCAN_INVALID_SELF_SLAVE 0x20010044 0x20010045 0x20010046 0x20010047 SCAN_TOO_MANY_CLASS SCAN_INVALID_SCAN_LIST 0x20010048 0x20010049 SCAN_NO_COS_CNXN 0x20010060 SCAN_NO_EMC_CNXN 0x20010061 SCAN_EMC_CNXN_TIME_OUT 0x20010062 SCAN_SND_MSG_TOO_LONG SCAN_RSP_MSG_TOO_LONG SCAN_DEST_DEVICE_OVERFLOW 0x20010063 0x20010064 0x20010065 SCAN_MEMORY_ACCESS_CONFLICT 0x20010080 SCAN_MEMORY_ERROR SCAN_SUM_CHECK_ERROR 0x20010081 0x20010082 7-3 Likely cause and remedy The function can’t be executed because the Board is operating in disabled mode. Switch to enabled mode and execute the function again. The Board is already operating in disabled mode. The function can’t be executed because a bus off error occurred. Clear the error and execute the function again. The connection is already established. The connection is already disconnected. The network power supply is not being supplied. Connect the network power supply and execute the function again. A timeout occurred in the transmission. Check that the destination node is connected and the network isn’t overloaded with high-priority messages. Wait a moment and execute the function again. The specified node address is duplicated on another device. Specify another node address. The communications baud rate is invalid. Specify a valid baud rate. The node address is invalid. Specify a valid node address. The scan type is invalid. Specify a valid scan type and execute the function again. The data size is invalid. Specify a valid data size and execute the function again. The specified class ID is not registered. The instance ID is invalid. Specify a valid instance ID. The attribute ID is invalid. Specify a valid attribute ID. An effective Slave scan list is not registered. Register in the Slave scan list. Too many class IDs have been registered. There are no devices registered in the scan list. Register the devices. A COS connection has not been established. Establish the connection and execute the function again. An explicit message connection has not been established. Establish the connection and execute the function again. A timeout occurred when establishing the explicit message connection. Check the target of the connection and execute the function again. The transmission data size is too long. The reception data size is too long. The transmission buffer overflowed. Allow a little more time between transmissions and execute the function again. The I/O allocations overlap. Set the I/O allocations again to eliminate the overlap. An EEPROM write error occurred. An checksum error occurred. Error Log Function The DeviceNet PCI Board is equipped with an error log function that can store up to 64 error records on errors that occur. The records show the error code and time of occurrence. 125 Section 7-3 Error Log Function The error log data can be read from the Board with the SCAN_GetErrorLog() function. (See page 101 for details.) The error log can be cleared with the SCAN_ClearErrorLog() function. (See page 102 for details.) Note 1. Important error data in the error log is saved to non-volatile memory. Error data not saved to non-volatile memory is held only while the Board is open. All error data not saved to non-volatile memory is cleared when the Board is closed, the power turned OFF, or the Board reset. 2. Error data saved to non-volatile memory can be read once the Board is opened or started again. 3. Error logs saved to non-volatile memory can also be read with the Scanner Error History Viewer utility that is included with the Board’s software. Error Log Data Each error log record has the following structure. The Board’s error log can store up to 64 error records. If an error occurs when the error log is full, the oldest record is erased to make room for the new record. Variable name ErrCode DetailCode Second Minute Hour Day Month Year Note Error Code Table Error code (Hex) 0001 0101 Data type WORD WORD BYTE BYTE BYTE BYTE BYTE BYTE The error log data is defined in the ERROR_INFO structure. (See page 101 for details.) The following table shows the error codes that can be recorded by the error log function and the corresponding errors. Refer to 7-1 LED Indicators and Error Processing for details on error processing. Error Detailed information 1st byte (Offset = 0002h) 00 Hex PC watchdog timer error A timeout occurred in the PC_WDT monitoring function. Can’t send response message when offline. 80 Hex 0106 Can’t send response message because MAC ID duplication error occurred. 80 Hex 0107 Response message transmission failed because connection is not established yet. 80 Hex 0109 Destination node’s buffer full 80 Hex 126 Contents (BCD) Error code Detail code Second when error occurred Minute when error occurred Hour when error occurred Day when error occurred Month when error occurred Year when error occurred 2nd byte (Offset = 0003h) 00 Hex Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON EEPROM storage Yes No No No No Section 7-3 Error Log Function Error code (Hex) Error Detailed information st 0111 Service data too long 1 byte (Offset = 0002h) 80 Hex 0117 Internal buffer full 00 Hex 0112 Response message discarded because the 80 Hex message ID is invalid 0211 021A MAC ID duplication error Setting table logic error 00 Hex 00 Hex 0340 0341 0342 0343 Bus off error Network power supply error Transmission timeout error I/O configuration error 0344 Verification error 0345 I/O communications error 0346 Scanning stopped due to I/O communications error 00 Hex 00 Hex 00 Hex 03 Hex Unsupported Slave 01 Hex: Non-existent Slave (including use of the local MAC ID) 02 Hex: Invalid vendor ID 03 Hex: Invalid product type 04 Hex: Invalid product code 05 Hex: Unsupported connection 06 Hex: I/O size mismatch 07 Hex: Invalid connection path 01 Hex: Master function 02 Hex: Slave function 01 Hex: I/O communications error 02 Hex: Network power supply error 03 Hex: Transmission timeout nd 2 byte (Offset = 0003h) Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Bits 0 to 5: Server device MAC ID Bit 6: OFF Bit 7: ON Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Local MAC ID 0A Hex: Scan list 0B Hex: Slave scan list 0C Hex: Message monitoring timer list 00 Hex 00 Hex 00 Hex Unsupported Slave’s MAC ID Slave’s MAC ID With Master function: Slave’s MAC ID With Slave function: Master’s MAC ID EEPROM storage No No No No Yes No No No No No No I/O communications error: No Faulty Slave’s MAC ID Network power supply error: Local MAC ID Transmission timeout: Local MAC ID 127 Section 7-3 Error Log Function Error code (Hex) Error Detailed information st 0348 Response message discarded because a new request was received 0601 0602 System error Memory error Note 128 nd EEPROM storage 1 byte (Offset = 0002h) 80 Hex 2 byte (Offset = 0003h) Bits 0 to 5: Client device MAC ID Bit 6: OFF Bit 7: ON Undefined 01 Hex: Read error 02 Hex: Write error Yes 06 Hex: Yes Error log (see note) 09 Hex: Identity information 0A Hex: Scan list 0B Hex: Slave scan list 0C Hex: Message monitoring timer list 0D Hex: Communications cycle time set value No The error record will not be recorded in EEPROM if the memory error occurred in the error log area of EEPROM. Index A API functions See also functions applications precautions, xvi atmosphere, 8 C cables attaching connectors to DeviceNet cables, 34 connecting communications cables, 36 client functions See also explicit messages communications, 116, 117 communications time/slave, 117 connector, 10 cycle time, 116 distance, 7 Explicit messages See also explicit messages I/O communications, 4 message, 5 timing, 115 See also functions speed, 7 timing, 115 communications time/slave, 117 components, 10 configuration, 7 connection methods multi-drop with multi-drop connector, 38 with standard connector, 37 connections checking status, 98 configuration, 7 DeviceNet, 34 establishing, 58, 59 maximum number, 6 slave connection methods, 7 connectors standard, 37 COS connections sending input data, 85 sending output data, 79 current consumption, 8 cycle time, 116 clearing, 99 communications, 116 communications cycle time management, 6 loading, 75 reading, 74, 98 setting, 74 storing, 75 D DeviceNet Scanner SDK software installing, 27 uninstalling, 32 DeviceNet slaves See also slaves dimensions, 10 distance See also communications E EC Directives, xvii errors checking, 45 codes, 123, 126 detected by functions, 123 error log, 125 data, 126 processing, 121 events checking, 4, 44 explicit messages, 5 explicit message client, 49, 60 checking for client response events, 88 clearing response messages, 87 reading length of client response event, 88 receiving, 90 registering response messages, 87 sending, 89 explicit message server, 51, 60 checking request events, 92 clearing registration of object class for client request messages, 91 clearing registration of server notification messages, 92 reading server request event length, 92 receiving, 93 registering object class of client request message, 90 registering server notification messages, 91 sending, 94 129 Index F function descriptions, 62 Board service API functions SCAN_Close, 64 SCAN_GetDriverVersion, 62 SCAN_lsExistCard, 63 SCAN_Offline, 65 SCAN_Online, 64 SCAN_Open, 63 SCAN_Reset, 65 Board service APII functions SCAN_GetVersion, 62 client message service API functions RegClientEvtNotifyMessage, 87 SCAN_GetClientEventLength, 88 SCAN_PeekClientEvent, 88 SCAN_ReceiveClientExplicit, 90 SCAN_SendClientExplicit, 89 SCAN_UnRegClientEvtNotifyMessage, 87 communications service API functions SCAN_ConnectMasterDevice, 82 SCAN_ConnectSlaveDevice, 77 SCAN_DisconnectMasterDevice, 83 SCAN_DisconnectSlaveDevice, 77 SCAN_GetActualSlaveDevice, 76 SCAN_GetScanTimeValue, 74 SCAN_LoadScanTimeValue, 75 SCAN_SetScanTimeValue, 74 SCAN_StartScan, 73 SCAN_StopScan, 74 SCAN_StoreScanTimeValue, 75 error log access service API functions SCAN_ClearErrorLog, 102 SCAN_EnablePCWDTTimer, 102 SCAN_GetErrorLog, 101 SCAN_RefreshPCWDTTimer, 102 I/O data access service API functions SCAN_GetInDat, 78 SCAN_GetSlaveOutData, 84 SCAN_IoRefresh, 78 SCAN_SendMasterCosToSlave, 79 SCAN_SendSlaveCosToMaster, 85 SCAN_SetOutDat, 79 SCAN_SetSlaveInData, 84 SCAN_SlaveIoRefresh, 83 message timer service API functions SCAN_GetMessageTimerValue, 86 SCAN_LoadMessageTimerValueList, 86 SCAN_SetMessageTimerValue, 85 SCAN_StoreMessageTimerValueList, 86 PC Board interrupt service API functions 130 ClearIrqEvent, 68 SCAN_GetIrqControl, 65 SCAN_PeekIrqEvent, 67 SCAN_RegIrqEvtNotifyMessage, 66 SCAN_SetIrqControl, 66 SCAN_UnRegIrqEvtNotifyMessage, 67 scan list operation (master service) API functions SCAN_ClearScanlist, 69 SCAN_GetSlaveDevice, 69 SCAN_GetSlaveDeviceEx, 72 SCAN_LoadScanlist, 70 SCAN_RegisterSlaveDevice, 68 SCAN_RegisterSlaveDeviceEx, 72 SCAN_RemoveDevice, 69 SCAN_SetScanlist, 73 SCAN_StoreScanlist, 70 scan list operation (slave service) API functions SCAN_GetSelfSlaveDevice, 81 SCAN_LoadSlaveScanlist, 82 SCAN_RegisterSelfSlaveDevice, 81 SCAN_RemoveSelfSlaveDevice, 81 SCAN_StoreSlaveScanlist, 82 See also functions server message service API functions SCAN_GetServerEventLength, 92 SCAN_PeekServerEvent, 92 SCAN_ReceiveServerExplicit, 93 SCAN_RegObjectClass, 90 SCAN_RegServerEvtNotifyMessage, 91 SCAN_SendServerExplicit, 94 SCAN_UnRegObjectClass, 91 SCAN_UnRegServerEvtNotifyMessage, 92 status service API functions SCAN_ClearCycleTime, 99 SCAN_GetCycleTime, 98 SCAN_GetMasterModeStatus, 96 SCAN_GetMaxCycleTime, 99 SCAN_GetMinCycleTime, 99 SCAN_GetNetworkStatus, 95 SCAN_GetScannerStatus, 96 SCAN_GetSlaveDeviceStatus, 97 SCAN_GetSlaveModeStatus, 100 SCAN_IsDeviceConnection, 98 SCAN_IsScanlistSlaveDeviceRegist, 98 functions Board service API functions, 62 checking errors, 45 checking events, 4, 44 checking the Board, 63 client message service API functions, 87 closed state, 61 closing the Board, 58, 64 Index communications, 3 communications cycle time management, 6 communications service API functions, 73 error log, 6, 54, 61 clearing, 102 reading, 101 error log access service API functions, 101 explicit messages See also explicit messages I/O communications, 4, 48, 58, 59 I/O data, 59 I/O data access service API functions, 78 initialization, 58 interrupts, 58 maintenance See also maintenance master, 4 message communications, 5 message monitoring timer, 60 message timer service API functions, 85 open state, 61 offline, 61 online, 61 opening the Board, 58, 63 PC Board interrupt service API functions, 65 PC watchdog timer, 6, 54, 61 reading status, 6, 60 reading version, 58, 62 reset, 6, 54, 65 scan list operation (slave service) API functions, 80 scan list operations, 58, 59 See also function descriptions server message service API functions, 90 slave, 5 status service API functions, 95 G general specifications, 8 H humidity, 8 I I/O communications using I/O communications functions, 48 I/O data reading, 59 refreshing, 59, 78, 83 setting, 59 indicators, 11 errors, 122 installation DeviceNet PCI Board, 14 DeviceNet Scanner SDK software, 27 drivers Windows 95, 16 Windows 98, 16 procedure, 14 software, 11, 13 interrupts, 58 control register reading, 65 writing, 66 notification messages, 58 clearing, 67 registering, 66 status clearing, 68 reading, 67 M maintenance functions, 6 communications cycle time management, 6 error log, 6, 54 PC watchdog timer, 6, 54 reading status, 6 reading version, 58 reset, 6, 54 masters functions, 4 maximum number, 5 multiple, 118 reading master function status, 96 reading output data, 84 refreshing I/O data, 78 scan list operations, 58 starting communications, 82 stopping communications, 83 writing input data, 84 message monitoring timer, 60 loading list, 86 reading, 86 See also functions setting, 85 storing list, 86 131 Index N network length, 7 multiple masters, 118 offline, 65 online, 64 reading status, 95 O object class ID clearing, 91 registering, 90 operating environment precautions, xv operation setup, 11 P PC watchdog timer, 6, 54, 61 refreshing, 102 setting, 102 PCI interface, 10 precautions, xiii applications, xvi general, xiv operating environment, xv safety, xiv programs sample, 105 writing, 11 R remote I/O active state, 62 calculating cycle time for multiple masters, 118 characteristics, 116 reading slave information, 76 starting, 58, 59, 73 starting master communications, 82 starting slave communications, 77 stopped state, 62 stopping, 58, 59, 74 stopping master communications, 83 stopping slave communications, 77 timing, 115 reset See also functions rotary switch See also settings S safety precautions See also precautions scan lists, 58, 59 clearing, 69 deleting slave scan list information, 81 loading, 70, 82 reading slave information, 69, 72, 81 registering slaves, 68, 72, 73 removing slaves, 69 storing, 70, 82 scanner reading status, 96 Scanner SDK software See also DeviceNet Scanner SDK software server functions See also explicit messages settings Board ID, 11, 15 hardware, 11 rotary switch, 11, 15 setup, 11 shock resistance, 8 slaves capacity, 4 checking registration, 98 connection methods, 7 exchanging I/O data, 3 function, 5 maximum number, 5 reading slave function status, 100 reading slave information, 76 reading status, 97 refreshing I/O data, 83 scan list operations, 59 starting communications, 77 stopping communications, 77 using other vendor slaves, 3, 4 writing output data, 79 specifications, 8 communications, 5, 8 general specifications, 8 message communications, 9 status 132 Index reading See also functions system hardware/software requirements, 9 T temperature operating, storage, 8 timers message monitoring, 60 troubleshooting, 121 U user applications writing, 11 See also API functions V version reading See also functions vibration resistance, 8 voltage operating voltage range, 8 W weight, 8 133 Index 134 Revision History A manual revision code appears as a suffix to the catalog number on the front cover of the manual. Cat. No. W381-E1-03 Revision code The following table outlines the changes made to the manual during each revision. Page numbers refer to the previous version. Revision code 1 02 Date October 2000 July 2005 03 September 2013 Revised content Original production Revisions were made throughout the manual to add information on the DeviceNet Scanner SDK and make accompanying changes. • Information was added for Windows 7 support. • Changes were made for consistency with information in other manuals. 135 Revision History 136 OMRON Corporation Industrial Automation Company Authorized Distributor: Tokyo, JAPAN Contact: www.ia.omron.com Regional Headquarters OMRON EUROPE B.V. Wegalaan 67-69-2132 JD Hoofddorp The Netherlands Tel: (31)2356-81-300/Fax: (31)2356-81-388 OMRON ELECTRONICS LLC One Commerce Drive Schaumburg, IL 60173-5302 U.S.A. Tel: (1) 847-843-7900/Fax: (1) 847-843-7787 OMRON ASIA PACIFIC PTE. LTD. No. 438A Alexandra Road # 05-05/08 (Lobby 2), Alexandra Technopark, Singapore 119967 Tel: (65) 6835-3011/Fax: (65) 6835-2711 OMRON (CHINA) CO., LTD. Room 2211, Bank of China Tower, 200 Yin Cheng Zhong Road, PuDong New Area, Shanghai, 200120, China Tel: (86) 21-5037-2222/Fax: (86) 21-5037-2200 © OMRON Corporation 2013 All Rights Reserved. In the interest of product improvement, specifications are subject to change without notice. Cat. No. W381-E1-03 0913
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
advertisement