Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read a counter value for two edge separation before counter is stopped by second edge (6602 board)?

Solved!
Go to solution

I am using a 6602 counter timer/board with DAQmx. I am using the two-edge separation counting available through DAQmx. The counting between the two edges works properly, however I do not know how to read the value of the counter during the counting operation (i.e. after the first edge has triggered the start of counting but before the second edge has triggered the end of counting). I am having to wait until the second edge triggers the end of counting before I can get a counter value. I need to be able to access the current value of the count during the counting operation. This was possible in traditional DAQ. How can it be accomplished using DAQmx?

 

0 Kudos
Message 1 of 7
(6,421 Views)

I don't have a 6602 handy, but I think you should be able to use the CI.Count property:

 

Untitled 1 Block Diagram _2013-02-25_14-34-22.png

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 7
(6,420 Views)

John, thank you for your reply.  The CI.Count property does work during the middle of the measurement when doing a 'Count Edges' measurement. Unfortunately, the CI.Count property reads 0 until the measurement is over when I use 'Two Edge Separation' measurement. Is there any other register/property that I can access during Two Edge Separation measurements that will give me the current count value?

 

Thanks and regards,

 

--Ray

 

0 Kudos
Message 3 of 7
(6,417 Views)
Solution
Accepted by greatgrandpadog

Ah shoot--I was afraid that might be the case (for what it's worth, my X series does return intermediate values, but the underlying hardware and driver are quite different)...

 

Do you just need to take a single measurement at a time or are you buffering several two edge separation measurements at once?  If just taking one measurement at a time, you could configure a count edges task using the internal timebase as the source using an arm start trigger (first edge) and a sample clock (second edge) as a workaround.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 7
(6,412 Views)

Thank you, John. I think I have a modified version of your suggestion working. As you suggest, I am now using count edges tasks with arm start triggers instead of two edge separation tasks. However, instead of a sample clock I am using a pause trigger (perhaps for DAQmx on the 6602 they are essentially the same thing?).

 

Thanks again,

 

--Ray

 

0 Kudos
Message 5 of 7
(6,404 Views)

If your second edge toggles indefinitely then I suppose you can just use it as a pause trigger.  As soon as it switches back though the count register will continue to increment.  If you used a sample clock, the value would be latched into a buffer and you could obtain the result with daqmx read (as long as introducing the buffer doesn't create the same problem with the property node that two edge separation introduces).

 

Either way, it sounds like you have a workaround up and running.  Glad I could help!

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 7
(6,399 Views)

John,

 

Your point about the pause trigger approach continuing to increment is well taken. However, my second edge will not be toggling until after I have read the final results from the counter. This approach allows me to dispense with buffering, so I will do that until compelled to do otherwise.

 

--Ray

 

0 Kudos
Message 7 of 7
(6,396 Views)