News:

  • April 30, 2026, 03:51:27 PM

Login with username, password and session length

Author Topic: How best to set the PLC's clock from an external host (most likely Linux but may  (Read 11541 times)

Barry_Pye

  • Newbie
  • *
  • Posts: 1
How best to set the PLC's clock from an external host (most likely Linux but maybe also VxWorks)?

I've got a few DL440, DL240, DL250, DL05, DL06, and maybe a few other models of Koyo PLC.  Each of these has an onboard clock and I want them all to be reasonably close (within 2 seconds sounds reasonable to me).  Most of these will have ECOM100 cards so that MODBUS can be used for communications.  The others have either an ECOM (K-sequence using Linux SDK) or serial port connection.  (The serial-only PLCs can be ignored if they might complicate the answer.)

We have no problem reading the time/date from V memory locations: V7747, V7766-V7770, V7771-V7774.

After some time, the clock in each of these PLCs drifts away from the value from our NTP servers.  We want to sync the PLC clocks again from a networked host.  Automatically without a human firing up the DirectSoft client.  (Yes, the Calendar dialog box does this in DirectSOFT but that requires a human.  Our time sync needs to run unattended.)  Perhaps we either do this once/hour or maybe watch the drift (on each) and re-sync only when it rises above a threshold.

One way that might work across all these systems uniformly relies on a block of PLC code that is triggered by a control relay.  A remote host (with the correct time) stuffs that time into a few V memory locations (perhaps: year month day hour minute second) reserved by the programmer for this purpose, then sets the control relay.  The PLC code block sees the control relay set and updates the onboard clock and then clears the control relay.

Isn't there a better (more consistent and also not user-designed) way to set the time in each of these PLCs?

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 261
    • Host Engineering, Inc.
Barry,

This is one of them questions that's been kicked around for quite a while. Assuming you have CPUs that support the DATE & TIME instructions (not all of the CPUS from automationdirect.com do),  you can download new DATE and TIME data to the PLC and add ladder code to support remotely triggering the appropriate instruction to reset the DATE &/or TIME using these downloaded values.
Good design costs a lot. Bad design costs even more.