10-18-2008 01:30 AM
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
Solved! Go to Solution.
10-19-2008 01:32 AM
Calling all Proven active veterans, application engineers, moderators...
Is this problem so difficult that no one knows about it?
I am stuck up with this since a long time... can you please suggest any solution?
-Mandar
10-19-2008 03:44 PM
Hi Mandar_K.
I saw your please for support.
I am currently not in the office until tuesday - so I can only suggest a few things...
I would recommend using the example the example in the example finder AI-AO Synch DAQmx tasks (Help>>Find Examples>>Hardware I/O>>DAQmx>>Synch..). I for one, am not a fan of the DAQ Assistant - and would recommend using the DAQmx vi's.
Firstly, I would use the NSamples mode because you want to read in all the samples you've collected in the buffer on every iteration of the loop. If this isn't done, an overflow will occur and data will be lost - hence the error!
Secondly, the change in frequency is delayed probably by the number of samples your reading in - if your reading in a large number of samples - and you a fairly slow sample rate, then when you can the frequency - you've still got to collect the original samples at the previous sample rate - at least this make sense to me. But, you certainly (with the correct setup) shouldn't see a delay of the amount you've stated.
I would recommend trying the code without the multiple, just try to get a synch input and output working first. If you could post the DAQmx code, then I will try it on tuesday and work from there?
Kind Regards,
10-21-2008 02:02 PM
Dear Hillman,
Thanks for the quik reply. I have gone through the example: Help>>Find Examples>>Hardware I/O>>DAQmx>>Synchronization>>Multi-Function-Synch AI-AO.vi
It was quite helpful in understanding many concepts. I have made a VI which I think is nearest to the above example and should suit my needs. Am attaching the VI (made in LabVIEW 8.2) as well as the screen shots of block diagram and front panel. I am getting the input on the graph correctly.But I do not get any output.
I get the following error after the time-out that I specify (here 10 s) for the DAQ-mx write VI
Error -200292 occurred at DAQmx Write (Analog Wfm 1Chan NSamp).vi:2
Possible reason(s):
Some or all of the samples to write could not be written to the buffer yet. More space will free up as samples currently in the buffer are generated.
To wait for more space to become available, use a longer write timeout. To make the space available sooner, increase the sample rate.
Property: RelativeTo
Corresponding Value: Current Write Position
Property: Offset
Corresponding Value:
Task Name: _unnamedTask<64>
I also see the number of iterations of the while loop and it remains constant as 1 till I get the above error.
With the sample mode on both the sample clocks changed to finite samples, there is no difference in this.
Can you suggest what I can do?
Thanks,
Mandar_K
10-22-2008 03:25 AM
Hi Mandar_K,
Thanks for the reply and I hope your well today!
This is an example I have done with a synchronised AI read, some processing and then AO. This seems to be what you require.
Please take a look (LV8.2), and let me know what you think,
Kind Regards,
10-26-2008 04:51 AM
Dear Hillman,
Thankyou very much for the VI. This is indeed what I want. I am able to get the desired output.
(1) However, as you say, there is a bit of delay still ~ 12 ms. i. e. when I see the following two signals in the oscilloscope, I get a difference of around 12 ms in them:
(a) Signal generated using Tektronix (which I essentially give as AI to the VI)
(b) AO signal from the VI
Can this be reduced further?
(2) I think priming the output buffer was the key step. You have a zero to the first DAQ mx write VI which is outside the while loop. But what is the "99" that is there. I saw that it can be canged to 98, 97, etc, but not beyond 99. I did not understand what is. Please explain.
(3) Also, how have you wired the "current state of output" to the DAQ mx read? I cannot see any new channel created.
My doubts might be really silly. Please bear with me.
Thanks once again,
Mandar
PS. I am going to my hometown till Thursday, may not be able to reply till then
10-27-2008 05:05 AM
Hi Mandar,
Thanks for the reply and I hope your well.
These are all good questions.
1) The time delay is caused by the number of samples your reading in - the shortest delay is the fewest samples you take. However, I imagine depending on the anylsis your doing you will need a fair number of samples.
2) The array of zero's is to output a known value for a certain period of time before anylised data is outputted i.e. zero's for 10ms (sample rate x number of samples) in this case.
3) Okay, so in the Input task there are two channels. One in the input signal and the second is the output signal read back in - so the user can see the state of the output.
I hope this helps,
Kind Regards,