Examples
- Updated2025-12-04
- 3 minute(s) read
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:
- Launch Example.lvproj.
- In the LabVIEW Project Explorer window, add your FPGA target to the project.
- If the Select Programming Mode dialog box appears, select LabVIEW FPGA Interface and click Continue.
- 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.
- Drag the example FPGA VI to your FPGA target.
- 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 . 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.
- 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.
- Right-click the example FPGA VI and select Launch C API Generator.
- 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.
- Click Generate to generate the C API.
- 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 .
- For Linux, you must transfer the entire directory to your Linux development computer.
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.