background image

DeviceNet

T

NI-DNET

TM

 User Manual

NI-DNET User Manual

May 2004 Edition

Part Number 370375B-01

Summary of Contents for DeviceNet NI-DNET

Page 1: ...DeviceNet T NI DNET TM User Manual NI DNET User Manual May 2004 Edition Part Number 370375B 01...

Page 2: ...741 31 30 Greece 30 2 10 42 96 427 India 91 80 51190000 Israel 972 0 3 6393737 Italy 39 02 413091 Japan 81 3 5472 2970 Korea 82 02 3451 3400 Malaysia 603 9131 0918 Mexico 001 800 010 0793 Netherlands...

Page 3: ...nstallation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or...

Page 4: ...ge Protocol 1 3 LabVIEW Real Time RT Configuration 1 3 Tools 1 3 NI Spy 1 4 SimpleWho 1 4 NI DNET Objects 1 4 Interface Object 1 5 Explicit Messaging Object 1 5 I O Object 1 6 Example 1 6 Using NI CAN...

Page 5: ...Packet Rate 4 1 Strobed I O 4 2 Polled I O 4 3 Cyclic I O 4 6 Change of State COS I O 4 7 Automatic EPR Feature 4 7 Using I O Data in Your Application 4 8 Accessing I O Members in LabVIEW 4 10 Access...

Page 6: ...ifications B 6 Cable Lengths B 6 Maximum Number of Devices B 6 Cable Termination B 7 Cabling Example B 8 Appendix C Troubleshooting and Common Questions Troubleshooting with the Measurement Automation...

Page 7: ...ardware and the NI DNET software Use this NI DNET User Manual to learn the basics of DeviceNet and how to develop an application program The user manual also contains information on DeviceNet hardware...

Page 8: ...word or value that you must supply monospace Text in this font denotes text or characters that you should enter from the keyboard sections of code programming examples and syntax examples This font is...

Page 9: ...About This Manual National Instruments Corporation xi NI DNET User Manual LabVIEW online reference ODVA website www odva org Microsoft Win32 Software Development Kit SDK online help...

Page 10: ...thin your Windows Programs menu under National Instruments Measurement Automation For information about the NI DNET software within MAX consult the MAX online help A reference is in the MAX Help menu...

Page 11: ...MAX is not configured to search for new devices on startup To search for the new hardware press F5 To verify installation of your DeviceNet hardware right click the DeviceNet card then select Self tes...

Page 12: ...DeviceNet card and use the NI DNET APIs to develop real time applications For example you can control a network of DeviceNet devices as a master and write your control algorithm in LabVIEW When you i...

Page 13: ...his tool is not a complete network management or configuration tool It provides read only information about the DeviceNet devices connected to your National Instruments DeviceNet interface To launch S...

Page 14: ...attributes in remote DeviceNet devices For complete information on each NI DNET object including its driver attributes and supported functions services refer to your NI DNET Programmer Reference Manu...

Page 15: ...pecification This means that you can use polled strobed and COS cyclic I O connections simultaneously for a given device As specified by the DeviceNet Specification only one master slave I O connectio...

Page 16: ...on of sections of the DeviceNet Specification yourself such as custom configuration tools NI CAN uses the same software infrastructure as NI DNET so both APIs can be used with the same CAN card The ge...

Page 17: ...same manner as your original installation CD or ni com download Within the installer select both NI DNET and NI CAN components in the feature tree When you right click a port in MAX and select Propert...

Page 18: ...DeviceNet devices PCMCIA CAN hardware is a 16 bit Type II PC Card that is software configurable and compliant with the PCMCIA standards for 16 bit PC cards With a PCMCIA CAN card you can make your PC...

Page 19: ...ware Hardware in CAN kits is referenced as Series 2 Hardware in DeviceNet kits is referenced as Series 1 Series 2 CAN cards cannot be used with the NI DNET software NI CAN only The features of Series...

Page 20: ...trols and examples NI DNET functions and controls are available in the LabVIEW palettes In LabVIEW 7 1 or later the NI DNET palette is located within the top level NI Measurements palette In earlier L...

