09-24-2009 02:19 PM
I'm using a pci 6602 with DAQmx in Matlab. When I specify 'OnboardClock' or 'NULL' as the Source Terminal for the Sample Clock in the DAQmxCfgSampClkTiming command, I get the error "ErrorExtSampClockSrcNotSpecified."
The same/similar error message results from using buffer_count_all_counters.vi in LabView. I have searched for this error topic in the forums and found very little.
All I want to do is use the 80MHz timebase as necessary to drive the counters so they will increment on rising edges separated by the minimum of time possible.
My application is simulatenous photon (edge) counting of two channels. I just need to start and stop the two counters at the same time and count for a specific time duration.
Anticipating that I have to use some well known method of doing this, besides helping me with this question could anyone please direct me to where this obvious system setup may have been described?
Thank you very much for any help!
09-24-2009 03:37 PM
Apparently, the Sample Clock does not define updating rate of the counter. Rather, it drives the latching of values out of the counter and into the memory. Therefore, it is likely that it is physically not possible to route the 80MHz clock there, as 80MHz is only offered on the 6602/8 and thus may not be integrated the same way as other signals.
Secondly, when I tried to use the 20MHz clock, I got an error that the memory was overwritten before it could be read. That would make sense.
Now I am going to try to create a Pulse Train with one counter, send it to an RSTI channel, which I will then assign as the Sample Clock terminal in counters 0 and 1.
Does this sound right to anybody out there?? Cheers, Peter.
09-24-2009 03:52 PM
09-24-2009 08:49 PM - edited 09-24-2009 08:52 PM
Which documentation are you looking at that is misleading? We certainly want to make everything as clear as possible, so if you can point to any specific instances it would be helpful so we can make appropriate changes if necessary. If you are referring to Data Acquisition Toolbox documentation, this is not written nor maintained by NI.
It sounds like you found out the overall idea of how the counters work, but I'll go through some of your statements just to make sure everything is clear:
Q: When I specify 'OnboardClock' or 'NULL' as the Source Terminal for the Sample Clock in the DAQmxCfgSampClkTiming command, I get the error "ErrorExtSampClockSrcNotSpecified."
A: There are no dedicated sample clocks on the 6602, so for sample-clocked counter tasks you must use an external clock. This just means external to the task, it is perfectly acceptable for the clock to come from one of the other counters (for example) that is running a pulse generation task.
Q: All I want to do is use the 80MHz timebase as necessary to drive the counters so they will increment on rising edges separated by the minimum of time possible.
A: I think as you've now realized, the timebase doesn't really apply to counting an external signal. The count register will simply increment on the edge of your external signal. The timebases are often used in tasks such as Pulse Generation (output for a certain number of timebase ticks) and Period Measurements (count number of timebase ticks in between rising edges of your signal). Basically anything that we need a known reference.
Q: My application is simulatenous photon (edge) counting of two channels. I just need to start and stop the two counters at the same time and count for a specific time duration.
A: If the photons are coming in while the counters are being started, you should use an Arm Start Trigger so that the counters are armed at the same time. Otherwise you might pick up an extra photon or two during the time it takes to start the second counter task (in software).
Q: Therefore, it is likely that it is physically not possible to route the 80MHz clock there, as 80MHz is only offered on the 6602/8 and thus may not be integrated the same way as other signals.
A: You are correct that there is no route from the 80 MHz timebase to the sample clock (which is actually the Gate input) of the counter. Even if this route existed, the counter would overflow immediately since we cannot pull data off of the board this quickly. It is possible to route the 20 MHz timebase to the Gate, but it is not intended to be used for a Sample Clock since this will also overflow the on-board FIFO immediately
To see what routes are available, you can take a look at the Device Routes tab in Measurement and Automation Explorer.Q: Now I am going to try to create a Pulse Train with one counter, send it to an RSTI channel, which I will then assign as the Sample Clock terminal in counters 0 and 1.
A: You actually don't need to route the signal to RTSI--you may specify to use the Internal Output of a counter as the source for your Sample clock. Keep in mind the Device Routes tab that I mentioned above--there is a shared "Trigger Bus" that connects counters 0-3 with counters 4-7. You can only route one signal internally on the board between these two "banks" of counters.
Also, keep in mind that Finite Pulse Generation will require the use of two counters on the 6602 (but you should have more than enough on the 6602 unless you are doing other things that you haven't mentioned). Continous Pulse Generation and Single Pulse Generation only require a single counter.
I hope this info was helpful--it sounds like you are on the right track using one of the counters to generate a sample clock for the other two. Thanks for posting!
09-25-2009 03:59 PM
The Description in the NI DAQmx C Reference Help file for the function DAQmxCfgSampClkTiming is where it states: "<The input argument "source" is> the source terminal of the Sample Clock. To use the internal clock of the device, use NULL or use OnboardClock."
I guess I was not aware that the sample input of a counter is actually the Gate input. The entry "Counter Parts in NI-DAQmx" is starting to clear this up for me as well. Thank you very much for your detailed answer!