Communicate Between FPGA, Real-Time Processor, and Distributed Systems

Updated Jan 4, 2024

Environment

Hardware

  • CompactRIO Controller

Software

  • LabVIEW
  • LabVIEW Real-Time Module
  • LabVIEW FPGA Module

Driver

  • NI CompactRIO

Operating System

  • Windows

This tutorial shows you how to transfer data acquired on the FPGA to the real-time processor and then share it across a network. You can scale connectivity to the host computer to other hardware devices or PCs on the network.

  1. If you don't already have LabVIEW installed, download LabVIEW and use it in evaluation mode. 
  2. Download the sample code  and unzip the contents. The zip file contains four tutorials.
  3. Open the Intertarget Communication folder. Open Real-Time & FPGA Evaluation-Intertarget Communication.lvproj. This is where your entire system’s code and hardware resources are managed. A user interface that runs on your development computer has been created for you.
  4. In the LabVIEW Project, expand the Chassis project item. The CompactRIO is in LabVIEW FPGA Interface mode where modules are accessed through a LabVIEW FPGA program.
 
  1. Double-click to open the FPGA.vi. On the front panel you see only a few controls and indicators. These values are made available to the real-time application, which will be discussed later in this tutorial.
  1. Press <Ctrl-E> to open the block diagram. This is a simple FPGA application that sets loop timing in the first sequence and acquires two channels of temperature data in the second sequence.
  1. Open RT.vi from the Project Explorer Window. Open the block diagram. Note the following code that communicates with the FPGA application.
    1. Open a reference to the FPGA VI.
    2. Run the code from the FPGA VI.
    3. Read from and write to the controls and indicators on the FPGA VI.
    4. Close the reference to the FPGA VI. 

 

In the lower priority loop, the Network Comms and Network Stop network published shared variables have been added to communicate with the Windows user interface VI.

  1. Open Windows UI.vi. This is a simple user interface VI to receive periodic updates from the real-time code running on the CompactRIO target. You also can use network published shared variables to periodically update other distributed targets on the network. You can view temperature updates as well as stop the embedded application.