Page 21: ...tion for NI DNET it is automatically linked with nidnet lib the link library for LabWindows CVI When NI DNET is installed the installation program checks to see which compatible C compiler you are usi...

Page 22: ...n from C to the C language NI DNET functions The reference for each NI DNET function is provided in the NI DNET Programmer Reference Manual which you can open from Start All Programs National Instrume...

Page 23: ...folder Each example is in a separate folder A c file with the same name as the example contains a description the example in comments at the top of the code Other Programming Languages You can directl...

Page 24: ..._NCFUNC_ PncOpenDnetIO NCTYPE_STRING ObjName NCTYPE_OBJH_P ObjHandlePtr static NCTYPE_STATUS _NCFUNC_ PncCloseObject NCTYPE_OBJH ObjHandle static NCTYPE_STATUS _NCFUNC_ PncReadDnetIO NCTYPE_OBJH ObjH...

Page 25: ...ET0 MyObjh if status 0 printf ncOpenDnetIO failed 4 Free nican dll Before exiting your application you need to free nican dll with the following command FreeLibrary NidnetLib Programming Model for NI...

Page 26: ...ging EM objects required for your application 3 Call ncSetDriverAttr if needed Start communication Your DeviceNet Application Write output data Wait for available input data Read input data Get or Set...

Page 27: ...ntf function with the Opcode parameter set to Start The following optional steps can be done before you start communication For an I O Object if it is not acceptable to send output data of all zeros c...

Page 28: ...3 To set the value of an attribute in a remote DeviceNet device call the ncSetDnetAttribute function 4 To invoke other explicit message services in a remote DeviceNet device use the ncWriteDnetExplMsg...

Page 29: ...les apply to the I O Object and the Explicit Messaging Object As long as all the configuration attributes are the same any object can be opened multiple times You can enable only one notification or w...

Page 30: ...l NI DNET functions wired together are skipped except for ncCloseObject The ncCloseObject function executes regardless of whether an error occurred thus ensuring that all NI DNET objects are closed pr...

Page 31: ...ery NI DNET function If an error is detected you should close all NI DNET handles then exit the application If a warning is detected you can display a message for debugging purposes or simply ignore t...

Page 32: ...I O communication Within your NI DNET application the ncOpenDnetIO function configures the timing for I O connections in which your application communicates as master As you read this section you mig...

Page 33: ...fer data at the rate of this single strobe command message the ExpPacketRate of each strobed I O connection must be set to the same value The common ExpPacketRate for all strobed I O connections shoul...

Page 34: ...ndle I O connections that require similar response rates With scanned I O the master knows that all strobe and poll commands go out at the same time Therefore the master does not need to manage indivi...

Page 35: ...device 30 respond well within 20 ms the common ExpPacketRate would need to be at least 52 ms This situation can often be avoided using a special case of scanned polling called background polling To co...

Page 36: ...ms 35 ms 100 ms and 700 ms respectively Each device responds to its poll command within 1 ms but measures data at a different rate such as a pushbutton for 10 ms and a temperature sensor for 700 ms Yo...

Page 37: ...nnections essentially use the same timing scheme as individually polled I O connections Each cyclic I O connection sends its data at the configured ExpPacketRate The main difference is that cyclic I O...

Page 38: ...thus dramatically impairing overall DeviceNet performance This problem is demonstrated in Figure 4 5 Figure 4 5 Congestion Due to Back to Back COS I O This problem can be prevented if you increase the...

Page 39: ...s the only master in your DeviceNet system The BaudRate parameter of ncOpenDnetIntf determines the time taken for each message The InputLength and OutputLength parameters of each ncOpenDnetIO determin...

Page 40: ...sembly often shown as a table with byte bit offsets and a listing of the attribute in the device that each member represents often shown as class instance and attribute identifiers For standard device...

Page 41: ...o functions to convert between LabVIEW data types and DeviceNet data types ncConvertForDnetWrite and ncConvertFromDnetRead These functions are used to access individual members of an I O assembly usin...

Page 42: ...You can use the front panel control that appears to change Speed Reference 11 Using the NI DNET palette place ncWriteDnetIO into your diagram 12 Wire the DnetData out terminal from the previous Conver...

