LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to reste timer

Solved!
Go to solution

in my program i have placed a timer inside a while loop. Depending on the status of different variales (also inside the loop) timer will start; i.e. if any one of 'n' logics (veriables value) is true timer will start. Now I have to reset the timer if the value of those variales comes under desired limit (means no logic is true) within 1 min.  How to do it?

 

0 Kudos
Message 1 of 7
(4,263 Views)

Hi,

 

What do you mean by "timer inside a while loop" and by resetting it?

A CVI "timer control"?  An "asynch timer", or else?

 

Can you also clarify the "1 minute" requirement?

Is it like a timeout, so that, the variables are allowed to fall below the limit for 1 minute of interval?

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 7
(4,255 Views)

Let me take an example to describe it.

Say there are two variables- temp. and pressure.  The desire rage of each is specified as say, 10<t<50 and 200<p<500. Now this values are taken continuously from a running process. If they go beyond the desired values alarm will on. If no one reset the value within desired range of the variable within 1 min. The system will stop automatically, otherwise it will continue.

Now say, once it goes to critical situation; so timer starts counting to note time of alarm. But by user it is set within range and process comes to normal. But the timer continues. Now some time later if it again goes to beyond range the system stops at that moment as timer was on previously.

How to solve that hurdle? 

0 Kudos
Message 3 of 7
(4,252 Views)

You could have a timer continuously running, whose callback decide what to do depending on measure value, this way (pseudo-code):

 

 

static double    time;

 

double   tn;

 

if (event == EVENT_TIMER_TICK) {

    tn = *(double *)eventData2;   // Time from last timer execution (in sec)


    if (measures_ok) {

        // Reset counter

        time = 0.0;

    }

    else {

        // Accumulate time and see if alarm time expired

        time += tn;

        if (time > 60.0) {

            // Turn-off the equipment

            // Raise alarm

        }

    }

}



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(4,244 Views)
Solution
Accepted by sukhiray

problem is solved. thanks to all for help and response.

by the way, no need of doing any code....just the reset linkis needed to be connected properly depending on requirement.

 

 

0 Kudos
Message 5 of 7
(4,241 Views)

sukhiray wrote:

problem is solved. thanks to all for help and response.

by the way, no need of doing any code....just the reset linkis needed to be connected properly depending on requirement.

 

 


Hi sukhiray,

did you happen to program this application in LabVIEW?

If so, please note that you have posted your question to the CVI board, and of course all reponses you received made reference to such language.

Please make sure in the future you questions are posted to the correct forum: you'll receive the best possible help and will save other person's time and effort in answering in the wrong programming language.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 7
(4,223 Views)
I m sorry friend   :smileysad:.   will be more careful from next time :smileyhappy:
0 Kudos
Message 7 of 7
(4,212 Views)