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
Enter in the physical channel for the Counter Output
Enter Frequency Min which is the minimum frequency that will be set to the Counter Output
Enter Frequency Max which is the maximum frequency that will be set to the Counter Output
Enter Sweep Duration which is the time in seconds to go from Frequency Min, to Frequency Max, and back to Frequency Min
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
**This document has been updated to meet the current required format for the NI Code Exchange. **