Examples

FPGA Interface C API Help

Edition Date: August 2014

Part Number: 372928H-01

»View Product Info
Download Help (Windows Only)

The FPGA Interface C API installer installs examples at the following location:

OS File Path
Windows 8/7/Vista/Server 2008 R2 C:\Users\Public\Documents\National Instruments\FPGA Interface C API\Examples\
Windows XP/Server 2003 C:\Documents and Settings\All Users\Documents\National Instruments\FPGA Interface C API\Examples\

If you select LabWindows/CVI support at install time, the FPGA Interface C API installer installs examples at the following location:

OS File Path
Windows 8/7/Vista/Server 2008 R2 C:\Users\Public\Documents\National Instruments\CVI\samples\FPGA Interface C API\
Windows XP/Server 2003 C:\Documents and Settings\All Users\Documents\National Instruments\CVI\samples\FPGA Interface C API\

The Examples directory contains the following subdirectories:

  • Platforms
  • Arrays
  • FIFOs
  • IRQs

NI 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 and 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 at \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.
  5. Note 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.
  6. Drag the example FPGA VI to your FPGA target.
  7. 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.
  8. Note 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.
  9. 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.
  10. Note Note  For versions of LabVIEW earlier than 2010, right-click the example FPGA VI, select Compile, and wait for the compilation to complete.
  11. Right-click the example FPGA VI and select Launch C API Generator.
  12. In the FPGA Interface C API Generator dialog box that appears, change the Output Directory to the appropriate subdirectory, under Platforms, for your target operating system and compiler.
  13. Click Generate to generate the C API.
  14. In the output directory 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 NI 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 Note  For NI Linux Real-Time targets, refer to the Fixing Build Problems in NI Linux Real-Time Applications topic.

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.

WAS THIS ARTICLE HELPFUL?

Not Helpful