01-31-2018 05:10 PM
Hi.
I am continuously reading a digital input signal in a while loop. My application consists of a normally open switch that when closed the input is a high. I would like to increment a counter to track each time the switch is closed. The problem is since the switch is mechanical, the counter increments more than once before it is actually released. How do I code it so that when I get a high I increment only once and increment another only on the next high and so on?
Thank you in advance
Solved! Go to Solution.
01-31-2018 05:14 PM
Hi.
I am continuously reading a digital input signal in a while loop. My application consists of a normally open switch that when closed the input is a high. I would like to increment a counter to track each time the switch is closed. The problem is since the switch is mechanical, the counter increments more than once before it is actually released. How do I code it so that when I get a high I increment only once and increment another only on the next high and so on?
Thank you in advance
01-31-2018 05:17 PM
You can use this VI to define the direction of crossing you are looking for:
http://zone.ni.com/reference/en-XX/help/371361H-01/ptbypt/boolean_crossing_ptbypt/
01-31-2018 05:18 PM
02-01-2018 05:54 AM
Gregoryj,
Many thanks!!