LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write multiple data in analog outputs using pci-6723

HI  

 We had NI PCI-6723 card and we are not able to generate analog outputs signals simultaneously for one channel with different data.

  AS I am using my functions like below :-
The sequence I am using is like this :-
 
1.DAQmxCreateTask("",taskHandle);
2.DAQmxCreateAOVoltageChan(*taskHandle,chan,"",min,max,DAQmx_Val_Volts,NULL);
3.DAQmxCfgSampClkTiming(*taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);
5.DAQmxWriteAnalogF64(taskHandle,bufferSize,0,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL);
6.DAQmxStartTask(taskHandle);
7.DAQmxIsTaskDone(taskHandle,done);
8.DAQmxStopTask(taskHandle); 
9.DAQmxClearTask(taskHandle); 
 
In first time  my data value is assume 10 and again i changed my data value to 5
 
but I am able to see my data value is 10 its not changing when i change the content of data.
 
please do the help
 
ASAP
 
Regards
krishna
0 Kudos
Message 1 of 4
(3,728 Views)
Hi krishna,

It sounds like you are able to output 10 Volts, but when you try to change the value to 5V, you are not seeing the update.  How are changing your output value to 5V?  If you are generating a continuous voltage waveform, usually you will have your "IsTaskDone" command within some kind of While loop.  If you take a look at the following CVI DAQmx shipping example (C:\Program Files\National Instruments\CVI80\samples\DAQmx\Analog Out\Generate Voltage\Cont Gen Volt Wfm-Int Clk), you will see a similar structure.  Within this While loop, you can use your DAQmxWriteAnalogF64 function to update the output sample values while the task is still running.

Thaison V
0 Kudos
Message 2 of 4
(3,713 Views)
HI,
 
Some more questions plz
Questions: -
1. From the attached example I can(if I am right) continuously generate same data writing to all channels.
 
   but I would like to know when it will come out of the while loop,
 
   My Understanding :- It will never come out of while loop b'cos it is continuously writing same
                       data for all channels until u explicitly stop.
2. can we write different data for all channels if previously one write operation is performing
   if I want to update the new data how can i do that?
   if that is the case can u please modify the code for updation of new data .
3. As per above example I am configuring all channels to 'mV', if I would like to configure for some
   channels to mV and some channels to drive in hertz(frequency) can u tell me how we can configure the
   card for anytype when it is required.
   My Understanding : - if I would like to configure for different type we have to stop the mV task and
                        clear the task again we have to configure for hertz.is it rite?
4. if the function "DAQmxIsTaskDone" is not put in while loop can the "DAQmxWriteAnalogF64" function
   writes all the data what it contains
0 Kudos
Message 3 of 4
(3,694 Views)
Hi Krishna,
1. Your understanding is correct.
2. You can write different data for each channel, but since you can only have one analog output task per device, you must write all the data at once. To write to multiple channels, do another DAQmxCreateAOVoltageChan to add channels to the task, and put your multi-channel data into DAQmxWriteAnalogF64 as a 2D array.
 
Make sure to look at the DAQmx ANSI C examples located in C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\
 
3. You will have to explain to me what you mean by "configure for hertz". Check out the example located at C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Cont Gen Volt Wfm-Int Clk\ to see a simple example of generating a sine wave in DAQmx.
 
4. If you take out the DAQmxIsTaskDone, you still have a while loop (that is now an infinite while loop). So, the loop will continue to run. The DAQmxIsTaskDone is basically there just to check for errors in the task.
--
Michael P
National Instruments
0 Kudos
Message 4 of 4
(3,662 Views)