09-03-2012 03:28 AM
I am using an external source for the sample clock timebase of an analogue input task. I'm dividing this down by 100 to get my sample clock. Could someone please tell me whether my first sample clock pulse will be generated on the first pulse of the external timebase source, or on the 100th?
I am using an M Series device but can't see a timing diagram in the manual that answers my question.
Thanks.
CAS
Solved! Go to Solution.
09-11-2012 12:38 PM
Hello CAS,
I wanted to find out how you are dividing down the external clock? Is this being done in hardware or software?
Regards,
09-11-2012 03:19 PM
CAS,
The timebase tick when you would see the first sample pulse is generally defined by the DAQmxTrigger->Start.DelayUnits and Start.Delay properties. By default, DAQmx will minimize this (M Series has a minimum value of two ticks of the timebase). By setting these properties along with your timebase source and divisor, you should be able to fully control when you see sample clocks. To summarize:
First sample clock should occur at 'Start Delay' number of ticks after you start your task.
Every subsequent sample clock should occur in multiples of your timebase divisor.
Hope that helps,
Dan
09-12-2012 02:01 AM
Hi Dominic
Thanks for looking at this for me. I am dividing the signal in software (DAQmx in .NET).
To give you the full picture, I have an external clock signal pulsing at approximately 3kHz. I feed this signal onto a PFI pin of one of my ADC cards and set this as the sample clock source on that card. This is my 'fast' card and I want to sample the signals on this card at 3kHz. I also have a second ADC card connected to the first via a RTSI cable. This is my 'slow' card and I want to sample the signals on this card at 30Hz. I therefore set the 'sample clock timebase source' on my 'slow' card to the pin receiving the external 3kHz clock. I also set the 'sample clock timebase divisor' to 100 on this 'slow' card.
So my question is, do I get the first sample on my slow card at the same time as the 1st sample on my fast card or at the same time as the 100th on the fast card?
CAS
09-12-2012 02:08 AM
Hi Dan
Thank you for your reply. With reference to my reply to Dominic above, I believe that you're saying that I will get the first sample on my slow card at the same time as the first sample on my fast card - is that correct? That is, assuming I have any start delays on the cards set the same (I haven't changed these from the defaults).
Thanks.
CAS
09-12-2012 11:03 AM
Have you considered doing this in software? Or are you taking advantage of better accuracy / resolution on the separate "slow" card?
-Kevin P
09-12-2012 11:28 AM
CAS,
I don't think it's possible to use the 3 kHz sample clock on the fast card as the sample clock timebase on the slow card, and get the first sample to align. The fast card will sample on every pulse of the 3 kHz signal, while the slow card will need to satisfy the initial delay requirement before it can issue a sample clock. If you make this initial delay the minimum of two ticks of the timebase, the slow card would end up sampling on the clock edges 2, 102, 202, etc. You could set the initial delay to be 100, which means the slow card would sample on edges 100, 200, 300... but you wouldn't get a reading from the slow card on the first edge of your sample clock.
Hope that helps,
Dan
09-13-2012 01:53 AM
Hi Dan
That does indeed help. I don't actually need to align the first samples on the two cards, I just need to know when they happen relative to each other - which I now do thanks to your explanation.
To give the full picture, I am exporting the (30Hz) sample clock generated on the slow card to a timing card where I accurately latch the time at each pulse = the time of each slow data sample. In post-processing, I then use the latched times to accurately time stamp my acquired data. So as long as I know how each acquired time value relates to each sample, I can calculate the correct times.
Thank you so much for your help.
CAS
09-13-2012 02:07 AM
Hi Kevin
Do you mean have I considered using software to control the sampling rate? I can't do that in this application. The time at which I am acquiring the samples needs to be synchronised with the external device providing the analogue inputs and the clock signal.
Or are you referring to why I'm using 2 cards? I do have a number of dynamic channels I need to sample at the faster rate and then some other static channels more suited to the slower rate. I could sample these static channels at the higher rate and throw away data but it's actually convenient for me to have the 30Hz sample clock signal to export to my timing device (see my reply to Dan) which would not be able to handle the faster 3kHz signal as an input.
I have run my system in this configuration and it works well.
Apologies if I've misinterpreted your question and thanks for contributing.
CAS
09-13-2012 07:54 AM
Sounds like Dan's got you all set now. Just to wrap things up, my question about using software for the 30 Hz sampling was meant to inquire whether you could acquire everything on a single 3 kHz card, but discard (or average, whatever) 99% of it for the "slow" channels. I see now why that wouldn't work for you.
Since you can live with the small but fixed & known offset between initial samples, the hw solution is better anyway.
-Kevin P