National InstrumentsメーカーNI-DNETの使用説明書/サービス説明書
ページ先へ移動 of 86
DeviceNet T NI-DNET TM User Manual NI-DNET User Manual May 2004 Edition Part Number 3703 75B-01.
Support Worldwide Technical Support and Product Info rmation ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Aust in, Texas 78759-3504 USA Tel: 512 683 0100 Worldwide O.
Important Information Warranty The CAN/DeviceNet hardware is warranted agai nst de fects in materials and wor kmanship fo r a period of one year from t he date of shipmen t, as evidenced by receipts or other document ation.
© National Instruments Cor poration v NI-DNET User Manual Contents About This Manual How to Use the Manual Set ............. ............ .............. ........... .............. ........... ............ .... ix Conventions ............ ........... .
Contents NI-DNET User Manual vi ni.com Programming Model for NI-DNET Appli cations ... ....................... ........... ........... ......... 3-6 Step 1. Open Objects ................ ........... .............. ............ ........... ............
Contents © National Instruments Corpor ation vii NI-DNET User Manual Appendix B Cabling Requirements Connector Pinouts .............. ........... ............ .............. ........... ........... ............... ........... ....... B-1 Power Supply Infor mation for th e DeviceNet Ports .
© National Instruments Corpor ation ix NI-DNET User Manual About This Manual This manual describes the basics of De viceNet and e xplains ho w to dev elop an application program, includ ing reference to examples. The user manual also contains hardware information.
About This Manual NI-DNET User Manual x ni.com Conventions The following con v entions appear in this manual: » The » symbol leads you through nested menu items and dial og box options to a final action.
About This Manual © National Instruments Corpor ation xi NI-DNET User Manual • LabVIEW online reference • OD V A website, www.odva.org • Microsoft W in32 Software Dev elopment Kit (SDK) onlin e.
© National Instruments Corpor ation 1-1 NI-DNET User Manual 1 NI-DNET Software Over view The DeviceNet software provided w ith National Inst ruments DeviceNet hardware is called NI-DNET.
Chapter 1 NI-DNET Software Over view NI-DNET User Manual 1-2 ni.com Figure 1-1. NI-DNET Cards List ed in MAX Note Each card’ s name uses the word CAN, b ecause the Controller Area Network is the communication protocol upon which DeviceNet is b uilt.
Chapter 1 NI-DNET Software Overview © National Instruments Corpor ation 1-3 NI-DNET User Manual 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 .
Chapter 1 NI-DNET Software Over view NI-DNET User Manual 1-4 ni.com NI-Spy This tool monitors f unction calls to the NI-DNET AP Is. This tool helps in debugging program ming problems in your application. To launch this tool, open the Software bran ch of the MAX Configuration tree, right- click NI Spy , and select Launch NI Spy .
Chapter 1 NI-DNET Software Overview © National Instruments Corpor ation 1-5 NI-DNET User Manual Much like any other object-oriented system, NI-DNET device dri ver objects use the concepts of class, instan ce, attribute, and service to describe their features.
Chapter 1 NI-DNET Software Over view NI-DNET User Manual 1-6 ni.com • Execute the De viceNet Set Attrib ute Single service on the remote device ( ncSetDnet Attribute ) • Send any other explicit me.
Chapter 1 NI-DNET Software Overview © National Instruments Corpor ation 1-7 NI-DNET User Manual Figure 1-2. NI-DNET Objec ts for a Netw ork of Three De vices Using NI-CAN with NI-DNET Controller Area Network (CAN) is the low-level protocol used for DeviceNet communications.
Chapter 1 NI-DNET Software Over view NI-DNET User Manual 1-8 ni.com NI-DNET (default), or CAN fo r NI-CAN. When the CAN protocol is selected, you can access CAN tools in M AX, such as the Bus Monitor tool that displays CAN messa ges in their ra w form.
© National Instruments Corpor ation 2-1 NI-DNET User Manual 2 NI-DNET Hardware Over view T ypes of Hardware The National Instrument s DeviceNet hardware includes the PCI-CAN, PXI-8461, and PCMCIA-CAN. The PCI-CAN is software conf igurable and compliant with the PCI Local Bus Specification.
Chapter 2 NI-DNET Hardware O verview NI-DNET User Manual 2-2 ni.com For more information on the DeviceNet physical layer and cables used to connect to your DeviceNet de vices, refer to Appendix B, Cabling Requirements .
© National Instruments Corpor ation 3-1 NI-DNET User Manual 3 Developing Y our Application This chapter explains how to develop an application using the NI-DNET functions.
Chapter 3 Developing Y our Application NI-DNET User Manual 3-2 ni.com LabWindows/CVI Within LabWindows/CVI, the N I-DNET function panel is located in Library»NI-DNET . Like o ther LabWindows/CVI functio n panels, the NI-DNET function panel provides help for each function and the ability to generate code.
Chapter 3 Developing Y our Application © National Instruments Corpor ation 3-3 NI-DNET User Manual Microsoft C/C++ The NI-DNET software supports Microsoft Visual C/ C++ version 6. The header file and library for V isual C/C++ 6 are in the MS Visual C folder of the NI-DNET folder .
Chapter 3 Developing Y our Application NI-DNET User Manual 3-4 ni.com For C applications (f iles with .c extension), include the header file b y adding a #include to the beginning of your code, like th is: #include "nidnet.h" For C++ applications (f iles with .
Chapter 3 Developing Y our Application © National Instruments Corpor ation 3-5 NI-DNET User Manual 2. Get the addresses for th e NI-DNET DLL functions y ou will use. Y our ap plication must use the Win32 GetProcAddress funct ion to get the addresses of the NI-DNET functions your appli cation needs.
Chapter 3 Developing Y our Application NI-DNET User Manual 3-6 ni.com 3. Configure your application to de -reference the pointer to call an NI-DNET function, as illustrat ed by the follo wing code.
Chapter 3 Developing Y our Application © National Instruments Corpor ation 3-7 NI-DNET User Manual Figure 3-1. General Programming Steps fo r an NI-DNET Application 1. Open Interface object 2. Open all I/O and Explicit Messaging (EM) objects required for your application 3.
Chapter 3 Developing Y our Application NI-DNET User Manual 3-8 ni.com Step 1. Open Objects Before you use an NI-DNET object in yo ur application, you must configure and open it using either ncOpenDnetIntf , ncOpenDnetExplMsg , or ncOpenDnetIO . These open functions return a handle for use in all subsequent NI-DNET ca lls for that object.
Chapter 3 Developing Y our Application © National Instruments Corpor ation 3-9 NI-DNET User Manual 2. Call the ncWaitForState function with the DesiredState parameter set to Read Available . This function waits for output data to be transmitted and for new input data to be recei ved.
Chapter 3 Developing Y our Application NI-DNET User Manual 3-10 ni.com Step 4. Stop Communication Before you exit your applicati on, stop communication to shut down DeviceNet connections to remote de vices. Use the Interface Object to call the ncOperateDnetIntf function with the Opcode parameter set to Stop .
Chapter 3 Developing Y our Application © National Instruments Corpor ation 3-11 NI-DNET User Manual If you use two dif ferent applications on the same interface and open I/O connections to different de vices, you mu st set PollMode to either Scanned or Individual .
Chapter 3 Developing Y our Application NI-DNET User Manual 3-12 ni.com Y our ap plication code shoul d check the status returned from every NI-DNET function.
© National Instruments Corpor ation 4-1 NI-DNET User Manual 4 NI-DNET Programming T echniques This chapter describes various techniques to help yo u program your NI-DNET application. The techni ques include configuratio n of I/O connection timing, using I/O data (assemblies), using explicit messaging, and handling multiple devices.
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-2 ni.com When you select an ExpPacketRate for an I/O connection, you must consider all I/O connections in your system.
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-3 NI-DNET User Manual Polled I/O Polled I/O connecti ons use a separate poll command and response message for each device. The ov erall scheme th at NI-DNET uses to time polled I/O conn ections is determined by the PollMode parameter of ncOpenDnetIntf .
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-4 ni.com • If you set the PollMode parameter of ncOpenDnetIntf to Scanned , to configure scanned I/O you must specify the exact same ExpPacketRate when you open each of your strobed/polled I/O connections.
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-5 NI-DNET User Manual background polling maintains overall network consistency because NI-DNET ev enly disperses all backgro und poll commands among multiple foreground cycles.
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-6 ni.com Since the poll commands are no t synchronized for individual polling, they can often be scattered relatively randomly . They can be ev enly interspersed for a while, then suddenly occur in bursts of back-to-back messages.
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-7 NI-DNET User Manual Change-of-State (COS) I/O Change-of-State I/O connections use the sam e timing scheme as cyclic I/O connections, but in addition to the ExpPacketRate , COS I/O sends data to the master whenever a change is detec t ed.
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-8 ni.com For strobed and polled I/O connect ions, determination o f a valid ExpPacketRate can be some wh at complex. If you hav e tro uble estimating an ExpPacketRate value for strobed/polled I/O, set the PollMode parameter of your initial call to ncOpenDnetIntf to Automatic .
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-9 NI-DNET User Manual • Some de vice vendors provide commen ts about I/O assemblies in an Electronic Data Sheet (EDS). The EDS file is a text f ile whose format is defined b y the DeviceNet Specif ication.
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-10 ni.com By consulting the specifications for the Control Supervisor object and the A C/DC Drive ob ject, you can determine that the DeviceNet data type for Run Fwd and Fault Reset is BOOL (boolean), and the DeviceNet data type for Speed Reference is INT (16-bit signed integer).
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-11 NI-DNET User Manual 4. Right-click on the ByteOffset terminal and select Create Consta nt , then enter 0 as the byte of fset. 5. Right-click on the 8[TF] in terminal and select Create Control .
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-12 ni.com 2. Initialize the array to all zero. for (I = 0; I < 4; I++) OutputAsm [I] = 0; 3. Assume you hav e two boolean variables, RunFwd and ResetFault , of type NCTYPE_BOOL . For LabW indows/CVI, these v ariables could be accessed from front pan el buttons.
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-13 NI-DNET User Manual easiest way to execute the Set Attri bute Single service on a remote device is to use the NI-DNET ncSetDnetAttribute function.
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-14 ni.com Specification defines the ov erall format of these services, in most cases their meaning and service data are ob ject-specif ic or vendor -specific. Unless your device requires such services and documents them in detail, you probably do not need them fo r your application.
Chapter 4 NI-DNET Programming T echniques © National Instruments Corpor ation 4-15 NI-DNET User Manual For the C programming language, you can declare a struct ure typedef to store the parameters of .
Chapter 4 NI-DNET Programming T echniques NI-DNET User Manual 4-16 ni.com Main Loop If your application essentially accesse s all DeviceNet input/outpu t data as a single image, you would normally wai.
© National Instruments Corporation A-1 NI-D NET User Manual A DeviceNet Over view This appendix giv es an overvie w of DeviceNet. Histor y of DeviceNet The Controller Area Network (CAN) was de veloped in the early 1980s by Bosch, a leading automotiv e equi pment supplier .
Appendix A DeviceNet Overview NI-DNET User Manual A- 2 ni.com Physical Characteristics of DeviceNet The following list summarizes the physical characteristics of De viceN et.
Appendix A DeviceNet Overview © National Instruments Corporation A-3 NI-D NET User Manual Figure A-1. Classe s of Geometric Shapes All squares belong to the same class because the y all have similar qualities, such as four equal sides. The term in stance refers to a specif ic instance of a gi ven class.
Appendix A DeviceNet Overview NI-DNET User Manual A- 4 ni.com Figure A-2. Object Modeling Used in DeviceNet Specification Every De viceNet device contains at l east one instance (instance o ne) of the Identity Object.
Appendix A DeviceNet Overview © National Instruments Corporation A-5 NI-D NET User Manual In Figure A- 2, the term A pplication Object(s) refers to ob jects within th e device which are used to perform its fundamental behavior .
Appendix A DeviceNet Overview NI-DNET User Manual A- 6 ni.com The following tables describe the general format of DeviceNet e x plicit message requests and responses as th ey appear on the DeviceNet netw ork. The DeviceNet Specification defines a set of services supported in a common way by dif ferent devices.
Appendix A DeviceNet Overview © National Instruments Corporation A-7 NI-D NET User Manual The Get Attribute Single service obtain s the v alue of a specific attrib ute within a device’ s object, and the Set Attrib ute Single service sets the value of an attrib ute.
Appendix A DeviceNet Overview NI-DNET User Manual A- 8 ni.com The DeviceNet Specification def ines four ty pes of master/slav e I/O conn ections: polled, bit strobed, change-of-state (COS), and c yclic.
Appendix A DeviceNet Overview © National Instruments Corporation A-9 NI-D NET User Manual slav e. This strobe command (request ) message is recei ved b y all slav e devices simultaneously and can be used to trigger simu ltaneous measurements (such as to take multiple photoelectric readings simultaneously).
Appendix A DeviceNet Overview NI-DNET User Manual A-10 ni.com The cyclic I/O connection enables a slav e device to send input data to its master at the configured EPR interv al. Y ou normal ly configure the EPR to be consistent with the rate at which the device measures its physical input sensors.
Appendix A DeviceNet Overview © National Instruments Corpor ation A-11 NI-DNET User Manual Figure A-5 shows an e xample of four COS/cyclic I/O connections. Figure A-5. COS/Cyclic I/O Example Assembly Objects One of the more important objects in th e DeviceNet Specification is the Assembly Object.
Appendix A DeviceNet Overview NI-DNET User Manual A-12 ni.com Figure A-6. Input and Output Assemblies As a more specif ic example, consider a De viceNet phot oelectric sensor (photoeye) or a limit switch. These de vic es contain a single instance of a class called the Presence Sensing object.
Appendix A DeviceNet Overview © National Instruments Corpor ation A-13 NI-DNET User Manual As you can see, to use the data bytes contained in I/O messag es, it is important to know the format of a device’ s internal input and outp ut assemblies.
© National Instruments Corporation B-1 NI-D NET User Manual B Cabling Requirements This appendix describes the cabling requirements for the hardware. Cables should be constructed to meet these requirements as well as the requirements of DeviceNet. De viceNet cabling requirem ents can be found in the DeviceNet Specification .
Appendix B Cab ling Requirements NI-DNET User Manual B- 2 ni.com Figure B-2 sho ws the end of a PCMCIA-CAN b us-powered cable. The arrow points to pin 1 of the 5-pin scre w terminal block.
Appendix B Cabling Requirements © National Instruments Corporation B-3 NI-D NET User Manual Power Supply Information for the DeviceNet Ports The bus must supply po wer to each De viceNet port. The bus po wer supply should be a DC power supply with an output of 10 V to 30 V .
Appendix B Cab ling Requirements NI-DNET User Manual B- 4 ni.com The PCI-CAN is shipped with this jumper set in the EXT position. In this position, the physical layer is powered from the b us (the V+ and V– pins on the Combicon connector).
Appendix B Cabling Requirements © National Instruments Corporation B-5 NI-D NET User Manual Figure B-6. PXI-8461 Parts Locator Diagram Connecting pins 1 and 2 of a jumper configures the PXI-8461 physical layer to be powered e xt ernally (from the bus cable power).
Appendix B Cab ling Requirements NI-DNET User Manual B- 6 ni.com Cable Specifications Cables should meet the requirem ents of the DeviceNet cable specification. DeviceNet cabling requirements can be found in the DeviceNet Specification . Belden cable (3084A) meets all of those requirements and should be suitable for most applicat ions.
Appendix B Cabling Requirements © National Instruments Corporation B-7 NI-D NET User Manual Cable T ermination The pair of signal wires (CAN_H and CAN_L) constitutes a transmission line. If the transmission line is not terminated, each signal change on the line causes reflections that ma y cause communication failures.
Appendix B Cab ling Requirements NI-DNET User Manual B- 8 ni.com Cabling Example Figure B-8 shows an example of a cable to connect two D e viceNet devices.
© National Instruments Corporation C-1 NI-D NET User Manual C T roubleshooting and Common Questions This appendix describes how to troubleshoot pro blems with the NI-DNET software and answers some common questions.
Appendix C T roubleshooting and Common Questions NI-DNET User Manual C- 2 ni.com T roubleshooting Self T est Failures The following topics explain common error messages generated by the Self T est in MAX. Application In Use This error occurs if you are running an applicat ion that is using the CAN card.
Appendix C T roubleshooting and Common Questions © National Instruments Corporation C-3 NI-D NET User Manual If the error continues af ter restart, uninstall NI-CAN (and NI-DNET) and then reinstall. NI-CAN Hardware Pr oblem Encountered This error occurs if the Self T est de tects a defect in the CAN hardware.
Appendix C T roubleshooting and Common Questions NI-DNET User Manual C- 4 ni.com Can I use multip le PCMCIA cards in one computer? Y es, b u t make sure there are enough free resources a vailable . Unlike PCI or PXI CAN cards, PCMCIA CAN cards cannot share resources, such as IRQs, with other devices.
© National Instruments Corporation D-1 NI-DNET User Manual D Hardware Specifications This appendix describes the physical characteristics of the De viceNet hardware, along with the reco mmen ded operatin g conditions. PCI-CAN Series Dimensions.......
Appendix D Hardware Specifications NI-DNET User Manual D-2 ni.com Storage environment Ambient temperature ...................... . –20 to 70 °C Relative humidity ........ .............. ......5 to 90%, noncondensing PXI-CAN Series Dimensions ......
Appendix D Hardw are Specifications © National Instruments Corporation D-3 N I-DNET User Manual Port Characteristics Bus power ... ......................... .................. 0 to 30 V, 40 mA typical, 100 mA maxim um CAN-H, CAN-L ........... .......
Appendix D Hardware Specifications NI-DNET User Manual D-4 ni.com CE Compliance This product meets the essential re quirements of applicable European Directi ves, as amended for CE marking, as follo ws: Low-Voltage Directive (safety) ..............73/23/EEC Electromagnetic Comp atibility Directive (EMC) .
© National Instruments Corpor ation E-1 NI-DNET User Manual E T echnical Support and Professional Ser vices Visit the following sections of the National Instruments Web site at ni.com for technical support an d professional services: • Support —Online technical support resources at ni.
© National Instruments Corporation G-1 N I-DNET User Manual Glossar y Symbol Pref ix V alue m milli 10 –3 k kilo 10 3 A A amperes A C alternating current actuator A device that uses electrical, m echanical, or other signals to change the v alue of an external, real-w orld varia b le.
Glossary NI-DNET User Manual G-2 ni.com B bB i t s background polling A polled I/O communication scheme i n which all polled slaves are grouped into two dif ferent communicatio n rates: a foreground rate and a slower background rate.
Glossary © National Instruments Corporation G-3 N I-DNET User Manual D DC direct current device A physical assembly , linked to a communicatio n line (cable), capable of communicating across the network acco rding to a protocol specification. device netw o rk Multi-drop digital comm unication network for sensors, actuators, and controllers.
Glossary NI-DNET User Manual G-4 ni.com H hex Hexadecimal Hz Hertz I I/O connection Connection used for exchange of physical input/output (sensor/activ ator) data, as well as other control-orien ted data. in. inches indi vidual polling A polled I/O communica tion scheme in which each polled sla ve communicates at its o wn indi vidual rate.
Glossary © National Instruments Corporation G-5 N I-DNET User Manual master/slav e DeviceNet communication scheme in which a master device allocates connections to one or more slave de vices, and those slave de vices can only communicate with the master and not one another .
Glossary NI-DNET User Manual G-6 ni.com P PC personal computer peer-to-peer Devic eN et communication sche me in which each device communicates as a peer and connections are estab lished among devices as needed.
Glossary © National Instruments Corporation G-7 N I-DNET User Manual service An action performed on an instance to affect its beha vi or; the externally visible code of an object. W ithin NI-DNET , you use NI-DNET functions to ex ecu te services for objects.
© National Instruments Corpor ation I-1 NI-DNET User Manual Index C CE compliance, D-4 change protocol, 1-3 common questi o ns, C-3 and troubleshooting, C-1 components left after NI -CAN software uni.
Index NI-DNET User Manual I-2 ni.com L LabVIEW Real-T ime (R T) software configuration, 1-3 tools, 1-3 M MAX NI-DNET cards listed in MAX (figure), 1-2 tools launched from, 1-3 Measurement & Automation Explorer (MAX).
デバイスNational Instruments NI-DNETの購入後に(又は購入する前であっても)重要なポイントは、説明書をよく読むことです。その単純な理由はいくつかあります:
National Instruments NI-DNETをまだ購入していないなら、この製品の基本情報を理解する良い機会です。まずは上にある説明書の最初のページをご覧ください。そこにはNational Instruments NI-DNETの技術情報の概要が記載されているはずです。デバイスがあなたのニーズを満たすかどうかは、ここで確認しましょう。National Instruments NI-DNETの取扱説明書の次のページをよく読むことにより、製品の全機能やその取り扱いに関する情報を知ることができます。National Instruments NI-DNETで得られた情報は、きっとあなたの購入の決断を手助けしてくれることでしょう。
National Instruments NI-DNETを既にお持ちだが、まだ読んでいない場合は、上記の理由によりそれを行うべきです。そうすることにより機能を適切に使用しているか、又はNational Instruments NI-DNETの不適切な取り扱いによりその寿命を短くする危険を犯していないかどうかを知ることができます。
ですが、ユーザガイドが果たす重要な役割の一つは、National Instruments NI-DNETに関する問題の解決を支援することです。そこにはほとんどの場合、トラブルシューティング、すなわちNational Instruments NI-DNETデバイスで最もよく起こりうる故障・不良とそれらの対処法についてのアドバイスを見つけることができるはずです。たとえ問題を解決できなかった場合でも、説明書にはカスタマー・サービスセンター又は最寄りのサービスセンターへの問い合わせ先等、次の対処法についての指示があるはずです。