Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i use internal base clock when i count two inputs

Solved!
Go to solution

Hi. I'm using a USB-6343 and there is a internal base clocks.

johndoe_student_0-1591755905826.png

I want to count two digital inputs and see in array, so i build a vi like below

johndoe_student_1-1591756103472.png

But it says "External sample clock source must be specified for this application."

 

isn't this board(USB-6343) support internal base clock, or do i miss understand about internal base clock, or do i miss something?

 

should i use a external clock for a hardware count?

 

 

0 Kudos
Message 1 of 5
(3,175 Views)
Solution
Accepted by topic author johndoe_student

Just to make a couple things clear:

- Pulses (or more accurately, *edges*) at the default input terminal will cause the count register to increment.   

- Sample clock edges will *sample* the count register value and buffer it.

While other forms of I/O can derive sample clocks from the internal timebases, counter tasks can't.  What you *could* do is use a 3rd counter to generate an output pulse train at 5 kHz and then configure your existing tasks to use that 5 kHz output signal as their external sample clocks.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 5
(3,151 Views)

thanks for your response.

 

may i ask you something more that i wondered?

 

1."counter task cant derive sample clock from the internal timebase" means that, it's not depend on hardware spec or ability, but all of counter task must use external clock? 

 

reason why i am counfused is, i can count without external sample clock. 

johndoe_student_0-1591762302345.png

 

does it work from software-time base, not hardware timing?

 

2.does using hardware timing form an external time base  guarantee a more sophisticated measurement ?

 

3. "What you *could* do is use a 3rd counter to generate an output pulse train at 5 kHz and then configure your existing tasks to use that 5 kHz output signal as their external sample clocks." mean that, should i make a pulse train output and physically connect to another counter input? 

 

count1 : input count for data1

count2 : input count for data2

count3 : input count for sample clock ] --- |

count4 : output pulse train                  ] --- | connect count4 to count3

 

like this? 

 

 

 

 

0 Kudos
Message 3 of 5
(3,141 Views)
Solution
Accepted by topic author johndoe_student

Sometimes counters have to be thought about a little differently than other DAQ I/O.

 

One specific thing that's important to keep in mind is that *counting* is separate from *sampling*.  In an edge counting task, each active edge at the input terminal will increment a count register deep down in the counter circuitry.  It's a hardware circuitry behavior.  Once you start up your task, the count circuitry is enabled and edges will just keep making the count value increment.  (Note: In your examples, because you haven't configured your tasks otherwise, you'll be using default values for the identity of the input terminal and the edge polarity.)

 

*Sampling* is completely separate from that.  When you don't set up a sample clock, each call to DAQmx Read will perform a software-based query of the instantaneous count value and return it to you.  When there *is* an externally supplied sample clock, each active edge of the sample clock will cause the instantaneous count value to be latched and copied into a hardware buffer on the device, and it will soon be delivered to the task buffer in your PC's memory.

 

You also asked:

2. does using hardware timing from an external time base guarantee a more sophisticated measurement ?

I would say that hardware timing with a sample clock *can* give you a more sophisticated measurement, but it will depend on what you're counting and how you intend to react to the count.

    Hardware timing gives you a hardware-precise constant time interval between samples which gives you a *very* much better ability to calculate things like count rate.  But some apps won't need that.

 

To use a 3rd counter to create a sample clock that the other 2 counters use, I'd do something like this:

 

coordinate sampling with external sample clock.png

 

-Kevin P

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 5
(3,106 Views)

Now i understand why my counter sometimes works sometimes doesn't

 

When It works, Software always do the job instead of me...

 

Thanks for your code and I try to learn about counter more deeply through it.

 

Thanks.    

0 Kudos
Message 5 of 5
(3,087 Views)