The Examples directory is installed in C:\Users\Public\Documents\National Instruments\FPGA Interface C API\Examples\ and contains the following subdirectories:

  • Platforms
  • Arrays
  • FIFOs
  • IRQs

Additionally, if LabWindows/CVI support is selected during installation, the FPGA Interface C API installer installs examples in C:\Users\Public\Documents\National Instruments\CVI\samples\FPGA Interface C API\.

The manufacturer recommends that you make a copy of any example files before modifying them. If you inadvertently modify installed files and want to revert changes, delete the modified files. Then use Add or Remove Programs to repair the FPGA Interface C API software installation.

The Platforms Subdirectory

The Platforms subdirectory contains LabVIEW source code and versions of a C/C++ application created for certain supported operating systems and compilers. Each subdirectory under Platforms contains example source code and project files specific to the minimum compatible version of the given compiler. For example, the files in \Examples\Platforms\Windows\CVI\9.0\ work with LabWindows/CVI 9.0 or later.

The C/C++ application is written in Example.cpp or Example.c, depending on the compiler. The application tests the temperature of the FPGA device, then waits while toggling either the FPGA LED (on a CompactRIO device) or Connector0/DO0 (on an R Series device).

Complete the following steps to prepare an example for use:

  1. Launch Example.lvproj.
  2. In the LabVIEW Project Explorer window, add your FPGA target to the project.
  3. If the Select Programming Mode dialog box appears, select LabVIEW FPGA Interface and click Continue.
  4. The example project is populated with RIO devices containing FPGA targets. Expand one of the FPGA targets to find the example FPGA VI that works with your target.
    Note If you are using an R Series device, expand the PCI or PXI FPGA target. If you are using CompactRIO or Single-Board RIO, expand the CompactRIO FPGA target. The FPGA VI may require some modification to work with your target.
  5. Drag the example FPGA VI to your FPGA target.
  6. Open the FPGA VI to check for errors. You can resolve most errors by adding new FPGA I/O items to your project. In the LabVIEW Project Explorer window, right-click the FPGA target item and select New»FPGA I/O. On the New FPGA I/O dialog box that appears, select all available I/O resources, then click OK.
    Note The example application does not work without modification on NI 781x devices. The application reads the board temperature, and NI 781x devices do not support temperature reading. To use the example on these devices, you must remove the temperature-reading code.
  7. Right-click the FPGA VI and select Create Build Specification from the shortcut menu. Under Build Specifications, right-click the new build specification for the example FPGA VI, select Build, and wait for the build to complete.
    Note For versions of LabVIEW earlier than 2010, right-click the example FPGA VI, select Compile, and wait for the compilation to complete.
  8. Right-click the example FPGA VI and select Launch C API Generator.
  9. In the FPGA Interface C API Generator dialog box that appears, change the Output Directory to the appropriate subdirectory. You can find the subdirectory that is appropriate for your operating system and compiler under Platforms.
  10. Click Generate to generate the C API.
  11. In the output directory that you selected in Step 9 above, find the associated project file and open it.
    • For LabWindows/CVI, the project file is a .cws file.
    • For Microsoft Visual C++, the project file is a .sln file.
    • For Linux Real-Time and Wind River Workbench, you must import the entire directory using File»Import»Existing Project into Workspace.
    • For Linux, you must transfer the entire directory to your Linux development computer.
Note For NI Linux Real-Time targets, refer to the Fixing Build Problems in NI Linux Real-Time Applications section.

The Arrays, FIFOs, and IRQs Subdirectories

The Arrays, FIFOs, and IRQs subdirectories contain example source code and generated header files. They provide examples of how to write code using the Array, FIFO, and IRQ functions, but they are not ready to run.