03-01-2011 11:00 AM
Hi all,
I use a NI 6220 board and want to perform something very similiar to what is described in the knowledgebase article "How Do I Count Digital Edges Between a Start and Stop Trigger on an NI 6602 Counter/Timer Board?".
Does anybody know how I have to change the example program "TwoEdgeSep.c" to use not the internal timebase but to use an external source (the one I want to count the edges?
Thank's for your time,
Uli
Solved! Go to Solution.
03-01-2011 03:04 PM
Hi Uli,
You would need to add a call to DAQmxSetCICtrTimebaseSrc before the task is started to configure the hardware to use an external timebase. You'll also probably want to change the DAQmx_Val_Seconds parameter to DAQmx_Val_Ticks in the DAQmxCreateCITwoEdgeSepChan function assuming you want your measured result in terms of ticks of the external clock.
Best Regards,
03-02-2011 03:56 AM
Hi John,
thank you very much, this works as intended. For the sake of completeness I copy the configuration part of the program:
/*********************************************/
/*/ DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateCITwoEdgeSepChan(taskHandle,"Dev1/ctr0","",100,1000000,DAQmx_Val_Ticks,DAQmx_Val_Rising,DAQmx_Val_Falling,""));
DAQmxErrChk (DAQmxSetCICtrTimebaseSrc(taskHandle, "", "/Dev1/PFI8"));
I connected the trigger signal (TTL with a roughly 1 s period) to the AUX and GATE input and the external source ca. 200 kHz to PFI8 and it correctly measures the edges within a half period.
01-04-2013 04:46 AM
Hi John,
I searching for the same problem, how to solve it Labview.
I like to know,how to add external time base for two edge separation task.
Regards,
Hari
01-04-2013 11:37 AM
Hi Hari,
In LabVIEW you would use a DAQmx channel property node:
Best Regards,
01-17-2013 01:20 AM - edited 01-17-2013 01:35 AM
Hi John,
Thank you for reply. i wrote the program as you mentioned.
But it gives errors.
my specs:
PCIe 6351 DAQ card.
External timebase Source 10khz.
Time between to edges 14ms.
I got output with internal timebase fine.
i need the output using external timebase.
any example code.
Regards,
Hari
01-17-2013 05:29 AM
Hi John.
I got the solution.
i have one question how to calculate the MAX & MIN value for the CounterTimeBase Rate.
Because of the TimeBaseRate errors were occured.
Regards,
Hari
01-17-2013 04:55 PM - edited 01-17-2013 05:01 PM
What errors were you getting?
The counter can count between 2 and 232-1 ticks. So... the rate that you specify will determine the minimum and maximum value (in terms of seconds) that you can count. These values are set when you create the channel:
It seems intuitive to try to put "0" for the minimum value, but that will give you error -200527 (Requested values of the Minimum and Maximum properties for the counter channel are not supported...). The real minimum value (in seconds) should be no less than 2 * (1/ timebase rate). I'm not sure if this is your issue or not, I'm just speculating.
EDIT: I just realized the default (if left unwired) for the minimum value is 1 µs. This would be below 2 ticks of your 10 kHz timebase so would give the same error. You need a minimum value of at least 200 µs.
The actual timebase rate itself shouldn't have a minimum or maximum value that I'm aware of (I guess maximum would be 100 MHz on your X Series, but in reality you can only pass through ~25 MHz from an external PFI line due to bandwidth limitations).
Best Regards,