Author Topic: RTC vs Sec Clock Issue  (Read 4693 times)

MnMike

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
RTC vs Sec Clock Issue
« on: June 07, 2009, 09:08:19 AM »
I have encountered a timing problem with my T100MD-888+ that I have not been able to overcome or fail to understand what's happening.  Hopefully the forum has an answer.

(for explanation DM[1]=2, 1st scan sets I=601, dm600=0)
I use the 1.0 Sec bit to a dcusfn containing:
         IF TIME[2]=0 AND TIME[3]=0 THEN DM[600]=DM[1]
             ELSE DM[600]=DM[600]=DM[1] ENDIF
*(DM[600] will scroll to 7200 then reset to 2 on the hour)*
         IF TIME[2]=0 AND TIME[3]=0 THEN I=I+1
*(1st hr DM[601]=7200, 2nd hr DM[602]=7200, 3rd hr DM[603]
   =7200...etc)*
         If TIMES[1,2,3]=0 THEN I=601 ENDIF
*(At midnite the process begins again at DM[601])*

THE PROBLEM:....Every 3 or 4 hours it will not advance the DM[]
or reset DM[600] to 2......Instead it continues to scroll to 14400
then advances the DM[] and resets to 2 and continues for 3 or 4 more hours normally before it does it again.

In a 24 hour run the DM[601]-DM[624] should look like this:  
7200  7200  7200  7200  7200  7200  7200  7200  7200  7200
7200  7200  7200  7200  7200  7200  7200  7200  7200  7200
7200  7200  7200  7200  

Instead it looks like this:
7200  7200  7200  7200 14400 7200  7200  7200 14400 7200
7200  7200  7200 14400 7200  7200  7200  14400 7200 7200

The Math is still correct but it just does not advance/reset all of the time.......I figure I have a timing issue between the 1 sec clock of the plc and the RTC.

Thanks for taking a look at this!

MnMike

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:RTC vs Sec Clock Issue
« Reply #1 on: June 07, 2009, 11:47:45 PM »
Sounds that there was situation which by the time the custom function is called, the real time clock may have just lapsed from TIME[2] = TIME[2] = 0, so your program have just missed it.

You may want to create another custom function with a faster clock rate to monitor TIME[2] = TIME[3]=0 and if it happens, set a flag either as relay bit or assigning some value to a variable, then in your actual Custom function you will check the flag instead of TIME[2] and TIME[3] directly. This way you won't miss the "right moment".
Email: support@triplc.com
Tel: 1-877-TRI-PLCS