From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conting pulses over a time intervale

I am trying to create a program to cont the number of pulses over 5 seconds. i have written a program to the stage where it displays a 1 for every pulse. however I cant figure out a way in which to count these 1's over a period of time (5sec).

The over all idea is to be able to count the number of times there is an interuption/ break in my photo gate within 5 seconds.

The photo gate circuit is designed to give 2.6V when not blocked and a 5V when blocked. 

I cant use the counter on the DAQ because ill will be useing two photogates and the DAQ only has the one counter.  

 

can anyone help me with this?

 

attached is my attemt at a program so far.

0 Kudos
Message 1 of 6
(2,419 Views)

Please post your actual VI so we can play around with it and figure out more easily a possible solution.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,401 Views)

this is the VI .

0 Kudos
Message 3 of 6
(2,399 Views)

First of all, I'd make the DAQ task capture N samples at a specific rate.  For example, set your sample rate to 100Hz (10ms/S) and number of samples to 5sec*100S/sec = 500.  You can then work on that array.  That would eliminate your for loop.

 

My second thought is that you need to count the number to transitions from low to high.  There was a recent thread that talked about this.  I'll have to see if I can find it for you.

 

Edit: Found it: http://http://forums.ni.com/t5/LabVIEW/is-how-can-I-calculate-how-many-transitions-are-inside-an-arr...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(2,394 Views)

hi thanks for the help, however when change the DAQ parrameters to Nsamples an so on. it then diplayes an error =>

 

Error -50405 occurred at DAQmx Control Task.vi:5

Possible reason(s):

No transfer is in progress because the transfer was aborted by the client. The operation could not be completed as specified.

Task Name: _unnamedTask<17>

 

i was wondering if u could shed any light on this. ?

0 Kudos
Message 5 of 6
(2,378 Views)

hi ya i solved the problem the DAQ wasn't properally connected.
thanks for the link . going through it now. looks great thanks

 

0 Kudos
Message 6 of 6
(2,370 Views)