Dear Automation Experts, today we will unveil how to keep your PLC clock accurate, as reliable as a Swiss watch! Are you ready? Let’s embark on this journey of time synchronization.
-
NTP Server Synchronization

// Assume using MC protocol for communication
MOVP H1 D1000 // Set operation code: time synchronization
MOVP K1 D1001 // Select NTP server 1
MOVP K24 D1002 // Set synchronization interval to 24 hours
DMOVP K0 D1003 // Clear synchronization result storage
RST M100 // Reset synchronization completion flag
LD SM412 // Use 0.001 second clock pulse
ANDP M101 // M101 is the trigger condition to start synchronization
EP V // Rising edge detection
SET M100 // Set synchronization in progress flag
FIFOW D1000 K5 U3\
G39 // Send synchronization request to communication module
LD M100 // Check if synchronization is complete
ANI X20 // X20 is the communication completion signal (assumed)
AND= D1003 K0 // Check if synchronization was successful
RST M100 // Reset synchronization in progress flag
SET M102 // Set synchronization success flag
-
GPS Module Synchronization
// Assume GPS data is received via serial port
LD X0 // X0 is the signal for receiving GPS data
MOVP K4 D2000 // Select UTC time data
RST M200 // Reset GPS synchronization flag
BINDA D2001 D2010 // Convert year
BINDA D2002 D2011 // Convert month
BINDA D2003 D2012 // Convert date
BINDA D2004 D2013 // Convert hour
BINDA D2005 D2014 // Convert minute
BINDA D2006 D2015 // Convert second
// Update PLC clock
MOVP D2010 SD210 // Update year
MOVP D2011 SD211 // Update month
MOVP D2012 SD212 // Update date
MOVP D2013 SD213 // Update hour
MOVP D2014 SD220 // Update minute (high 8 bits)
MOVP D2015 SD220 // Update second (low 8 bits)
SET M200 // Set GPS synchronization completion flag
-
Radio Time Signal Receiver
Some regions provide high-precision radio time signals (such as DCF77, WWVB, etc.).
Implementation Steps: a) Install a compatible radio time receiver. b) Connect the receiver to the PLC’s digital input. c) Program the PLC to decode the time signal and update the internal clock.
-
Master-Slave PLC Synchronization
-
HMI or SCADA System Synchronization
-
External Precision Clock Module

-
Manual Synchronization and Calibration
-
Redundant Synchronization: Use a combination of multiple methods, such as primarily using NTP, with GPS as a backup. -
Timezone Handling: Pay attention to timezone conversions, especially in systems across time zones. -
Daylight Saving Time Adjustment: Program automatic handling of daylight saving time changes (if applicable). -
Synchronization Frequency Optimization: Adjust synchronization frequency based on the drift rate of the PLC clock. -
Error Handling: Implement robust error detection and handling mechanisms to prevent erroneous time from contaminating the system. -
Logging: Record each synchronization operation for subsequent analysis and troubleshooting. -
Performance Considerations: Ensure that frequent time synchronization does not significantly impact the PLC’s primary control functions.