Creating, Discovering, and Deploying a User-Defined I/O Variable

NI-Industrial Communications for EtherCAT® 17.6 Help

Edition Date: November 2017

Part Number: 372626P-01

»View Product Info
Download Help (Windows Only)

Complete the following steps to create a user-defined variable and use the variable to transfer control from the host VI to the FPGA VI and set the FPGA LED in NI 9144/9145.

Note Note  The following steps assume you have a master and the NI 9144/9145 connected to the network and the Scan Mode personality is loaded on the NI 9144/9145.
  1. Create the FPGA target in the Project Explorer.
  2. Right-click the NI 9144/9145 item and select Add User-Defined Variable.
  3. In the Shared Variable Properties dialog box, name this variable Set FPGA LED and ensure that the data type of the variable matches the FPGA I/O that the variable maps to. In this example, select Boolean.
  4. Set the Direction as Host to FPGA and click OK. LabVIEW creates a User-Defined Variables container and adds this user-defined variable under the container.
  5. Right-click the real-time controller and select New»VI. Rename this VI My Host VI.
  6. Drag and drop the Set FPGA LED variable from the Project Explorer on the block diagram.
  7. Wire a Boolean control to Set FPGA LED as the following figure shows.
  8. Right-click the real-time controller and select Deploy All.
  9. Ensure the Scan Engine is in Configuration Mode. To check this, right-click the real-time controller from the Project Explorer and select Utilities»View in System Manager. You can also use the NI Distributed System Manager. Select the real-time target in the left tree, and in the Scan Engine tab, ensure Scan Engine Mode»Configuration is green. If the color is not green, click the Change to Configuration button.
  10. Right-click the FPGA target and select New»VI. Rename this VI My FPGA VI.
  11. Drag and drop the FPGA LED from Project Explorer»FPGA Target»Chassis I/O on the block diagram.
  12. Drag and drop the Set FPGA LED variable from the Project Explorer on the block diagram. Wire its data out to FPGA LED as the following figure shows.
  13. Click the Run button. LabVIEW automatically compiles, downloads, and runs the FPGA VI on the FPGA target.
  14. Right-click the real-time controller and select Utilities»Scan Engine Mode»Switch to Active.
  15. Double-click My Host VI.vi in the Project Explorer.
  16. Click the Run button.
  17. Click the LED control in the front panel. Then the application starts to control the FPGA LED in the NI 9144/9145.

WAS THIS ARTICLE HELPFUL?

Not Helpful