To download NI software, including the products shown below, visit ni.com/downloads.
This example demonstrates how you can implement a simple low frequency PWM (Pulse-width modulation) output signal using a cRIO/sbRIO in Scan Interface mode.
The FPGA of a cRIO/sbRIO can be used in two different modes:
In LabVIEW FPGA Interface mode, you can use LabVIEW FPGA programming to add more flexibility, customization, and deterministic timing to your applications. The LabVIEW FPGA Interface mode enables you to use the whole power of the FPGA, but you have to create, test, debug and compile your FPGA program which can be challenging if you use FPGA for the first time.
In Scan Interface mode, you do not need to do any LabVIEW FPGA development or program communication between FPGA and Host VIs. You also do not need to wait for VIs to be compiled to the FPGA before deploying and running them. In Scan Interface mode, LabVIEW programs the FPGA on the cRIO/sbRIO target with a pre build FPGA program. More information about the Scan Interface mode are available here:
The Scan Interface mode is not available on all cRIOs/sbRIOs. Not all C-Series modules are supported in the Scan Interface mode. Take a look into this site for the supported cRIOs/sbRIOs and C-Series modules:
Software Support for CompactRIO, CompactDAQ, Single-Board RIO, R Series, FlexRIO, and EtherCAT
The Scan Interface mode provides the ability to run up to two C-Series modules in specialty digital mode. This mode should be preferred for the generation of PWM signals:
How Can I Perform Pulse-Width Modulation Using the Scan Interface?
This example demonstrates a way to create additional PWM signals, if you already use two c-Series in specialty digital mode. The Scan Interface mode limits the update rate of a C-Series module to ~1kHz. The fastest PWM signal which can be generated with this example has a frequency of 500Hz.
This example will only work for low frequencies, for most applications use the speciality digital mode.
If program the FPGA by yourself, you can generate a much faster and more accurate PWM signal.
Steps to Implement or Execute Code
Additional Information or References
**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.