05-31-2007 12:29 AM
05-31-2007 07:41 PM
You might want to consider posting in the multifunction daq thread since this seems to pertain to that.
Also, if you post your code or a screen shot it will be easier to understand what you're doing (or not doing).
regards,
Drew
06-03-2007 12:40 AM
Please check the attachment.
I have included the VI that I am working on wid tis post.
The DAQ card that I am using is USB 6251.
Please help..
THnx.
Gokul.
06-03-2007 09:38 AM
Hi Gokul,
The reason why you are getting the phase error is because your AO and AI are not synced in anyway. Passing an error cluster from one task to the other won't synchronize the actual hardware, it will just force the order of operation, and in your code, the error cluster is being split so its really not even doing that.
Now for the good news. There are a couple shipping examples that will do exactly what you want. Under the Hardware Input and Output/DAQmx/Synchronization/Multi-Function folder when you search the examples, there are 2 codes Multi-Function-Synch AI-AO.vi and Multi-Function-Synch AI-AO-Ext Digital Trigger.vi. These codes are the same except one uses an external start trigger and the other doesn't. These show the proper way to sync the two tasks. The synchronization is done by configuring a start trigger for the AO and setting the source of this trigger to be the AI start trigger internal signal. That is, when the AI starts, an internal pulse will be generated to start the AO. To make this all work in the proper sequence, the AO task is started before the AI task so that it is ready and waiting for the start trigger pulse.
As for the digital filtering, the code you posted is using the default fs and fL (1 and 0.49) so I don't what values you were wiring to get the error. One thing about these inputs, if you put 1000 and 490 for fs and fL you will get the same filter response as using 1 and 0.49. So its the ratio of fs and fl that matters. In order for the filter to work, the ratio of fL/fs must be less than 0.5 to ensure Nyquist is met. If you're intended inputs are valid (meet the less than 0.5 ratio requirement) and it still doesn't work, you might want to try lowering the order.
Regards,
Drew
06-05-2007 03:57 AM
06-05-2007 11:55 AM
Glad to hear your code is working.
For more info about DAQmx and synchronizing check this link http://zone.ni.com/devzone/cda/tut/p/id/4322#toc4 In your application you might want to also make sure to share the same clock for both AI and AO and there is an example of that.
I am a little unclear about what 2 signals the phase lag refers to. If you've done the synchronized start correctly, the AI should start the same time the AO does. For instance, you should be able to read exactly what you are writing. I don't believe the phase lag has anything to do with computation delays or processor speed since this would probably give a time varying phase lag. Once the AI has started, it will continue to sample data. The read function just pulls the data in LV memory to allow for the data processing. On the next read, you don't read the AO data at that time but rather continue where the last read left off. If your application is fast enough, then the read function might have to wait a little before reading the N requested samples since they won't be available yet. If your application is slower, then the number of samples in the buffer will slowly build over time until you might reach the condition where the AI is overwriting old data.
Back to the phase shift. If you are using a single phase lock-in then to maximize the output you must make sure the reference signal and the measured signal are in phase. However, to not have to worry about the phase a dual-phase lockin can be used. the measured signal is multiplied to a sine wave and cosine and then filtered and added in quadrature. This eliminates the need for knowing the phase of the measured signal. In your previous code, it looks as if this is what your kind of doing. However, I don't have the vi you are using to create the reference signals.
You might want to post the new code so I can better understand where the phase lag is coming from.
regards
Drew
06-05-2007 11:52 PM
06-06-2007 06:07 PM
06-07-2007 12:03 AM
06-07-2007 08:58 AM
I believe that the AO task will not start the AO clock until it receives the trigger or put another way, the AO clock that the AI task uses should only be the edges that are actually used for waveform generation thus syncing your 2 tasks. You have wired the AO task correctly by not wiring anything, it should default to the onboad clock which is what you want. If it makes you more comfortable you could explicitly set the AO clock to be the onboard clock.
Let me think about this a little more and I will get back to you.
Drew