Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

NI6602 pulse width measurement: Do I have to use an external sample clock?

Solved!
Go to solution

Hi

 

In the .NET 4 example 'MeasPulseWidthBuf_SmplClk_Cont' it is stated in the comments that:

 

An external sample clock must be used. 

 

Counters do not have an internal sample clock available.  You can use
the Gen Dig Pulse Train-Continuous example to generate a pulse train on
another counter and connect it to the Sample Clock Source you are using
in this example.

 

I have an application running without specifying an external clock. The applications is running, but I'm not sure I can trust the recorded data. Here is the channel creation code:

 

 

                task.CIChannels.CreatePulseWidthChannel(readTaskCounter,

                                                        "ReadPulswidthTask", 25e-9, 20e-6,

                                                        CIPulseWidthStartingEdge.Rising,

CIPulseWidthUnits.Seconds);

task.CIChannels.All.DataTransferMechanism = CIDataTransferMechanism.Dma;

 

                task.Stream.Timeout = callbackTimeoutInMilliSeconds;

task.Stream.Buffer.InputBufferSize = 50000;

                task.SynchronizeCallbacks = true;

                task.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples);

                task.Control(TaskAction.Verify);

 

 

Note that I'm not specifying any external clock.

 

1) Which clock is the daq using? -It is obviously using some clock since I can collect data via this task.

2) Do I need to change the configuration to use an external clock to achieve reliable readings - as mentioned in the 'MeasPulseWidthBuf_SmplClk_Cont' example?

 

 

/mola

 

0 Kudos
Message 1 of 3
(6,157 Views)

I noticed that I can set the clock explicitly like this:

 

task.Timing.SampleClockRate = 80000000;

 

If I do not set it, it is defaulted to 0Hz, which suggests that it is not being used at all. Can anyone confirm this?

 

/mola

0 Kudos
Message 2 of 3
(6,155 Views)
Solution
Accepted by topic author mola

Hi mola,

 

That specific example is for sample-clocked pulse width measurements.  This type of measurement is only supported on newer hardware such as X Series boards and will not run on the 6602.

 

Your application that you linked uses Implicit timing, meaning that the signal itself serves as the sample clock.  That is, at the end of each pulse width that you measure, the sample is deterministically latched in.  So, you end up with a buffered array of every pulse width that is seen by the counter.

 

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(6,152 Views)