This procedure assumes that the following prerequisite tasks are complete:
  • Connect the master and NI-9145 to the network.
  • Load the Scan Mode personality on the NI-9145.
To create a user-defined variable, complete the following steps. Use the variable to transfer control from the host VI to the FPGA VI and set the FPGA LED in NI-9145.
  1. Create the FPGA target in the LabVIEW Project Explorer.
  2. Right-click the NI-9145 item and select Add User-Defined Variable.
  3. In the Shared Variable Properties dialog box, name this variable Set FPGA LED. 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 shown in the following figure.
  8. Right-click the real-time controller and select Deploy All.
  9. Use one of the following methods to ensure that the Scan Engine is in Configuration Mode.
    • 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 shown in the following figure.
  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-9145.