From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Unexpected value in milliseconds timer

I want to accomplish the following tasks:

 

1) Whenever Boolean value is "True"

 

2) “True” Value will be hold on Boolean for given time interval  (assume  interval is 5000 msec)

 

3) After given interval is over Boolean to be written as False

 

4) I wish to know the completed time in seconds as well as %

 

Completed time (in %)= Time completed *100/ Total Time

 

But code is showing different results

Kindly help me out to complete above mentioned task

0 Kudos
Message 1 of 2
(726 Views)

First, using Tick count (ms) is much like watching at the clock; you want to measure a time span, so wouldn't be better to watch the clock two times and then calculate the difference between the results? You should also consider when your first watch should be put in your code: you mean the total time of what interval precisely?

Second, you probably don't understand data flow: in your vi, calculation of the percent time is not done after the pause interval, rather as soon as the pause started. You should make sure to make the second watch after the Wait function. The easiest way is to use the output of the Wait as your second watch.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 2
(717 Views)