11-25-2010 09:11 AM
Hello,
I searched over forum but either no one asked similar question or it is well hidden.
The Problem:
I'm use counter output to generate pulse for stepper motor let say about 500Hz in cont. mode.
Every 10th pulse I have to measure something so I have to sunc. the sample clock od AI with counter, but the clocks are not the same.
I found an example how to divide external clock but there is no how to use divide internal clock for AI sample clock.
The atatched example does not work properly since when I reduce the samples for AI, it also reduce pulse for stepper.
I use LV8, NI USB 6211 daqmx
Thanks for attention.
Any help is welcome.
11-26-2010 06:51 AM
Hi sasko,
So if i understand, you want to generate digital pulses of specified frequency. Moreover, you want to divide this frequency and used this divided one as sample clock source for analog input?
If this is the case, one solution which should work is to use 2nd counter to divide the clock and use it's output as sample clock source.
There might be another solution which I however haven't tried - the one you try to do. I don't have time to check it, because I'm going to travel soon.
1) Take the generated signal, let's say 500Hz and use it as Sample Clock Timebase of analog input task (Use DAQmx Timing property node Sample Clock -> Timebase -> Source).
2) In the AI task, configure DAQmx Timing property node Sample Clock -> Timebase Divisor to desired division. If you need to get 50Hz, configure divisor to be 10.
3) Leave Sample Clock Source to be Onboard clock (i'm not sure, but i think so).
In fact it should be pretty simillar to what what you are doing - just don't connect counter output to AI sample clock source. I would say, that you can specify Timebase rate, and you don't have to specify division manualy. Instead, you specify sample clock rate and division will be calculated.
Sorry for being very short, and not verifying my suggestion, but I hope it might help.
regards,
Martin Stefik