Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: NI News
NI Supported: Yes
Publish Date: Apr 27, 2012


Feedback


Yes No

Related Links - Developer Zone

Related Links - Products and Services

Customizing C/C++ Designs with an NI FPGA

3 ratings | 4.33 out of 5
Read in | Print | PDF

Field-programmable gate arrays (FPGAs) create the perfect custom hardware sandbox for today’s increasingly complex applications. For instance, when monitoring current and voltage waveforms to monitor and correct power factors, developers must synchronize the sampling of both current and voltage needs, and time it such that an exact integer number of samples are taken within each sinusoidal waveform. Because the frequency of power delivered on the grid slowly fluctuates, it is a challenge to ensure that the samples for a given measurement are also synchronized and the frequency is adjusted to the changing input signal.

For developers who use a non-FPGA-based data acquisition device, the ideal method to achieve the desired sampling characteristics involves oversampling the input signals at a very fast rate. Then postprocessing the data to pull out the samples that best result in an exact number of samples in a given waveform. Developers who use a data acquisition device built on an FPGA can customize the device’s behavior to dynamically adjust an acquisition sampling rate to scale with the signal input frequency, which ensures an exact number of points are clocked per waveform cycle on the fly. This reduces the amount of data needed to acquire and analyze, without sacrificing the quality of the power measurement.

For most C programmers, using an FPGA with the existing devices requires advanced knowledge of VHDL or other hardware description languages that are outside their expertise. National Instruments has created FPGA-based reconfigurable I/O (RIO) devices programmed with NI LabVIEW rather than VHDL. NI released a C interface to these LabVIEW FPGA targets that makes it easier for C/C++ developers to add RIO custom functionality to their host applications.


[+] Enlarge Image

Figure 1. C/C++ developers can now easily interface to NI FPGA-based hardware using the new C Interface to LabVIEW FPGA.

The new C Interface to LabVIEW FPGA opens NI FPGA-based hardware, such as NI CompactRIO, NI FlexRIO, and R Series data acquisition (DAQ), to host applications based on LabVIEW and C/C++. This programming interface helps C/C++ developers take advantage of LabVIEW FPGA and NI reconfigurable I/O (RIO) hardware for embedded control and acquisition. With the new C Interface to LabVIEW FPGA, developers can use LabVIEW graphical tools to program the FPGA within NI hardware and choose either LabVIEW or C/C++ tools to program the processor within the system. This new LabVIEW FPGA feature gives engineers and scientists with C expertise the ability to use FPGAs within their designs without the burden of learning hardware design while also giving them the option to reuse their host C code.

The LabVIEW FPGA Module simplifies FPGA programming by offering an intuitive development environment that abstracts away the hardware description language code and opens FPGA programming to all engineers regardless of their hardware design experience. The graphical dataflow approach in the LabVIEW FPGA Module makes it ideal for depicting the inherent parallelism of processes running in FPGAs. Additionally, developers can accelerate their LabVIEW FPGA application development with more than 200 prebuilt FPGA intellectual property (IP) blocks in the LabVIEW FPGA Module, in some LabVIEW toolkits, and on ni.com. The pioneer FPGA Interface C API is on NI Labs, the National Instruments virtual research lab.

NI Labs showcases the latest evolving technologies from the National Instruments R&D department. The virtual research lab offers the chance to download and work with cutting-edge developments and provide product feedback. Graduates of the NI Labs program include the LabVIEW Adaptive Filter Toolkit and the Fixed-Point Math Library for LabVIEW FPGA. Each NI Labs technology is bundled into a self-contained installer with documentation and examples. The technology’s specific R&D team resolves technical questions and issues for particular downloads.

Developers can use the new C Interface to LabVIEW FPGA to program the real-time processor on NI FPGA-based hardware using C tools such as NI LabWindows™/CVI, Microsoft Visual Studio, or Wind River Workbench and interface to the LabVIEW FPGA code running on the FPGA. Choosing an appropriate C development tool and compiler solution is dependent on the final deployment hardware target and the associated operating system. Developers also can choose to program the processor using the LabVIEW Real-Time Module, which includes tools for low-level system debugging, precision execution timing, and multithreaded symmetric multiprocessing (SMP) for increased flexibility and functionality in deterministic real-time applications.

Figure 2. The C Interface to LabVIEW FPGA works with a wide range of NI and third-party C/C++ toolchains, depending on the hardware architecture and operating system implemented in the final design.

The pioneer release of the FPGA Interface C API includes nearly all the same functionality as the LabVIEW host FPGA interface, including the ability to read and write FPGA front panel controls, target-to-host and host-to-target DMA streaming, and IRQ assertion and acknowledgement. NI R&D will continue to develop and support this feature through NI Labs and deliver incremental updates with additional functionality over time until the feature is integrated into versions of LabVIEW FPGA software and drivers that are being shipped.

Download, evaluate, and discuss the new pioneer C Interface to LabVIEW FPGA from NI Labs.

The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries.

3 ratings | 4.33 out of 5
Read in | Print | PDF

Reader Comments | Submit a comment »

sounds cool... I'll have to try it out
Nice capability if it works out... I'll have to give it a spin.
- May 19, 2009

 

Legal
This material is protected under the copyright laws of the U.S. and other countries and any uses not in conformity with the copyright laws are prohibited, including but not limited to reproduction, DOWNLOADING, duplication, adaptation and transmission or broadcast by any media, devices or processes.