Page 43: ...teDnetIO objh sizeof OutputAsm OutputAsm For information on NI DNET s C language data types and their equivalent DeviceNet data types refer to Chapter 1 NI DNET Data Types of the NI DNET Programmer Re...

Page 44: ...pass the address of that variable as the Attr parameter of the ncGetDnetAttribute or ncSetDnetAttribute function For LabVIEW the attribute s DeviceNet data type determines the corresponding LabVIEW da...

Page 45: ...any object but its actual data format is defined in the specification for the Identity Object The error codes that can be returned in the service response Error codes that are common to all services c...

Page 46: ...open calls but instead all open calls are combined into a concise loop Object Handles If you use an array to store configuration parameters for ncOpenDnetIO you can use this same scheme to store the...

Page 47: ...together If your application uses different control code for different DeviceNet devices you might want to split your application into multiple tasks You can easily write a multitasking application by...

Page 48: ...ny manufacturers of industrial automation equipment began to consider other applications of CAN technology Automotive and industrial device networks showed many similarities including the transition a...

Page 49: ...ed manual General Object Modeling Concepts The DeviceNet Specification uses object oriented modeling to describe the behavior of different components in a device how those components relate to one ano...

Page 50: ...me contexts it might also refer to a class Each class defines a set of attributes which represent its externally visible characteristics The set of attributes defined by a class is common to all insta...

Page 51: ...use the Reset service on instance one of the Identity Object the device resets to its power on state Another class of object contained in every DeviceNet device is the Connection Object Each instance...

Page 52: ...et To facilitate access to your DeviceNet network the features provided by the NI DNET driver are a simplification of the objects and services defined in the DeviceNet Specification Explicit Messaging...

Page 53: ...f the instance ID is one or greater the service is directed to a specific instance within the class Service Data Data bytes specific to the Service Code The number and format of these data bytes is de...

Page 54: ...tion path for the exchange of physical input output sensor actuator data as well as other control oriented data I O connections are useful for transferring data at regular intervals Since many DeviceN...

Page 55: ...ch supports polled I O connections Polled I O is typically used for devices which provide both input and output data such as position controllers and modular I O devices Figure A 3 shows an example of...

Page 56: ...ve s strobe response contains from 0 to 8 bytes of input data Figure A 4 shows an example of four strobed slave devices Figure A 4 Strobed I O Example Change of State and Cyclic I O The change of stat...

Page 57: ...d COS I O can be configured to send output data from master to slave Although master to slave COS output is seldom used it can be useful for things like front panel pushbuttons which are sent to a sla...

Page 58: ...oing data to its proper location within the device Output assemblies receive an output message from an I O connection and distribute its contents to multiple attributes within the slave Input assembli...

Page 59: ...a single input assembly consisting of a single byte Figure A 7 shows an example of a Presence Sensing instance and its input assembly Figure A 7 Input Assembly for Photoeye or Limit Switch Attributes...

Page 60: ...the same behavior Use the same object model certain instances are required Contain the same input and output assemblies Contain the same set of configurable attributes In addition to required feature...

Page 61: ...minal connector The PCMCIA CAN bus powered cable also has a DB 9 D SUB connector The 5 pin Combicon style pluggable screw terminal follows the pinout required by the DeviceNet Specification Figure B 1...

Page 62: ...terminal are connected directly to the corresponding pins on the 9 pin D SUB following the pinout in Figure B 3 Figure B 2 PCMCIA CAN Bus Powered Cable The 9 pin D SUB follows the pinout recommended b...

Page 63: ...own in Table B 1 You should take these requirements into account when determining the requirements of the bus power supply for the system For the PCI CAN a jumper controls the source of power for the...

Page 64: ...t interface is being used in a system where bus power is not available the jumper may be set in the INT position In this position the physical layer is powered by the host computer or internally The p...

Page 65: ...position for the DeviceNet interface to be compliant with the DeviceNet Specification Connecting pins 2 and 3 of a jumper configures the PXI 8461 physical layer to be powered internally from the boar...

