Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

external counter timebase source in two edge separation task

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 8
(7,641 Views)
Solution
Accepted by UliK

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,

John Passiak
0 Kudos
Message 2 of 8
(7,637 Views)

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.

 

0 Kudos
Message 3 of 8
(7,620 Views)

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

0 Kudos
Message 4 of 8
(7,267 Views)

Hi Hari,

 

In LabVIEW you would use a DAQmx channel property node:

 

CounterTimebasePropertyNode.png

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 8
(7,260 Views)

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

0 Kudos
Message 6 of 8
(7,211 Views)

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

0 Kudos
Message 7 of 8
(7,197 Views)

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:

 

Untitled 1 Block Diagram _2013-01-17_16-51-57.png

 

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,

John Passiak
Message 8 of 8
(7,187 Views)