Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Cycle counter

Does anyone know how to program a cycle counter into Labview that will trigger with each rising edge trigger from a digital input? Thanks!
0 Kudos
Message 1 of 4
(3,182 Views)
Hello MWeeks24,

It sounds like you are trying to count the number or rising edges coming in from an digital input. If this is the case, there are a couple of example programs in LabVIEW that show how to do simple edge counting using the counter on your DAQ board. Just open up your example finder in LabVIEW (Help>>Find Examples...) and browse to Hardware Input and Output >> DAQmx >> Counter Measurements >> Count Digital Events.

Hope this helps!
E.Lee
Eric
DE For Life!
0 Kudos
Message 2 of 4
(3,156 Views)
E. Lee,

Thanks for the information. I was more interested in counting the number of times a switch turns on and off. Any ideas?
Thanks.
0 Kudos
Message 3 of 4
(3,151 Views)
You have two options. One is to use the the counter on your DAQ board to detect signal change. The other option is to implement a software counter. If this is not a fast changing signal, then you can do everything in your while loop. Set up your while loop to run at a certain rate, which should be faster than your digital signal. Read the digital input on every iteration and set up a shift register in the while loop. This will make sure that the application stores the last state of the digital input for comparison. Set up another shift register for counting. Then, each time your read the digital input, compare the new state with the previous state. Each time, you detect a change on the digital input, increment the count in the second shift register. Hope this helps.
0 Kudos
Message 4 of 4
(3,140 Views)