1、Nl-lndustrial Communications for EtherCAT2023-03-01Nl-lndustrial Communications for EtherCATContentsNl-lndustrial Communications for EtherCAT Help.5Overview.6Troubleshooting.7Getting Started with Nl-lndustrial Communications for EtherCAT.9Step 1:Building the Hardware Network.9Step 2:Installing the S
2、oftware.10Step 3:Adding a Real-Time Controller to the LabVIEW Project.10Step 4:Adding an EtherCAT Master and Slaves to the LabVIEW Project.11Step 5:Using the I/O Variables in a VI.12Configuring a Real-Time Controller in MAX.14Installing the Software on a Real-Time Controller.14Configuring the Ethern
3、et Adapter.15Nl-lndustrial Communications for EtherCAT Environment.18LabVIEW Project Items.18LabVIEW Project Item Menus.20EtherCAT Master Properties Dialog Box.21General Property Page.22EtherCAT:Basic Property Page.22EtherCAT:Advanced:Distributed Clock Property Page.23EtherCAT Slave Device Propertie
4、s Dialog Box.24General Property Page.24EtherCAT:Basic Property Page.25EtherCAT:Advanced:Mailbox Property Page.26EtherCAT:Advanced:Watchdog Property Page.26EtherCAT:Advanced:Distributed Clock Property Page.26EtherCAT:Advanced:lnitial Commands Property Page.28Third-Party EtherCAT Module Properties Dia
5、log Box.29General Property Page.29C Series Module Properties Dialog Box.30I/O Variable Properties Dialog Box.30Online Master State Dialog Box.30Online Device State Dialog Box.31EtherCAT:Online:State Page.32/Nl-lndustrial Communications for EtherCATEtherCAT:Para meters Page.32Configuring an Nl-lndust
6、rial Communications for EtherCAT Network.34Cable Redundancy.34Hardware Setup.35Using Cable Redundancy Mode.35Adding,Editing,or Removing EtherCAT Masters.36Adding,Editing,or Removing an EtherCAT Slave Device.37Adding,Editing,or Removing an EtherCAT Module.39Discovering EtherCAT Devices Programmatical
7、ly.41Changing the Scan Period.41Deploying or Undeploying an EtherCAT Configuration.42Uploading an EtherCAT Configuration.42Comparing the EtherCAT Configurations.42Accessing a Parameter.44Monitoring Device States.44Enabling the Device Monitor.44Reading the Total Number and States of Devices.45Sending
8、 and Receiving Raw Data.46Enabling Raw Data Mode.48Downloading the EtherCAT Slave Device Firmware.48Import Device Profile Dialog Box.50EtherCAT Reference and Procedures.53Reading and Writing EtherCAT Master/Slave Properties at Run Time.53Adding an EtherCAT Master/Slave Reference to an RT VI.53Master
9、 Properties.54Master Methods.55Slave Properties.61Slave Methods.63Reading and Writing a C Series Module Property at Run Time.75Adding a C Series Module Reference to an RT VI.76Developing an EtherCAT Application in Scan Mode.77Using the I/O Variable.77Using EtherCAT Reference and Procedures.77Monitor
10、ing I/O in Nl Distributed System Manager.77 National InstrumentsNl-lndustrial Communications for EtherCATProgramming the FPGA on the Nl 9145.78Introduction to Nl 9145 FPGA Concepts.78Scan Mode.78FPGA Mode.79NI 9145 FPGA I/O.79Nl 9145 Timing Diagram.81User-Defined Variable.82Creating and Discovering
11、the FPGA Target and Module.83Creating,Discovering,and Deploying a User-Defined I/O Variable.84Compiling,Downloading,and Running an FPGA VI.86Removing an FPGA VI from the Nl 9145.87Optimizing an FPGA Application.88Configuring the Third-Party Master for the Nl 9145 in FPGA Mode.88Nl-lndustrial Communi
12、cations for EtherCAT and the Nl Scan Engine.90EtherCAT Slave Device State Transition.91Nl Scan Engine Mode Transition.92Remote I/O.94REM-11180 I/O Variables.95Remote I/O Vis.95Close Slave.96Configure Module.96Diagnose.123Open Slave.124Read Module Config.124Scale.1434 Nl-lndustrial Communications for
13、 EtherCATMarch 2020,372626R-01This help file explains how to install,configure,and use Nl-lndustrial Communications for EtherCAT to control EtherCAT networks.National InstrumentsNl-lndustrial Communications for EtherCATOverviewEtherCATEthernet Control Automation Technology(EtherCAT)is a high-perform
14、ance industrial communication protocol for deterministic Ethernet.EtherCAT extends the IEEE 802.3 Ethernet standard to transfer data with predictable timing and precise synchronization.This open standard has been published as part of the IEC 61158 specification and is commonly used in applications s
15、uch as machine design and motion control.EtherCAT implements a master/slave architecture over standard Ethernet cabling,as shown in the following figure.National Instruments EtherCAT masters consist of real-time controllers with dual Ethernet adapters,such as CompactRIO and PXI.Each Nl slave device
16、also contains two adapters that permit daisy-chaining from the master controller.Nl-lndustrial Communications for EtherCATThe Nl-lndustrial Communications for EtherCAT software contains two parts:The EtherCAT master driver that supports the real-time EtherCAT network operation.Configuration tools in
17、tegrated with LabVIEW Real-Time that configure the EtherCAT network and map the EtherCAT device signals to the LabVIEW I/O variable.6 Nl-lndustrial Communications for EtherCATTroubeshootingWhy does an EtherCAT I/O variable return an error?A possible cause is that the related slave device or module m
18、ay be disconnected.Complete the following steps to find the error description:1.In LabVIEW,select HelpExplain Error to display the Explain Error dialog box.2.Enter the I/O variable error code to display the error description.Why does an EtherCAT I/O variable still return an error even when I reconne
19、ct a disconnected slave device or module?You can enable a reconnected slave device and module in one of the following ways.Click Clear Error on the EtherCAT:Online State page of the Online Slave Device State dialog box.If you are using the distributed clock,and the reference clock device is the devi
20、ce that has been reconnected,simply clearing the error is not sufficient.To properly restore synchronization across your network with a distributed clock,you need to switch the Nl Scan Engine to Configuration mode first and then switch to Active mode.Clearthe device error through the Nl Scan Engine
21、mode change.Follow these steps to change the mode manually:1.In the LabVIEW project explorer,right-click the target item and select UtilitiesScan Engine ModeSwitch to Configuration.2.Right-click the target item and select UtilitiesScan Engine ModeSwitch to Active.You also can change the mode program
22、matically with the Set Scan Engine Mode VI in the Measurement l/ONI Scan Engine palette.National InstrumentsNl-lndustrial Communications for EtherCATWhat is the relationship between the Nl Scan Engine mode,EtherCAT master state,and EtherCAT slave device state?How can I change their states?Refer to N
23、l-lndustrial Communications for EtherCAT and the Nl Scan Engine for information on the relationship between the Nl Scan Engine mode and the EtherCAT state.Refer to EtherCAT Slave Device State Transition for information on how to change an EtherCAT slave device state.Refer to Nl Scan Engine Mode Tran
24、sition for information on how to change the Nl Scan Engine mode.Why cannot I install EtherCAT on the PXI real-time target?Configure the LabVIEW Real-Time Target in MAX.8 Nl-lndustrial Communications for EtherCATGetting Started with Nl-lndustria Communications for EtherCATThis tutorial provides an ov
25、erview explaining how to get started with Nl-lndustrial Communications for EtherCAT.Complete the following steps to use Nl-lndustrial Communications for EtherCAT.Step 1:Building the Hardware NetworkStep 2:Installing the SoftwareStep 3:Adding a Real-Time ControllerStep 4:Adding ar EtherCAT MasterStep
26、 5:Using the I/O Variables in a VIStep 1:Building the Hardware NetworkBuild the EtherCAT network by connecting the following hardware items:HostA desktop or laptop running Windows and LabVIEW.You use the host to configure the real-time controller and EtherCAT slave devices.Real-time controllerAn Nl-
27、lndustrial Communications for EtherCAT-supported controller.Refer to the Nl-lndustrial Communications for EtherCAT Readme for a list of supported hardware.The controller has the following Ethernet adapters.Adapter 1 is for communication between the host and controller through TCP/IP.Adapter 2 is exc
28、lusively for EtherCAT communication between the EtherCAT master and EtherCAT slave devices.Adapter 2 is referred to as the EtherCAT adapter.EtherCAT slave deviceEtherCAT slave devices from National Instruments and other vendors.The following figure shows a typical EtherCAT network that you can build
29、.National InstrumentsNl-lndustrial Communications for EtherCATHost ComputerNext:Step 2:Installing the SoftwareStep 2:Installingthe SoftwareComplete the following steps to install the software on the host and the controller.1.Install the prerequisite software,including the Nl-lndustrial Communication
30、s for EtherCAT software,on the host.Refer to the Nl-lndustrial Communications for EtherCAT Readme for the software requirements.2.Install the Nl-lndustrial Communications for EtherCAT software on a real-time controller.3.Configure the Ethernet adapter.Next:Step 3:Adding a Real-Time ControllerStep 3:
31、Adding a Real-Time Controller to the LabVIEW ProjectAfter preparing the hardware and software,complete the following steps to add an Nl real-time controller to a LabVIEW project.1.Launch LabVIEW.Create a LabVIEW project and save the project.10 Nl-lndustrial Communications for EtherCAT2.In the LabVIE
32、W Project Explorer,right-click the Project root item and select NewTargets and Devices to display the Add Targets and Devices dialog box.3.In the Add Target and Devices dialog box that appears,add the controller to the LabVIEW project.If the controller is online,select Existing target or device and
33、expand the related controller category to select the controller.Note If a controller does not appear under the category,make sure that you connect the controller to the host computer.If the controller is offline,select New target or device to add the controller.4.Click OK to exit.Next:Step 4:Adding
34、an EtherCAT MasterStep 4:Adding an EtherCAT Master and Slaves to the LabVIEW ProjectComplete the following steps to add an EtherCAT master to the LabVIEW project.1.Right-click the controller item and select Connect to connect the controller.2.Right-click the controller item in the LabVIEW Project Ex
35、plorerand select NewTargets and Devices to display the Add Targets and Devices dialog box.3.Expand the EtherCAT Master Device category to view the available EtherCAT Ethernet adapters.Note If an adapter is not available,make sure that you have conf igured the Ethernet adapter f or EtherCAT.4.Select
36、the EtherCAT Ethernet adapter and click OK to display the master and slaves.National InstrumentsNl-lndustrial Communications for EtherCATNote If you cannot see the slave items in the project tree,ensure that the EtherCAT slave devices are connected to the EtherCAT adapter of the real-time controller
37、.EtherCAT MasterOne real-time controller usually has one master using the special Ethernet adapter for the EtherCAT network.EtherCAT Slave DeviceAn EtherCAT slave device from Nl or a third-party vendor.EtherCAT ModuleAn EtherCAT slave device may contain one or more modules.Modules accessible from an
38、 RT VI appear directly underthe slave item,and I/O channels appear as I/O Variables underthe module items.Modules accessible from an FPGA VI appear directly underthe F PG A target item,and I/O channels appear as FPGA I/O items underthe FPGA target item.I/O VariableThe physical channels of the slave
39、device and module maps to the I/O variables.A slave device or module can have several I/O variables.FPGA TargetYou must add an FPGA target to the LabVIEW project before creating FPGA Vis and using the Nl 9145 in FPGA mode.User-Defined VariableUser-defined variables transfer FPGA-processed data betwe
40、en an FPGA VI and an RT VI.Note The Nl 9145 is the only EtherCAT slave that has FPGA support in LabVIEW.Ref er to Nl-lndustrial Communications f or EtherCAT Readme f or more inf ormation about the sof tw are requirements.Next:Step 5:Using the I/O Variables in a VIStep 5:Usingthe I/O Variables in a V
41、IComplete the following steps to create an application in the LabVIEW project using the EtherCAT signals.上 Nl-lndustrial Communications for EtherCAT1.Right-click the controller item and select NewVI to create a VI.Save the VI.2.Drag the I/O variable under the EtherCAT items and drop the variable on
42、the block diagram of the VI.3.Wire a control or indicator to the I/O variable.4.Run the VI.After completing these steps,you can use a VI to access the EtherCAT network.National InstrumentsNl-lndustrial Communications for EtherCATConfiguring a Real-Time Controller in MAXIn Nl Measurement&Automation E
43、xplorer(MAX),complete the following steps to install the software on an Nl real-time controller.Note Bef ore you install the sof tw are on a realtime controller,you must install the prerequisite sof tw are,including the Nl-lndustrial Communications f or EtherCAT sof tw are.Ref er to the Nl-lndustria
44、l Communications f or EtherCAT Readme f or inf ormation about sof tw are requirements,installation instructions,and a list of supported hardw are.1.Install the Nl-lndustrial Communications for EtherCAT software on the realtime controller.2.Configure an Ethernet adapter for EtherCAT.Installing the So
45、ftware on a Real-Time ControllerComplete the following steps to install the Nl-lndustrial Communications for EtherCAT software on an Nl real-time controller.Note If you use a PXI controller,f ollow the instructions to install the sof tw are on the PXI controller.1.Launch Nl Measurement&Automation Ex
46、plorer(MAX)from the Start menu or(Windows 8)from Nl Launcher.2.Double-click Remote Systems in the configuration tree to discover the realtime controller.Note MAX discovers all devices in the netw ork,w hich takes a f ew seconds.If you cannot f ind the real-time controller af ter MAX displays all dev
47、ices,selectRemote Systems and press to ref resh the list.If this does not w ork,make sure that you connect the real-time controller to the 14 Nl-lndustrial Communications for EtherCATnetw ork w ith required sof tw are installed or contact National Instruments.3.Locate and expand the real-time contro
48、ller,right-click Software,and select Add/Remove Software from the shortcut menu to launch the LabVIEW Real-Time Software Wizard.Choose one of the following ways to install the software.Recommended Software SetThis option enables you to install the Nl recommended software set to the real-time control
49、ler.Select the recommended software set and click the Next button.Select Nl-lndustrial Communications for EtherCAT x,where x is the version number.Custom software installationThis option enables you to customize the installation.Select the software that you want to install,including Nl-lndustrial Co
50、mmunications for EtherCAT x,where x is the version number.Click the Next button.Installingthe Software on a PXI ControllerComplete the following steps to install the software on a PXI controller.1.Power off the PXI chassis.2.Remove the Ethernet PXI board from the PXI chassis.Power on the chassis.3.I