10-16-2008 11:40 PM
Hi,
I am trying to do a simple anaolog input and output operation: I generate signal using a Tektronix signal generator (30 Hz, 2 V p-p) and take it as analog input from 9215 using DAQ Assistant-1. Then multiply it by 2 and send it as analog output through 9263 using DAQ Assistant-2. I later see this singal on an oscilloscpoe. Following are the settings of DAQ Assistants:
DAQ Assistant-1:
Mode: continuous
Rate: 1K
No. of samples: 1000
Clock type: internal
DAQ Assistant-2:
Mode: continuous
Use timing from waveform data
Clock type: internal
When I run the VI, it stops after about 25 seconds giving the error:
Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan NSamp).vi:1
Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value:
Task Name: _unnamedTask<6>
Why are these setting wrong?
By trial an error I found that by making the mode of DAQ Assistant-1 to "N Samples", I was no longer getting this error. However, then a large time delay was introduced. i.e. If I change the freqency of the signal (to say 15 Hz from 30 Hz), then this change is reflected on the oscilloscope about 10 seconds later. Why is this happening? And how can I solve it?
I am attaching the blcok dig for reference.
Thanks,
Mandar
11-06-2008 05:54 AM
Hello Mandar_K,
You are viewing the error most likely because you have your AI task and AO task in the same While Loop with timing control. This causes your loop to run at the maximum processor capacity, without your two tasks being synchronized. Therefore, your Output Express VI may be trying to output data that has not been received yet. There are at least two methods you can try to avoid this problem.
To continue using Express VI's, you put the Input and Output tasks in two separate While Loops, and have data pass between them using the Queue Function, found on your Block Diagram Palette under 'Programming'->'Synchronization'->'Queue Operations'. There is an built-in example in LabVIEW of how do use Queues. On the main menu, navigate to 'Help'->'Find Examples'->'Search' Tab. Search the word queue, and find example 'Queue Basics.vi.' Your Output Express VI will then wait, until there is data in the queue for it to output.
To synchronize the DAQmx tasks, you should create the same application using the DAQmx VIs in the 'Measurement IO' palette. This option is illustrated in an example within LabVIEW as well. On the main menu, navigate to 'Help'->'Find Examples'->'Browse' Tab. Browse to the file 'Hardware Input and Output'->'DAQmx'->'Synchronization'-'Multi-Function'->'Multi-Function-Synch AI-AO.vi'
These examples should provide you with some ideas to apply to your own application. This topic is covered heavily in the NI Training courses LabVIEW Basics I, II, and DAQ with Signal Conditioning.
Regards,