To download NI software, including the products shown below, visit ni.com/downloads.
Overview
The following example demonstrates two different approaches for generating a fixed tone and a sweep signal.
Description
This example has two options for generation. One of the options creates a waveform that contains a fixed tone at a frequency you specify as well as a tone that sweeps a frequency span that you specify. This setup generates this waveform continuously. The other option for generation is the use the triggered Arbitrary Sequence capabilities of the NI Arbitrary Waveform Generators, to generate the same single tone with a swept tone. In this case, however, the transition of the swept tone from one frequency to the next is handled by a trigger. This trigger can be a software trigger (default) or a hardware trigger that will determine the rate that the second tone sweeps the specified frequency span. Figure 1 shows an image of the front panel.
The bulk of the work of this VI is done by it's two subVIs. The first is named Create Frequency Sweep_w_Tone.vi and the second is named Calculate F1_F2.vi. The first of these two VIs is responsible for deciding how many segments the entire onboard waveform memory should be broken down into based on the number of steps set by the user. This VI then builds the two waveforms and adds them together for each frequency step of the sweep. Figure 2 is an image of the block diagram for this subVI.
The second VI, Calculat F1_F2.vi takes as inputs the samples used per step and the frequencies of the two waveforms for that particular step and calculates the number samples and exact frequencies that need to be passed to the Generate Sine Waveform VI in order to ensure phase continuity for both waveforms when transitioning from step to step. This requires finding the least common multiple of the necessary cycles for each waveform. Figure 3 is an image of the block diagram for the Calculate F1_F2 VI.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.