09-01-2010 03:16 PM
In your case, you have two signals (frequencies f and 2*f). If you trigger off of the slower frequency, you should see a stable waveform on the scope.
However, if you trigger continuously off of the faster frequency the slow waveform could shift to one of two possible phases:
I'm guessing this is probably what you're seeing.
Best Regards,
09-02-2010 03:15 PM
Yes, you're right, I should have thought about it earlier.
Now this works, I have two other questions.
In the VI attached, I added a part which reads an analog input synchronously with the ctr0 and triggered by ctr1. It works fine. My question is about the frequency. I read that USB-6212 has a maximum sampling frequency of 250 kHz, so my VI won't work if I put a frequency greater than 250 kHz. Is there a way to make it work ? If not, it is not critical.
Then, I need (in the same application) to generate pulses, synchronously with ctr0, but with a different period. This is to fire a LED.
It is not clear to me if I can use a numerical output to do this, or if I need to use an analog output ?
Tanks again for all the help !
Best regards,
JB
09-02-2010 03:31 PM - edited 09-02-2010 03:31 PM
Hi JB,
The maximum specced frequency for AI is 250 kHz, but you could probably go slightly higher than this before you start running into problems. At a certain point you will start to receive ADC Overrun errors if you try to sample too fast.
Since there are only two counters on the 6212 you'll need to come up with some other way to generate the third signal. Analog Output is certainly an option. Depending on the requirements of your clock signal you may be able to use the Frequency Generator to output the clock. However, the Frequency Generator can't be triggered and the number of frequencies available is quite limited (see diagram below):
One other thing about your code--you probably want to start the AI Task before the counter task so that you are guaranteed not to miss any sample clock edges.
Best Regards,
09-02-2010 03:50 PM
Actually, I need something really simple: I switch a 5V signal on and off each time I see a rising edge on ctr1... I think it won't be too hard to do with an AO.
09-03-2010 07:36 AM
Well, this is not so simple.
In principle, I wanted to create a AO task, generate a 5V voltage and switch the task on and off on rising edges of ctr1.
However, I cannot find a way to react on a rising edge of ctr1. Is it possible ?
09-03-2010 10:13 AM
You could write a waveform like [5, 0, 5, 0, ... ] and use the ctr1 Internal Output as the sample clock.
For the overall structure of the AO code, you can refer to this example:
Continuously Generate Voltage Using External Sample Clock
Best Regards,
09-03-2010 11:29 AM
09-03-2010 12:17 PM
The example I posted doesn't use the Express VI, you can set whatever voltage value you want. The idea is still to clock out AO based off of the output of ctr1.
You have your task configured to be "finite". So, if you try to read more than the 133 samples you'll get an error. Change the task to "Continuous", then set the number of samples to read input to DAQmx Read to be 133. You can then call this repeatedly inside a loop.
Best Regards,
09-03-2010 04:23 PM
The difficult point for me here is how to set the right parameters for the waveform generation.
I tried to use property nodes, but it seems to be a problem.
You can see in the attached VI (bottom) that I try to get ctr1 frequency and feed it in the waveform generation vi. I also build a cluster with frequency and number of samples per channel.
09-03-2010 04:36 PM
Something like this should work:
The trigger isn't necessary since the external sample clock is starting the generation. You can use only onboard memory if you want since there are only 2 samples that need to be repeatedly clocked out. I also changed the instance of DAQmx Write to be 1D DBL since it makes a little more sense than waveform in this application.
Best Regards,