Page 66: ...led cable length requirements can be found in the DeviceNet Specification Table B 2 lists the DeviceNet cable length specifications Maximum Number of Devices The maximum number of devices that you can...

Page 67: ...e a termination resistor If multiple devices are placed along the cable only the devices on the ends of the cable should have termination resistors Refer to Figure B 7 for an example of where terminat...

Page 68: ...xample of a cable to connect two DeviceNet devices Figure B 8 Cabling Example 9 Pin D Sub 9 Pin D Sub CAN_H CAN_L GND V V V V 5 Pin Combicon 5 Pin Combicon Pin 7 Pin 4 Pin 7 Pin 4 Pin 2 Pin 2 Pin 5 Pi...

Page 69: ...can test your CAN cards by choosing Tools NI CAN Test all Local NI CAN Cards from the menu or you can right click on an CAN card and choose Self Test If the Self Test fails refer to the Troubleshooti...

Page 70: ...efer to the documentation for your Windows operating system for instructions on how to use the Device Manager to reserve memory resources for legacy boards After the conflict has been resolved run the...

Page 71: ...any CAN cards can I configure for use with my NI DNET software The NI DNET software can be configured to communicate with up to 32 CAN cards on all supported operating systems Which CAN hardware for D...

Page 72: ...To do so right click the PCMCIA CAN card in MAX and choose Properties Assign resource values that do not conflict with other device resources for either the Interrupt Request IRQ or the Memory Range I...

Page 73: ...mbicon style pluggable DeviceNet screw terminal high speed CAN only Operating environment Ambient temperature 0 to 55 C Relative humidity 10 to 90 noncondensing Storage environment Ambient temperature...

Page 74: ...ent Ambient temperature 0 to 55 C Relative humidity 10 to 90 noncondensing Storage environment Ambient temperature 20 to 70 C Relative humidity 5 to 95 noncondensing Tested in accordance with IEC 6006...

Page 75: ...UL 3111 1 UL 61010B 1 CAN CSA C22 2 No 1010 1 Note For UL and other safety certifications refer to the product label or visit ni com hardref nsf search by model number or product line and click the a...

Page 76: ...ng as follows Low Voltage Directive safety 73 23 EEC Electromagnetic Compatibility Directive EMC 89 336 EEC Note Refer to the Declaration of Conformity DoC for this product for any additional regulato...

Page 77: ...Exchange at ni com exchange National Instruments Application Engineers make sure every question receives an answer Training and Certification Visit ni com training for self paced training eLearning v...

Page 78: ...tute Application Programming Interface API A collection of functions used by a user application to access hardware Within NI DNET you use API functions to make calls into the NI DNET driver ASCII Amer...

Page 79: ...e in the data is detected class A classification of things with similar qualities client In explicit messaging connections the client is the device requesting execution of the service common services...

Page 80: ...e same type direct entry Microsoft Win 32 functions used to directly access the functions of a Dynamic Link Library DLL DLL Dynamic Link Library driver attributes Attributes of the NI DNET driver soft...

Page 81: ...ate instance A specific instance of a given class For example a blue square of 4 inches per side would be one instance of the class Squares ISO International Standards Organization K KB Kilobytes of m...

Page 82: ...utility Utility used to manage configuration of DeviceNet devices network who A search of a DeviceNet network to determine information about its devices NI DNET driver Device driver and or firmware t...

Page 83: ...of the device network not on the same host as the NI DNET driver resource Hardware settings used by National Instruments DeviceNet hardware including an interrupt request level IRQ and an 8 KB physic...

Page 84: ...erformed on an instance to affect its behavior the externally visible code of an object Within NI DNET you use NI DNET functions to execute services for objects Also known as method and operation stro...

Page 85: ...sed in the manual x conventions related documentation x D diagnostic tools NI resources E 1 documentation conventions x how to use manual set ix NI resources E 1 related conventions x drivers NI resou...

Page 86: ...racteristics D 3 programming examples NI resources E 1 PXI 8461 parts locator diagram figure B 5 port characteristics D 3 R related documentation x S safety specifications D 3 self test failures troub...

Reviews: