Summary of the content on the page No. 1
T
DeviceNet
TM
NI-DNET User Manual
NI-DNET User Manual
May 2004 Edition
Part Number 370375B-01
Summary of the content on the page No. 2
Support Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100 Worldwide Offices Australia 1800 300 800, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599, Canada (Calgary) 403 274 9391, Canada (Ottawa) 613 233 5949, Canada (Québec) 450 510 3055, Canada (Toronto) 905 785 0085, Canada (Vancouver) 514 685 7530, China 86 21 6555 7838, Czech Repub
Summary of the content on the page No. 3
Important Information Warranty The CAN/DeviceNet hardware is warranted against defects in materials and workmanship for a period of one year from the date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace equipment that proves to be defective during the warranty period. This warranty includes parts and labor. The media on which you receive National Instruments software are warranted not to fail to execute programming in
Summary of the content on the page No. 4
Contents About This Manual How to Use the Manual Set ...........................................................................................ix Conventions ...................................................................................................................x Related Documentation..................................................................................................x Chapter 1 NI-DNET Software Overview Installation and Configuration ....................................
Summary of the content on the page No. 5
Contents Programming Model for NI-DNET Applications ......................................................... 3-6 Step 1. Open Objects....................................................................................... 3-8 Step 2. Start Communication .......................................................................... 3-8 Step 3. Run Your DeviceNet Application....................................................... 3-8 Addition of Slave Connections after Communication Start .............
Summary of the content on the page No. 6
Contents Appendix B Cabling Requirements Connector Pinouts..........................................................................................................B-1 Power Supply Information for the DeviceNet Ports......................................................B-3 Cable Specifications ......................................................................................................B-6 Cable Lengths .....................................................................................
Summary of the content on the page No. 7
About This Manual This manual describes the basics of DeviceNet and explains how to develop an application program, including reference to examples. The user manual also contains hardware information. How to Use the Manual Set Installation Guide (CD Sleeve) Software and Hardware Installation First-Time Experienced NI-DNET Users NI-DNET Users NI-DNET NI-DNET Application Programmer User Manual Development Reference Manual and Examples Function and Object Descriptions Use the installation guide t
Summary of the content on the page No. 8
About This Manual Conventions The following conventions appear in this manual: » The » symbol leads you through nested menu items and dialog box options to a final action. The sequence File»Page Setup»Options directs you to open the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a note, which alerts you to important information. bold Bold text denotes items that you must select or click on in the software, such as menu items and dialog b
Summary of the content on the page No. 9
About This Manual LabVIEW online reference ODVA website, www.odva.org Microsoft Win32 Software Development Kit (SDK) online help © National Instruments Corporation xi NI-DNET User Manual
Summary of the content on the page No. 10
1 NI-DNET Software Overview The DeviceNet software provided with National Instruments DeviceNet hardware is called NI-DNET. This section provides an overview of the NI-DNET software. Installation and Configuration Measurement & Automation Explorer (MAX) Measurement & Automation Explorer (MAX) provides access to all of your National Instruments products. Like other NI software products, NI-DNET uses MAX as the centralized location for all configuration and tools. To launch MAX, select the Me
Summary of the content on the page No. 11
Chapter 1 NI-DNET Software Overview Figure 1-1. NI-DNET Cards Listed in MAX Note Each card’s name uses the word CAN, because the Controller Area Network is the communication protocol upon which DeviceNet is built. If your NI DeviceNet hardware is not listed here, MAX is not configured to search for new devices on startup. To search for the new hardware, press . To verify installation of your DeviceNet hardware, right-click the DeviceNet card, then select Self-test. If the self-test pass
Summary of the content on the page No. 12
Chapter 1 NI-DNET Software Overview Configure DeviceNet Port The physical port of each DeviceNet card is listed under the card’s name. To configure software properties, right-click the port and select Properties. In the Properties dialog, you assign an interface name to the port, such as DNET0 or DNET1. The interface name identifies the physical port within NI-DNET APIs. Change Protocol To change the default protocol for the DeviceNet (CAN) card, right-click the card and select Protocol. In
Summary of the content on the page No. 13
Chapter 1 NI-DNET Software Overview NI-Spy This tool monitors function calls to the NI-DNET APIs. This tool helps in debugging programming problems in your application. To launch this tool, open the Software branch of the MAX Configuration tree, right-click NI Spy, and select Launch NI Spy. SimpleWho To provide valid parameters for the NI-DNET open functions (ncOpenDnetIntf, ncOpenDnetExplMsg, and ncDnetOpenIO), you need to determine some basic information about your DeviceNet devices. Thi
Summary of the content on the page No. 14
Chapter 1 NI-DNET Software Overview Much like any other object-oriented system, NI-DNET device driver objects use the concepts of class, instance, attribute, and service to describe their features. The NI-DNET device driver software provides three classes of objects: Interface Objects, Explicit Messaging Objects, and I/O Objects. You can open an instance of an NI-DNET object using one of the three open functions (ncOpenDnetExplMsg, ncOpenDnetIntf, or ncOpenDnetIO). The services for an NI-D
Summary of the content on the page No. 15
Chapter 1 NI-DNET Software Overview Execute the DeviceNet Set Attribute Single service on the remote device (ncSetDnetAttribute) Send any other explicit message request to the remote device and receive the associated explicit message response (ncWriteDnetExplMsg, ncReadDnetExplMsg) Configure NI-DNET settings that apply to the entire remote device I/O Object The I/O Object represents an I/O connection to a remote DeviceNet device (physical device attached to your interface by a DeviceNe
Summary of the content on the page No. 16
Chapter 1 NI-DNET Software Overview Access to device at Access to device at MAC ID 5 MAC ID 8 I/O Object I/O Object Explicit Messaging I/O Object Device MAC ID = 5 Device MAC ID = 5 Object Device MAC ID = 8 Connection Type = COS Connection Type = Poll Device MAC ID = 8 Connection Type = Strobe Your National Instruments DeviceNet Interface Interface Object Interface MAC ID = 1 Baud Rate = 500K Figure 1-2. NI-DNET Objects for a Network of Three Devices Using NI-CAN with NI-DNET Controller Area Ne
Summary of the content on the page No. 17
Chapter 1 NI-DNET Software Overview NI-DNET (default), or CAN for NI-CAN. When the CAN protocol is selected, you can access CAN tools in MAX, such as the Bus Monitor tool that displays CAN messages in their raw form. In order to develop NI-CAN applications, you must install NI-CAN components such as documentation and examples. The NI-CAN software components are available within the NI-DNET installer. Launch the setup.exe program for the NI-DNET installer in the same manner as your original
Summary of the content on the page No. 18
2 NI-DNET Hardware Overview Types of Hardware The National Instruments DeviceNet hardware includes the PCI-CAN, PXI-8461, and PCMCIA-CAN. The PCI-CAN is software configurable and compliant with the PCI Local Bus Specification. It features the National Instruments MITE bus interface chip that connects the card to the PCI I/O bus. With a PCI-CAN, you can make your PC-compatible computer with PCI Local Bus slots communicate with and control DeviceNet devices. The PXI-8461 is software configura
Summary of the content on the page No. 19
Chapter 2 NI-DNET Hardware Overview For more information on the DeviceNet physical layer and cables used to connect to your DeviceNet devices, refer to Appendix B, Cabling Requirements. For connection to the network, the PCI-CAN, PXI-8461, and PCMCIA-CAN for DeviceNet provide combicon-style pluggable screw terminals, as required by the DeviceNet Specification. Differences Between CAN Kits and DeviceNet Kits National Instruments provides hardware/software kits for both CAN and DeviceNet. Sin
Summary of the content on the page No. 20
3 Developing Your Application This chapter explains how to develop an application using the NI-DNET functions. Accessing NI-DNET from your Programming Environment Applications can access the NI-DNET driver software by using either ™ ™ LabVIEW, LabWindows /CVI , Microsoft Visual C/C++, Borland C/C++, or Visual Basic. If you are using any other development environment, you must access the DNET library directly. Each of these language interface techniques is summarized below. LabVIEW For appl