Author Topic: Timers  (Read 5245 times)

kurniss19

  • Newbie
  • Posts: 9
  • I'm a llama!
    • View Profile
Timers
« on: September 28, 2012, 07:55:46 PM »
How do I create an eight hour timer as a custom function?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Timers
« Reply #1 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.



« Last Edit: September 29, 2012, 06:52:55 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS