Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

generate a continuous signal variing in frequency and amplitude

I am using measurement studio 8.0 with Visual Studio, writing C++.
I would like to output a continuous analog signal through a PCI6733 card.
The amplitude and frequency of this signal have to be refreshed approximately
every 100ms according to values given by a simulation.

I think the more relevant example from measurement studio is the one called
"ConGenVoltageWfm_IntClkDlg" in the example files provided. This example
works nicely on its own, with my cards.

What i am trying to do is to refresh it without interrupting the signal already being sent.
To do so, i am calling the following bit of C++ code every time I want to update the
frequency and amplitude:

           CFunctionGenerator fGen(m_task->Timing,
           m_desiredFrequency,
           m_samplesPerBuffer,
           m_cyclesPerBuffer,
           m_waveformType,
           m_amplitude);

            CNiDAQmxAnalogSingleChannelWriter writer(m_task->Stream);
            writer.WriteMultiSample(false, fGen.Data);

The thing that happens is that the amplitude refreshes with a big lag time
(a few seconds) whereas the frequency is updating correctly every 100ms.
Moreover, this seems to take a lot of CPU power. This CPU consumption is
not appearing in the task manager surprisingly, but my dialog  obviously struggle
to be moved. Maybe you have some ideas ?

I may be using a wrong technique ! It's more than likely actually 🙂 Thanks very
much for your advices !

Regards,
Laurent
0 Kudos
Message 1 of 2
(2,965 Views)
Hi,
This post is duplicated in the following discussion.  Please navigate to the link below.
 
"Hi Radium,
 
I have seen this kind of problem before with the high processor usage.  When you run the code can you run it without the debugger?
This may actually help the CPU usage.
The code looks fine and I can't really see anything too wrong with it.
 
Have you tried looking at the examples that are installed with DAQmx support?
~\National Instruments\NI-DAQ\Examples??
 
These may have some good starting points for your code.
 
I'll keep looking
 
AdamB"
Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 2 of 2
(2,915 Views)