12-16-2010 04:54 PM
Hi,
I want to generate continuous signal and at the same time I want to read that signal that I generate using a single DAQ card. I want the generate signal and the receive signal is synchronized and in phase.
I've looked several samples about synchronization but it quiet confusing. One using the same clock input while other use a start trigger. I'm using PCI-6024E DAQ card.
Can anyone help me regarding this matter?
Solved! Go to Solution.
12-16-2010 05:01 PM
If you're acquiring and generating at the same rate you can simply share a sample clock between the two tasks without a start trigger. The master task will not produce a sample clock until it is started in software, so by starting the slave before the master you ensure both tasks start together.
Best Regards,
12-16-2010 05:12 PM
Thanks but how about the continuous signal analog output generation. I attached the sample that share a sample clock. Does the signal that generated is continuous as the basic function generator block is outside the loop?
12-16-2010 05:19 PM
The data that you write before the task is started will be looped continuously by default.
I noticed that you're probably using the AO to clock AI. If that's the case, you'll need to start the AI task first (for reasons I mentioned above).
That example looks a lot like the shipping example but with the shared start trigger removed. Sharing a start trigger is also acceptable since the two tasks derive their clock from the same timebase. If you decide to use the internally derived clocks on each task with a shared start trigger, please note that rates which aren't an integer divide down of the 20 MHz timebase are coerced. AI will always truncate to an available sample rate that is higher than what you specify, whereas AO will round to the closest available rate.
Best Regards,
12-16-2010 05:45 PM
oh great so I don't have to put the basic function generator in the loop in order to generate continuous signal as there are example that put the block in the loop to generate the continuous signal like example 1 that I attached.
Yeah. I'm using the AO to clock AI. How I'm going to start the AI first? I'm quite new in this labview. Your guidance is much appreciated. I attached the VI circuit for your convenience.
12-16-2010 07:18 PM - edited 12-16-2010 07:19 PM
You'll probably want to read up on the concept of Data Flow. In LabVIEW, a subVI or function doesn't execute until it receives all of its inputs. So, you can use the error wires to force the functions to execute in a certain order. For example:
AO Executes First in the following scenario (like you have currently):
AI Executes first in this scenario:
Of course, you could use either task as the master. You could start AO first, but then you should make AI use the internally derived clock, and AO would use aiSampleClock for its source.
The example that you linked uses non-regeneration ("Do Not Allow Regeneration"), which is useful if the output cannot be pre-defined. If you don't explicitly set this, the driver will regenerate the same waveform continuously (on a continuous task).
Best Regards,
12-16-2010 10:23 PM
Hi John,
Many thanks for the explanation. I just read the data flow. Now I have construct two versions circuit design in version 1 and version 2. Both intended for AI to execute first.
Could you confirm if both versions are correct or not?
Yeah. If I not wrong, I can just use my previous circuit, the only change I have to made is make AI use the internally derived clock and AO would use AI sample clock for its source.
What do you mean the output cannot be predefine? Is this related to frequency output?
12-17-2010 02:48 PM
In both of those screenshots, the AI task will start first (which is what you want, since it is the slave task).
Typically for AO, you can just write a single period of your waveform, then regenerate it over and over again. Your waveform would be pre-defined before the task is started. If you need to update the waveform on-the-fly depending on programmatic input while the task is running, you'd want to disable regeneration. Also, if the waveform is such that it can't be easily represented by a pre-defined buffer (e.g. it is an odd frequency that is not an even divide-down of the sample clock), then non-regeneration is the way to go.
Best Regards,