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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital pin transition counting

I am desperately in need of a simple alogorithm to keep count of all transitions from low-to-high on a digital input pin. My program inputs the desired number of transitions and when the count is exceeded then the program terminates.

 

thanks!!

Lawrob

0 Kudos
Message 1 of 3
(5,309 Views)

Assuming you are using LabVIEW, you just keep the count and the current state of the digital input in shift registers.  When you detect the change, increment the count.

 

Another alternative is to use a counter.  Read the count every so often.  I don't remember if DAQmx resets the count on a read.  If it does, just add to the count that is stored in a shift register.

 

What equipment are you using?  What language?


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 3
(5,279 Views)

Thanks crossrulz,

 

do you have sample algorithm that highlighs what you just recommended?

 

Thanks!

Lawrob

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