Example Programs

Showing results for 
Search instead for 
Did you mean: 

Frequency Sweep Counter Output with DAQmx


This code is an example of how to generate a frequency sweep on a counter output channel. 


This VI will generate a buffer of frequency and duty cycle pairs to output to the coutner output.  Once one cycle has been performed on that frequency duty cycle pair it goes on to the next frequency duty cycle pair.  As the frequency changes, the time to execute each cycle changes.  Because of this the frequency jumps are not linear, meaning if we jumped from 1000Hz to 1002Hz, our next step will not be to 1004Hz because the period for 1000Hz and 1002Hz is not the same.  This code should account for that.

Steps to Implement or Execute Code

  1. Enter in the physical channel for the Counter Output
  2. Enter Frequency Min which is the minimum frequency that will be set to the Counter Output
  3. Enter Frequency Max which is the maximum frequency that will be set to the Counter Output
  4. Enter Sweep Duration which is the time in seconds to go from Frequency Min, to Frequency Max, and back to Frequency Min
  5. Set Duty Cycle to use during the sweep



LabVIEW 2012 or compatible

DAQmx 9.6 or compatible


NI DAQ Hardware with a Counter Output.  Tested with a cDAQ-9188 outputting on PFI0

Additional Information

Frequency Sweep.png

**This document has been updated to meet the current required format for the NI Code Exchange. **

Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.
Checkout and help contribute to the community driven LabVIEW Wiki.