LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure how long a boolean is high with Thick Count?

Solved!
Go to solution

I acquire the pulse response from a Parallax Distance Sensor, but I I don't know how to measure the number of thicks that this signal is high (the time the input signal is high is proportional to the distance). I'd like to reset the thick count when this signal is low. is this possible? Is there another option?

Thanks...

0 Kudos
Message 1 of 12
(3,156 Views)

What is a "thick"?

0 Kudos
Message 2 of 12
(3,150 Views)

Sorry, I mean Tick, lol

0 Kudos
Message 3 of 12
(3,147 Views)

When the boolean is false, put the tick count into a shift register.  When it is true, don't but it into the shift register but subtract the new tick count from the value in the shift register.

0 Kudos
Message 4 of 12
(3,144 Views)

Here is pretty much what Raven's said. This VI won't continously show the count though. It will only show the total time it was high, once the line goes back to low from high. You will have to adjust some if you want an indicator updating continously. The false case you can't see just has the wires wired straight through.

 

This could also be a bit more complex than it needs to be, I just threw it together quickly with the first thing that came to mind.

 

0 Kudos
Message 5 of 12
(3,131 Views)
Solution
Accepted by topic author vitrion

@for(imstuck) wrote:

You will have to adjust some if you want an indicator updating continously.


Here's a very minimalistic version that updates the timer continuously while the switch is on and holds the last value when the switch is off. Try it!

 

Download All
0 Kudos
Message 6 of 12
(3,116 Views)

I'm so sorry, I think I forgot to say that some data type and functional blocks are not available for FPGA Module. I cannot use double, neither HIgh Resolution Relative Seconds. I can just use the Tick Count Wait and Loop Timer. Also, thank you for replying my message so fast and create the Vi for me.

0 Kudos
Message 7 of 12
(3,098 Views)

I'm so sorry, I think I forgot to say that some data type and functional blocks are not available for FPGA Module. I cannot use double, neither HIgh Resolution Relative Seconds. I can just use the Tick Count Wait and Loop Timer. Also, thank you for replying my message so fast and create the Vi for me.

0 Kudos
Message 8 of 12
(3,096 Views)
You can substitute whatever ticker is available. The rest of the code stays the same.
0 Kudos
Message 9 of 12
(3,095 Views)

I'm so sorry, I think I forgot to say that some data type and functional blocks are not available for FPGA Module. I cannot use double, neither HIgh Resolution Relative Seconds. I can just use the Tick Count Wait and Loop Timer. Also, thank you for replying my message so fast and create the Vi for me.

0 Kudos
Message 10 of 12
(3,088 Views)