Internet PLC Forum

General => Technical support => Topic started by: kurniss19 on September 28, 2012, 07:55:46 PM

Title: Timers
Post by: kurniss19 on September 28, 2012, 07:55:46 PM
How do I create an eight hour timer as a custom function?
Title: Re:Timers
Post by: support on September 29, 2012, 06:50:00 AM
There are many ways.

1) You can use a 1 second clock pulse and increment a variable (e.g. T) and check if the variable reaches the time (8 hours = 8*3600 = 28800) and then carry out the actions.

2) You can use the current real time clock data and add 8 hours to a target RTC number, then monitor the TIME[1], TIME[2] and TIME[3] until the target time has been reached (taking care of cross over at 23:59). A more convenient way for PLC with firmware >= r72 is to monitor the STATUS(18) variable which gives the RTC data as a single integer in HHMMSS format.

3) you can use a 1 minute clock pulse to trigger a down counter (SV = 8*60 = 480) and when the counter reaches zero the time is up and the counter contact can be used to trigger a custom function.