Fixed-Point C Code (Digital Filter Design Toolkit)
In the Designing a Fixed-Point Filter tutorial, you learned the basics of designing a fixed-point filter using the LabVIEW Digital Filter Design Toolkit. After you design a fixed-point filter, you can generate fixed-point C code and implement the fixed-point filter on a supported execution target, such as a 32-bit microprocessor.
|Note If you did not complete the Designing a Fixed-Point Filter tutorial, refer to labview\examples\Digital Filter Design\Getting Started\Tutorials\Designing a Fixed-Point Filter\Designing a Fixed-Point Filter Part 6.vi for a completed version of the digital filter from that tutorial.|
Generating Fixed-Point C Code
Complete the following steps to generate fixed-point C code from a fixed-point filter by using the DFD FXP Code Generator VI.
- Place the DFD FXP Code Generator VI on the block diagram.
- Wire the filter out and error out outputs of the DFD FXP Modeling VI to the filter in and error in inputs of the DFD FXP Code Generator VI.
- Click the polymorphic VI selector of the DFD FXP Code Generator VI and select C Code from the pull-down menu.
- Right-click the destination folder input of this VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents the destination folder in which this VI generates the code.
- Right-click the filter name input of this VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents the filter name that this VI uses for the code generation.
The block diagram now resembles the following figure.
- Display the front panel window and click the Browse button on the destination folder control to select the folder in which this VI generates the code.
- Click the filter name control and enter the name for the generated code.
- Click the Run button to run the VI.
- Select File»Save As and save this VI as Generating C Code.vi in an easily accessible location
|Note Refer to labview\examples\Digital Filter Design\Getting Started\Tutorials\Generating Code\Generating C Code.vi for a completed version of the digital filter from this part of the tutorial.|
Implementing Fixed-Point C Code on 32-bit Microprocessors
After you generate C code from the fixed-point filter model, you can compile the C code to run on 32-bit microprocessors.
The following figure shows example code the DFD FXP Code Generator VI generates.
You can include this code in any C development platform. You also can include this code in the following LabVIEW add-ons that generate C code.
- LabVIEW Embedded Module for Blackfin Processors
- LabVIEW Embedded Module for ARM Microcontrollers
- LabVIEW Microprocessor SDK
- LabVIEW Mobile Module
- LabVIEW Touch Panel Module
|Note Refer to the National Instruments Web site for information about these products.|