Example Code

Generate PWM signals on cRIO analog output module

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW FPGA Module
  • LabVIEW Real-Time Module
  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This example shows how you can use the "Square Wave Generator" express VI to generate PWM signals with an analog output module on CompactRIO.

 

Description

This example shows how to use two instances of "Square Wave Generator" express VI to generate two PWM analog output signals with the following parameters: Frequency, Phase Offset, Amplitude, Offset, Duty Cycle.

All parameters can be canged in host VI Front Panel that can be used in Real-Time debugging mode or on windows targets. Parameters in host VI can be entered in Hz (Frequency), Periods (Phase Offset, Duty Cycle) and Volts (Amplitude, Offset). By using the "Normalize Signal Generation Parameters" VI, all parameters are converted and scaled to datatypes required by the FPGA functions.


Requirements

 Software

  • LabVIEW Full or Professional Development System 2012 (or compatible)
  • LabVIEW Real-Time Module 2012 (or compatible)
  • LabVIEW FPGA Module 2012 (or compatible)

 Hardware

  • FPGA and Real-Time target (e.g. cRIO 9074 or compatible)
  • Analog output module (e.g. NI 9264 or compatible)

 

Steps to Implement or Execute Code

  1. Download and open the attached file "FPGA PWM Generator LV2012 NIVerified.zip"
  2. Follow the instructions in Real-Time and FPGA Front Panel and Block Diagram and run the program

 

Additional Information or References

Real-Time VI:

FPGA PWM Generator RT Host LV2012 NIVerified.vi - Front Panel.png

 

FPGA PWM Generator RT Host LV2012 NIVerified.vi - Block Diagram.png

 

FPGA VI:

Square Wave FPGA LV2012 NIVerified.vi - Front Panel.png

 

Square Wave FPGA LV2012 NIVerified.vi - Block Diagram.png

 

**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.

Comments
Russia_
Trusted Enthusiast
Trusted Enthusiast
on

Good day, unfortunately, after the launch Square Wave FPGA.vi of an error 1.jpg