Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate the same waveforms many times?

Hello!
We use the NI PCI-6731 board as voltage generator.
The goal is to generate finite waveform signal every time when trigger occurs.
These waveforms remain the same from trigger to trigger.
A simple way is to create and configure task, channel and so on for every trigger.
But is it possible to use the only task to serve many trigger events without creating a new one?
And what I have to do for it?
Please, help - I'm a newbie in NI boards Smiley Happy
0 Kudos
Message 1 of 7
(3,235 Views)
"Hello!
We use the NI PCI-6731 board as voltage generator.
The goal is to generate finite waveform signal every time when trigger occurs.
These waveforms remain the same from trigger to trigger.
A simple way is to create and configure task, channel and so on for every trigger.
But is it possible to use the only task to serve many trigger events without creating a new one?
And what I have to do for it?
Please, help - I'm a newbie in NI boards "
 
In a nutshell, a new task is required for every trigger condition or different channel but not for every trigger..Once you start the task, it will trigger the voltage out everytime that trigger condition has been met.
To make the coding/files easier, you can create one task and pass in arguments to that task to select your different requirements.
Therfore one task can do it all.
 
 
i.e. this is an audio in sample
 
#define DAQmxErrChk(functionCall) {DAQmxError = (functionCall);  {if (DAQmxError < 0){goto Error;}}}
int32 CreateDAQTaskAI(TaskHandle *taskOut1,char *AiPort, int numscans, double rate, double Hv, double Lv)
{
 int32 DAQmxError = DAQmxSuccess;
    TaskHandle taskOut;
 DAQmxErrChk(DAQmxCreateTask("DAQTaskAI", &taskOut));
 DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, AiPort, "",
  DAQmx_Val_Diff, (float64)Lv, (float64)Hv, DAQmx_Val_Volts, "")); 
 DAQmxErrChk(DAQmxCfgSampClkTiming (taskOut,"",(float64)rate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,(uInt64)numscans));
    *taskOut1 = taskOut;
Error:
 return DAQmxError;
}
 
 
 
- Make Software User Friendly -
0 Kudos
Message 2 of 7
(3,213 Views)
Hi V. A.,

I hope you're doing well.  What it sounds like you want to do is a retriggerable finite analog generation.  Since you didn't specify what development environment you are using, I'm assuming it is LabVIEW for now.  There is a pre-written example program that shows you how to accomplish this in LabVIEW using the DAQmx driver here.  This VI creates two tasks, an analog output task and a counter output task.  The counter output is created to be used as the clock for the analog output since counter output operations are retriggerable.  When the counter output task receives the trigger you specify, it will create a finite pulse train that the analog output task will then use as it's clock.  Once this pulse train stops, the analog output waveform generation stops as well, until the next clock signals are received (when the counter output is triggered again).  The VI should give you a good idea of how to accomplish this, as the VI is commented pretty thoroughly, but let us know if you have any specific questions on this.  Have a great day!

Thaison V
Applications Engineer
National Instruments
Message 3 of 7
(3,202 Views)

"Once you start the task, it will trigger the voltage out everytime that trigger condition has been met."

Thank you for your advice!

But when I create a task in this way, DAQ generates waveform only for the first trigger condition and ignores the rest ones. May be I do something wrong?

 

0 Kudos
Message 4 of 7
(3,160 Views)
" What it sounds like you want to do is a retriggerable finite analog generation.
...
This VI creates two tasks, an analog output task and a counter output task.  The counter output is created to be used as the clock for the analog output since counter output operations are retriggerable.  When the counter output task receives the trigger you specify, it will create a finite pulse train that the analog output task will then use as it's clock.  Once this pulse train stops, the analog output waveform generation stops as well, until the next clock signals are received (when the counter output is triggered again."
 
Thank you very much!
I've really solved my problem by this algorithm!!!
But is there a way to accomplish retriggerable finite analog generation without using a counter?
Thank you again!
0 Kudos
Message 5 of 7
(3,159 Views)

V.A., 

I am afraid there is not a way to do this without the use of counters. The counter is the only hardware that has the ability to be retriggered. The analog output circuitry or any other circuitry for that matter does not have that ability built in, only the counters. So in order to achieve retriggered operations you must use the counter, and hence this method.

-GDE

Message 6 of 7
(3,131 Views)

2 GDE [DE]: Thank you!

 

0 Kudos
Message 7 of 7
(3,119 Views)