Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

buffer size??

Dear readers,
 
I am new to labview, only started to work on that for the past few weeks, so pardon me if i ask anything obvious.
 
My requirement is to generate a signal, send that signal to a motor and acquire the same signal with three other signals simultaneously.
 
I wrote a simple program for that but when i started running it, i got a time delay between the signal generation and signal acquisition. for example, i used a simple sine wave to generate and during runtime, when i changed the amplitude or frequency of the sine wave, it took a considerable time to see the signal change in the motor and in the data acquisition too. I couldnt figure out what the problem is. may be in buffer size which i couldnt understand at all.
 
So i sought all your expertise to help me with this program. I also attached the file just in case u need.
 
thanks in advance for any kind of assistance.
 
Rishe.
 
0 Kudos
Message 1 of 12
(3,876 Views)

Hi Rishe,

There is no synchronisation between your AI and AO.

In your VI, for each iteration, Analog Output is generated, After it is completed, AI measure will execute ( it can happen vice versa too)

so you will not be able to achieve what you wanted to.

Go for a multi function sync program

Look at attached VI to get an idea

If u need any clarifications, do get back.

Regards

Dev

 

 

Message 2 of 12
(3,841 Views)

Dear Dev,

Thanks for your kind response.

I sort of understand the program u mentioned and i changed my program according to that. but still the same problem exists. simply, when i change the parameters of my input signal (in this program mainly the frequency and amplitude of the sine waveform) during runtime, (signal to be read), it doesnt seem to change at all. in other words, the program reads the signal with the parameters set before the start running the program. once the program starts running, whatever change i make doesnt have any effect at all.

with the previous program it changed, but happened only after a certain time delay. I dont know whats the reason behind it. could u please assist me again. please find the new program attached.

thanks a lot for your help.

Rishe.

0 Kudos
Message 3 of 12
(3,831 Views)

Hi Rishe,

You will observe that in the attached VI, the analog output configuration/ setting the frequency, amplitude parameters of the generated sine wave happens outside the while loop. Hence inside the while loop, only continous sine wave generation can be seen

To change the generated sine wave's parameters on the fly ( during generation), use this VI

Regards

Dev

 

Message Edited by devchander on 01-08-2006 10:55 PM

Message 4 of 12
(3,825 Views)

Dear Dev,

Once again thanks for your help.

this is great, i changed the program according to your instructions, and it works perfectly.

except that one problem still remains: the time delay between the generation and acquistion. when i make changes to the input parameters, (that goes in to daqmx-write) during runtime, it changes immediately but acquired (through daqmx-read) only after 10 seconds.

Could you please assist with this one too. i attached the program with changes done.

thanks a lot mate.

Rishe.

0 Kudos
Message 5 of 12
(3,798 Views)

Hi Rishe,

Run this attached VI.

I do not have a DAQ card with me today, and so i could not test the code on hardware.

let me know how it works.

Regards

Message 6 of 12
(3,783 Views)

Hi Dev,

Thanks again. I changed the program. all i had to do was to add a property node, to avoid regeneration of the samples. i dont understand what it does, but it serves its purpose. so the program updates the signal fairly quickly. i still have like 1.5 - 2 sec delay but i think i can live with that. once again thanks for your help dev.

look out for me dev, i will come up with more questions. 🙂

many thanks.

Rishe.

0 Kudos
Message 7 of 12
(3,768 Views)

Hey Rishe,

Glad to have been of help.

To put it briefly, the "do not allow Regeneration" property does this- "new data has to be provided throughout the duration of the continuous Analog Output operation. This allows the generation of any arbitrary frequency as this VI computes new data for each iteration of the loop, maintaining phase continuity of the signal"

If you allow regeneration, The signal you want to generate is written into the AO buffer.

On each AO write Iteration, the write marker returns to the beginning of the buffer after the device generates all samples currently in the buffer and teh same signal is generated repeatedly.

Do go ahead and keep posting your queries.

all the best

Regards

Dev

Message 8 of 12
(3,762 Views)
Hi Dev,
 
I didnt realise that i will come back so quickly. may be its because u r very helpful. i changed the program so that it can generate random signal and chirp signals in which the later one i couldnt do. anyway, but when i try to run a spreadsheet/txt file from my computer, then i faced the problem. actually this is important because, that is my real project, i have a looooooooong data file and i have to use this data file to generate signals and data collection. i detailed my problems in the program itself, because it is very elaborate.
 
Could you please be of help this time as well. I really appreciate your time and help.
 
thanks a lot.
 
Rishe.
Download All
0 Kudos
Message 9 of 12
(3,748 Views)
Hi Rishe,
U asked 3 questions in your VI.
 
Could you please advise me about the present issue?
Could u please guide me about running a 4 minute length data?
 
For running a data of 4 minutes, do this: you have set your update rate for AO as 1000, now just keep indexing out 1000 samples of the data you read outside the loop serially and keep feeding it to the DAQmx write.
I modified your VI ( see attachment)to do it, there are other mentods like: reading a file inside the loop with an offset of 1000 in each iteration.But this is the simplest for the time being.
 
and finally can u tell me, how can i fix the recording time? u can see in my program, i set a record button. what i want is, when i press record
button, the program has to record for exactly two minutes (or 120000 samples with a sampling rate of 1000) and then it should stop
recording automatically. (not the program). is it easy to do??
 
In the attached VI, i have put "write waveforms to file.vi" and  initiating its recording by a boolean.
Once u press Record boolean, the recording will start.
Since The values you have set ( for sampling rate, number of samples to read and update rate) for DAQmx read and DAQmx write will execute the loop at one second per itertion, i just keep a count of number of iterations and terminate the record after 120 iterations.
( you can also stop record by turning the boolean off)
 
Hope this helps
Regards
Dev
 
 
 
Message 10 of 12
(3,741 Views)