From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Analog Generation/measurements

hi,

i use win2k, labwindows CVI 7.0, and MAX 3.1.1

I want to realize multiple analog géneration and measurements.
I use the CArd PXI 6713 for the generation and PXI 6031 for the measurements.

In this way, i create two daqmx task with MAX, one for the two input channels, and an other for the two output channels.
Physically, i connect AI0 on AO0 and AI1 on AO1.

When i use the fénération task with MAX, i read the good values with CVI using the reception task (check with oscilloscope)

But, i can't succeed to read when i use the generation task with CVI, my programme doesn't work, and i can't find the error.
i think my buffer is not well defined but i did not find any exemple.

Does anybody could help me? (reading my code or send me an exemple)

thanks,

Nico.
0 Kudos
Message 1 of 10
(4,689 Views)
Hi,

It is difficult to point what is wrong in your code, as I don't know how your tasks are defined in MAX (finite or continuous generation, etc.).
Could you please tell me if an error code is returned by any of the DAQmx function and if the code inside your loop is executed?
Please also provide me the DAQmx tasks, which are configured in MAX. You can export these tasks in MAX with the menu "File>>Export..." and join the file to this thread.
I will be able to reproduce this behaviour and point out what is wrong.
Thanks.

Benjamin
National Instruments France
0 Kudos
Message 2 of 10
(4,657 Views)
hi benjamin,

thanks for helping me!

the tasks are well defined in continuous generation mode in MAX.
I don't have any errors returned by the DAQmx function.

Like you want, i join the task configuration.

Hope you could help me.
Thanks.

Nico.
0 Kudos
Message 3 of 10
(4,631 Views)
 
0 Kudos
Message 4 of 10
(4,619 Views)
Hi Nico,

I have some remarks, which can explain that your code doesn't work as you expect :
1. In a generation task, you generate samples from the write buffer. So you must call the DAQmxWriteAnalogF64(...) function to fill the buffer BEFORE starting the generation with the DAQmxStartTask(...) function.
2. You should initialize the phase variable to 0 before calling the SineWave(...) function, otherwise you might not onbtain the pattern expected.
3. You use the Strip Chart control as a Graph control. In a graph you plot arrays of samples, whereas in a Strip Chart, you add points to a plot. To plot two traces in a strip chart, you must set the number of traces to two by editing the strip chart control properties from the user interface. When you trace many plots, you pass an array to the PlotStripChart(...) function where the samples are interleaved. So you must turn the Fill Mode parameters in the DAQmxWriteAnalogF64(...) function into DAQmx_Val_GroupByScanNumber. You just have to call the PlotStripChart(...) function once to plot the two plots.
If you made these modifications, I think your code will work properly.

Best regards.
Message 5 of 10
(4,598 Views)
hi benjamin,

you were right, it 's work better now!
But with the modifications that i did, i can only write/read on one channel.
The second channel defined on my task with MAX is not used.

i try to use it configurating it with the command: "NIDAQmx_NewPhysChanAICtrl(..,..,1) et NIDAQmx_NewPhysChanAOCtrl(..,..,1), but it dosn't work and i am not sure it is teh better way to do that.

i don't find any example on the website or in the NI Exemple Finder...
Do you have an idea?

Thanks a lot.

Nico
0 Kudos
Message 6 of 10
(4,583 Views)