Overview: S7-1200 and HMI Time Synchronization Problem
Time synchronization between a SIMATIC S7-1200 CPU and a SIMATIC HMI (KTP400 Basic, KTP700 Basic, KTP1200 Basic, or any Comfort Panel) is one of the most common commissioning tasks in TIA Portal. The challenge becomes visible the moment you try to use the official Time Synchronization with an HMI Operator Panel and a SIMATIC PLC guide: the S7-1200 firmware exposes only the DTL data type for time-of-day, while the area pointer described in the guide uses the legacy DATE_AND_TIME (8-byte) format of the S7-300/400 and S7-1500. The two are not byte-compatible, so the standard "PLC is the time master via area pointer" example fails until the DTL structure is mapped correctly.
This reference covers the three practical paths to a working time-of-day clock in an S7-1200 / WinCC Advanced V18 environment:
- PLC as NTP client – the CPU itself fetches time from an NTP server on the PROFINET network.
- PLC as time master, HMI as slave – the S7-1200 broadcasts the time through the time-of-day area pointer and the HMI simply displays it.
- HMI as time master, PLC as slave – the panel (Comfort or Basic) pushes its time down into the CPU. This is the mode covered by the Siemens guide, entry 109482675.
Each path has a different impact on the DiagBuffer of the S7-1200, the Diagnostic view, and the automatic summer/winter time changeover (DST) behavior.
Prerequisites and Software Versions
Verified on the following stack, which is the most common configuration reported in the field:
| Component | Version / Notes |
|---|---|
| TIA Portal | V18 (V18 Update 1 recommended for S7-1200 G2 CPUs) |
| STEP 7 | V18 in TIA Portal |
| WinCC Advanced (ES) | V18 |
| S7-1200 CPU firmware | V4.2 to V4.7 (S7-1200 classic); V1.0+ for S7-1200 G2 |
| HMI panel | KTP400/700/1200 Basic or KTP400/700/900/1200 Comfort |
| WinCC Runtime | WinCC RT Advanced V18, build 18.0.0.x |
| Connection | PROFINET (Ethernet/IP), single subnet, no router between PLC and panel |
Method 1: S7-1200 as NTP Client (Recommended for Plant Floor)
On a real machine line the most robust approach is to let the S7-1200 synchronize itself to an NTP server on the plant network. Once the CPU is time-correct, every HMI attached to it can be a slave and the time-of-day field on the panel becomes consistent with the rest of the line.
Five official methods are documented in the SIMATIC S7-1200 manual collection for setting the time-of-day clock: NTP server, STEP 7 online, user program, HMI panel, and the S7-1200 web server. The NTP path is preferred because it survives CPU restart and does not require an HMI to be online.
Configuration steps in TIA Portal V18:
- Open the S7-1200 device view and select the PROFINET interface (X1).
- In Properties > Time synchronization enable "Synchronize with NTP server".
- Add up to four NTP servers in priority order (primary, secondary, tertiary, quaternary). Use IP addresses, not DNS hostnames – the S7-1200 NTP client does not perform DNS resolution.
- Set the synchronization interval. Default is 10 s, minimum is 1 s. For shop-floor installations, 60 s or 600 s is typical.
- Set the time zone of the PLC station (UTC offset, including DST flag).
- Compile and download the hardware configuration to the CPU.
After download, the CPU will issue NTP requests in UDP port 123. The clock status is visible in Online & Diagnostics > Time > Time-of-day clock. If no NTP server is reachable, the S7-1200 will fall back to the internal RTC; the time drifts by approximately ±7 s per day (typical XTAL accuracy) but production continues.
With the PLC clock now correct, configure the HMI as a time slave:
- In the HMI device configuration, open Properties > Time settings.
- Set the Time source for the panel to PLC.
- Enable Automatic summer/winter time changeover if the CPU is configured for the same DST rules (Central Europe, USA, etc.).
No area pointer is required for slave mode in TIA Portal V18. The HMI runtime reads the PLC clock on every screen change and on a 10 s poll.
Method 2: PLC as Time Master, HMI as Slave (Area Pointer)
This is the "classical" Siemens pattern and is described in the official Time synchronization FAQ 69864408 under Mode 2. The PLC writes the current time into a data block, and the HMI reads that data block through a Date/Time area pointer.
The block diagram looks like this:
S7-1200 (time master) HMI (time slave) +----------------------+ +----------------------+ | RD_SYS_T -> DBx | area ptr | WinCC RT reads | | (DTL, 12 bytes) | --------> | DTL structure | +----------------------+ 12 bytes +----------------------+
Creating the DTL data block in STEP 7 V18
- Add a new global DB (Add new block > Data block) and call it
TimeSync_DB. - Disable Optimized block access if you want the area pointer to address the tag by absolute byte offset. With S7-1200 and WinCC RT Advanced, both optimized and non-optimized are supported, but the legacy documentation assumes the non-optimized layout.
- Create a tag of type
DTLnamedPLC_Time. - Create a second tag of type
DTLnamedLocal_Time.
RD_SYS_T instruction returns system time (UTC, no DST applied). The local time tag is computed by the program from system time plus the configured time zone. The HMI needs the local-time tag for display.STEP 7 program: write system time into the DTL tag
OB1 (cyclic, priority 1):
// Read system time (UTC, no DST) into the DTL tag
RD_SYS_T(RETVAL := _retcode1, OUT := "TimeSync_DB".PLC_Time);
// Convert UTC to local time. Adjust nOffsetSec for the time zone + DST.
// Example: Central Europe (CET/CEST) offset 3600 s (CET) or 7200 s (CEST).
T_CONV(IN := "TimeSync_DB".PLC_Time, // optional, many firmware levels use a different FB
...);
For S7-1200 firmware V4.2 and later, the simpler path is to use the system clock directly. The CPU's Time of day property already lets you set the UTC offset and the DST rule, so the value returned by RD_SYS_T when read by an HMI is local time when the HMI is configured to read the PLC's local time.
Wiring the area pointer in the HMI
- In the HMI project tree, expand Connections and double-click the S7-1200 connection.
- Switch to the Area pointers tab.
- Enable Date/time PLC.
- Set the PLC tag to
TimeSync_DB.PLC_Time(DTL, 12 bytes). - Compile the HMI project and download to the panel.
DATE_AND_TIME type is only 8 bytes and is not directly compatible; the S7-1200 DTL matches the 12-byte layout that WinCC RT Advanced already supports for the S7-1500. Once the area pointer is configured with a 12-byte DTL source, the panel updates its time-of-day field within 10 s.Method 3: HMI as Time Master, PLC as Slave (Comfort Panel Slave Mode)
When the panel is the master and the S7-1200 is the slave, the HMI pushes the time down to the CPU on a configurable interval. This is the path documented in the Siemens Time Synchronization FAQ 69864408 and entry 109482675.
For a Comfort Panel, the configuration is simple:
- Open the HMI device configuration.
- Go to Properties > Time settings.
- Set Time source for the panel to Local (the panel's internal RTC).
- Enable Synchronize PLC with panel time.
- Set the synchronization interval (default 10 s).
- Enable Automatic summer/winter time changeover if the local time zone uses DST.
The runtime on the Comfort Panel uses the system function SetPLCTime to write its time into a configurable DB on the CPU. The DB layout must match the 12-byte DTL structure, but the panel handles the conversion automatically; the integrator only needs to provide a DTL tag.
For a Basic Panel (KTP400 Basic, KTP700 Basic, KTP1200 Basic), there is no native slave-mode that handles DST. Basic Panels do not have an internal summer/winter time changeover. The recommended workaround is to use Method 2 (PLC as master) and let the S7-1200 handle DST, or push the panel's local time via area pointer and accept a one-hour offset in the S7-1200 diagnostic buffer.
Why the S7-1200 Rejects DATE_AND_TIME
The S7-300/400 and S7-1500 support the 8-byte DATE_AND_TIME type (BCD-encoded). The S7-1200 supports only the 12-byte DTL type, which is binary-encoded and includes nanosecond resolution plus a weekday field. The two encodings are not interchangeable byte-for-byte, so a tag declared as DATE_AND_TIME on the S7-1500 cannot be pasted into an S7-1200 DB.
WinCC RT Advanced, however, does not care about the symbolic type name; it reads 12 bytes from the configured DB address. The internal decode in WinCC RT matches the DTL layout. The only requirement is that the area pointer points to a 12-byte contiguous tag of data type DTL. This is the root cause of the symptom "Mode 1 does not work, area pointer does not work": the original guide assumed an S7-1500 with DATE_AND_TIME, and copying the example project onto an S7-1200 silently changed the data type to DTL at compile time, breaking the example.
The Siemens knowledge base entry 109813307 documents the DTL layout and the available system functions in detail.
DTL Variable Structure Reference
| Byte offset | Length | Field | Range / Notes |
|---|---|---|---|
| 0 | 2 | YEAR | 1970 – 2554 (UINT) |
| 2 | 1 | MONTH | 1 – 12 (USINT) |
| 3 | 1 | DAY | 1 – 31 (USINT) |
| 4 | 1 | HOUR | 0 – 23 (USINT) |
| 5 | 1 | MINUTE | 0 – 59 (USINT) |
| 6 | 1 | SECOND | 0 – 59 (USINT) |
| 7 | 4 | NANOSECOND | 0 – 999 999 999 (UDINT) |
| 11 | 1 | WEEKDAY | 1 = Sunday, 7 = Saturday (USINT) |
All values are big-endian. WinCC RT Advanced reads the structure in this exact byte order from the area pointer address.
Comparing the Three Methods
| Criterion | NTP on PLC | PLC master + HMI slave | HMI master + PLC slave |
|---|---|---|---|
| Clock source | Plant NTP server | S7-1200 internal RTC | Comfort Panel RTC |
| DST handled by | CPU configuration | CPU configuration | Comfort Panel configuration |
| Survives CPU restart | Yes, if NTP reachable | Yes (RTC battery-backed) | Yes (panel RTC battery-backed) |
| CPU restart without HMI online | OK | OK, HMI catches up | CPU clock drifts if HMI offline |
| Supports Basic Panel | Yes | Yes (recommended for Basic) | No (no DST on Basic) |
| Area pointer required | No | Yes (12-byte DTL) | Yes (12-byte DTL) |
| Network requirement | UDP/123 to NTP server | PROFINET only | PROFINET only |
| Diagnostic buffer UTC? | Yes (system time) | Yes (system time) | Yes (system time, written via WR_SYS_T) |
| Commissioning effort | Low | Medium (DB + area pointer) | Low (panel-side only) |
Commissioning Procedure (PLC Master, HMI Slave, Area Pointer)
- Create the
TimeSync_DBglobal data block with the two DTL tags as described above. - In OB1 call
RD_SYS_Twith thePLC_Timetag asOUT. - Compile the S7-1200 project and download to the CPU.
- In the HMI connection, enable the Date/time PLC area pointer and point it to
TimeSync_DB.PLC_Time. - Compile the HMI project and download the RT to the panel.
- Verify in Online & Diagnostics > Time on the CPU that the system time is correct.
- Verify on the HMI: open the system info screen, the date and time should match the CPU within 10 s.
- Set the CPU to STOP/RUN to confirm the HMI catches up after a restart.
Verification Checklist
| Check | Pass criterion |
|---|---|
| PLC clock in online diagnostics | Matches Windows reference within 1 s |
| HMI clock on the system info screen | Matches PLC clock within 10 s |
| PLC clock after power cycle | Within 1 s of NTP / panel reference after one sync cycle |
| Timestamp in PLC diagnostic buffer | UTC, not local time, by design |
| Timestamp in HMI alarm history | Local time, DST applied |
| DST transition (last Sunday of March / October) | Time jumps by ±1 h automatically |
Troubleshooting Matrix
| Symptom | Likely cause | Fix |
|---|---|---|
| Mode 1 (HMI as slave) does nothing in PLCSIM + RT simulation | Both simulators pull from Windows clock; no master/slave role is negotiated | Use a physical PLC, or use a physical HMI with the simulated PLC |
| Area pointer area greyed out in the HMI connection | HMI tag is not declared as DTL, or DB is optimized and area pointer does not support it | Change tag type to DTL, or disable optimized access on the DB |
| Compile error "incompatible data type DATE_AND_TIME" | Example project was written for S7-1500 | Change the tag to DTL (12 bytes) and rebuild |
| HMI shows --:-- or 00:00 | Area pointer is enabled but the DB tag is not updated by RD_SYS_T | Insert RD_SYS_T in OB1 and verify the tag value online |
| Time correct, but 1 h offset after DST change | DST rule mismatch between PLC and HMI | Set identical DST rules (no DST, EU, USA) on both devices |
| Time correct on HMI, but PLC diagnostic buffer drifts | PLC is slave, HMI is master, Basic Panel cannot apply DST | Switch to PLC-as-master (Method 2) or use NTP on the PLC (Method 1) |
| CPU time loses 5–10 s per day | No NTP, no battery, RTC drift | Enable NTP, replace the RTC battery on the signal board |
| Area pointer writes 8 bytes instead of 12 | DB tag was declared as DATE_AND_TIME by mistake | Re-declare as DTL, recompile, redownload |
| NTP sync fails (CPU time freezes) | UDP/123 blocked by firewall, wrong NTP IP | Open port 123 outbound, verify NTP server reachability with Wireshark |
| Basic Panel slave mode rejects DST setting | Basic Panels do not have a DST configuration page | Switch to Comfort Panel, or use Method 2 with PLC handling DST |
Field Notes and Safety Caveats
- The S7-1200 firmware writes system time (UTC) into the diagnostic buffer and into any
DTLtag read withRD_SYS_T. The HMI is responsible for converting UTC to local time for display. - If the application timestamps audit events (FDA 21 CFR Part 11, GAMP 5), use NTP with an auditable time source and configure the S7-1200 to log both the UTC and the local-time tag.
- Do not write the HMI's local time into a DTL tag and then feed it back to
WR_SYS_T; this causes the system time to drift by the DST offset on every panel restart. - For redundant HMI setups (one Comfort Panel plus one Basic Panel), the comfort panel can be the master and the basic panel can be a slave, but the basic panel will display the master panel's local time without DST adjustment. Treat the displayed time on the basic panel as UTC plus a fixed offset in this case.
- When migrating an S7-1500 project to an S7-1200, every
DATE_AND_TIMEtag referenced by a WinCC area pointer must be re-declared asDTL, and the consuming FB logic must useRD_SYS_T/WR_SYS_Tinstead of the S7-1500DATE_AND_TIMEhelpers.
FAQ
Why does Mode 1 of the Siemens time sync guide fail on an S7-1200?
Mode 1 expects the S7-1200 to expose a DATE_AND_TIME tag, which the CPU does not support. The S7-1200 exposes only the 12-byte DTL type. Re-declare the tag as DTL in the DB, recompile, and Mode 1 works on a physical PLC and HMI pair.
Can I synchronize S7-1200 and HMI in PLCSIM plus WinCC RT simulation?
No. PLCSIM and the HMI RT simulator both read the host Windows clock and do not negotiate a master/slave relationship. Slave mode and area-pointer mode appear to do nothing. Use a physical CPU or a physical panel for verification.
Does a Basic Panel support the same time sync as a Comfort Panel?
Basic Panels support area-pointer synchronization but have no internal DST configuration. Comfort Panels support both area-pointer and slave mode, with full DST handling. For installations with Basic Panels, use NTP on the PLC and configure the panel as a slave to the PLC's local time.
What is the difference between DTL and DATE_AND_TIME?
DTL is 12 bytes, binary-encoded, includes nanoseconds and weekday, and is the only time type on the S7-1200. DATE_AND_TIME is 8 bytes, BCD-encoded, used on S7-300/400 and S7-1500. WinCC RT Advanced reads 12 bytes from the area pointer, so the S7-1200 DTL matches what the panel expects.
What is the most robust setup for a plant floor with multiple panels and one S7-1200?
Configure the S7-1200 as an NTP client to a plant NTP server, set the time zone and DST rule on the CPU, then configure every HMI as a slave. No area pointer is required, DST is applied consistently, and the diagnostic buffer is UTC-stamped as required by most quality systems.