Timer in citect?

Use TimeCurrent()
TimeCurrent() is the number of second since 01/01/1970
At start of your process save the TimeCurrent() to a variable.
At the end of your process subtract variable from TimeCurrent() and then you have the time between start and stop in seconds.
 
I tried to do it of this way:

INT ARRANCADO=1 THEN
TIMESTART=TimeCurrent();
END

INT PARADO=1 THEN
TIMEEND=TimeCurrent();
END

TIMEPROCESS=TIMEEND-TIMESTART;


The variables: TIMESTART, TIMEEND, TIMEPROCESS, are STRING, and the compilator give me an error.

I read that for to do this, I can use the function TimestampDifference(), but I tried it too and I can't do it!

ANYONE KNOWS TO USE THIS FUNCTION? THANKS!
 
TIMESTART, TIMEEND, TIMEPROCESS must be integers as Timecurrent() returns a number in seconds.

I did it, I took the variables (TSTART, TEND,TIMEPROCESS) as INT variable, and the debugger doesn't send to me any error, but there are some problems because I show TIMEPROCESS and it doesn't show anything!

I read that the function TimeCurrent() returns a time/date variable, perhaps it will be the problem, as you told me that the function returns an Integer.

I attached to you a capture.

Thanks,

Best Regards!
AA.jpg
 
I tried to do this, but when it must show the differente or substraction between TEND and TSTAR, it give me 00.00.00!!

TEN and TSTA are two new STRING variables, the others remain be INT.

I attached you.a.jpg

b.jpg
 
Hi Greg Fowlds,

I'm very grateful for your help, now it works good!

I've got a new question for you that I'm not unable to find the solution:
I want to show the previous variable,TIEMPOPROCESO(string), in a report, and I added to the report :

TIME: {TIEMPOPROCESO}

but it doesn't show anything. So, I tried to show other string variables and they failed too!
 

Similar Topics

Is there a way to created a countdown timer that would display when a trigger becomes true and go away when the timer reaches zero?
Replies
5
Views
3,423
Can anyone help me with making a display timer such as a stop watch display that starts from a button (and counts up) perhaps using timer(). My...
Replies
1
Views
1,385
Is it possible to automatic set a output high during a period of time. For example: When its 10pm i want to set a output high , and when its 2am...
Replies
4
Views
2,636
When I try to use a Timer with a Mitsubishi Q series PLC and Citect SCADA it wont compile it gives Bad IO Device Variable Have used this to view...
Replies
2
Views
2,155
Is there a timer function in Citect or CiCode ? I would like to do the following: Press a button have a timer start. When the timer is...
Replies
4
Views
5,058
Back
Top Bottom