LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous analogue input and output

Hi,
I'm using a NI PCI 6014 multifunctaion DAQ card with Labview 6.1 and would like to create a VI to continuously generate an analogue output based on the analogue input, as close to real time as possible, with analogue input rates of 20Ksamples/sec and output rates up to 10Ksamples/sec.

The maximum analogue output I can obtain seems to be less than 4000Ksamples/sec on the "continuous generation VI" example in Labview 6.1 which continuously generates a buffered, hardware timed output but this card is capable of 10Ksamples/sec analogue output. At 4000Ksamples/sec or greater I get system/bus limitations causing a buffer under run error on the card.
I have combined this example VI with the analogue input part of the "SIMUL AIAO(ESeries) VI" example. Then I have a different problem, the 0.5 sec issue:

I can achieve the input sample rate of 20kSamples/sec but I have to read at least 10Ksamples from the buffer at a time which is causing a delay of 0.5 sec between generating and outputting anything (not even close to real time). Even if I set the analogue input sample rate to 1000 samples/sec I have to read at least 500 samples at a time from the card or I get the error message saying that data could not be read fast enough.


If I just look at the analogue input (not outputting anything), then I can reach the analogue input rate of 20Ksamples/sec and read 500 samples at a time which would only give a delay of 0.025 sec. Is there any way I can achieve this along with the analogue output (at an output rate of even 4Ksamples/sec)?
The analogue output needs to be generated according to some control algorithm (which looks at the analogue input, as close to real time as possible (at intervals much smaller than 0.5 sec).

I have attached the VI I'm using (made from the two separate example VIs). The file simult_AI_AO.VI is the main VI which needs to be opened. The file My Data Generator.VI needs to be in the same directory as the main VI file I attached. (For now, the output data generated is just a square wave but I will change this later to whatever I need to output).

Could anybody show me where I have gone wrong with this VI and how to improve the 0.5 sec issue?

Thanks in advance
SMJ
Download All
0 Kudos
Message 1 of 2
(2,600 Views)
Hello,

I have looked into your vi. You are using the function "AO C-GEN", I believe that this is taking up the time. The Ao C-GEN is a higher level. What you need to use is lower level functions such as AO Config, AO Write etc. If you expand the AO C-Gen.vi then you will see the lower level vis in this function but, each time you iterate the main while loop (of the vi that you have created, it goes into this AO C-GEN vi, which re configures the AO and then, AO Writes etc (Within a loop).

What you need to do is use the lower level fuction and basically use the AO configure, also AOStart on the outside of the main while loop, with the AO write in the while loop and then use the AO Clear at the other side of the while loop. This should increate timing issues.


I hope that this helps

Kind Regards

Louis Price
Applications Engineer
NI UK
0 Kudos
Message 2 of 2
(2,600 Views)