Add timer


#1

I need to add a downtimer and I thought it would be so easy but I can’t get it to work, each time I test it, it jumps just over the timer preset value and does not wait there till the timer expires.

I have a downtimer_1 added to numeric variables and I need to start the timer when temperature reaches to 200 Degrees C, and run for 40 Minutes and then stop and go to idle mode, the time needs to be able to change from within display,

how do I set the timer in action block? and make it apear on display so operator can see
time remaining?

thanks
David.


#2

Hi David,

I’m sorry you’re having trouble w/your down timer. I’m not sure I understand what you expected of the timer (perhaps you wanted an uptimer?) but I’ll give you an example of how you might use one for your situation as I understand it.

I have a little sample chart with my downtimer_1 (like yours) and timer_preset (a float). Both could be part of your PAC Display project, one for the user to put in the 40 minutes (or some other value) and one for downtimer_1 which will run down from that 40 minutes (2400 seconds) until it gets to 0 as it counts down.

In my strategy, I loop, check the temperature, and when it’s hot enough I call “Set Down Timer Preset Value” to timer_preset then “Start Timer” on that downtimer_1. I then loop through a condition block, checking if “Timer Expired?” The False exit goes to a delay, and checks again. True goes back to my hot enough check.

I hope that helps!

-OptoMary


#3

Ok I think part of it’s working now, but how do I format the time like HH:MM:SS from a downtimer? in action or opto script?
thanks


#4

Re:

format the time like HH:MM:SS

Funny you should ask, I needed to do something similar just the other day. I wrote some OptoScript to do it, and then put the OptoScript into a subroutine. Both are included here: http://www.opto22.com/community/showthread.php?t=229

Happy OptoScripting!
-OptoMary


#5

Ok that makes sence and looks straight forward, but how do I link or put the timer results into nTotalSeconds in the sobroutines?
the I see it if nTotalSeconds has a number it will convert it to the formated output
or do I see it wrong?


#6

I work my way around it, I copy your code into an optoscript, and just made the variables in my numric/string varibles and it work
like a charm
thank you
it realy help


#7

I just uploaded another little example for those of you turning times into strings:
[URL=“http://www.opto22.com/community/showthread.php?t=229&p=1159&viewfull=1#post1159”]http://www.opto22.com/community/showthread.php?t=229&p=1159&viewfull=1#post1159

-OptoMary