There comes a time setting in the properties of the CPU of Siemens S7-1200 system. When we use it, if there is a relatively high requirement for time, we must give attention to setting the correct parameters, otherwise it will be incorrect.
Pay heed to the choice of time zone. The picture above shows UTC time, ie GMT time, time standard time. If it is Beijing time, please choose UTC+8, 8 hours earlier. If there is daylight saving time, please enable the daylight saving time option and China has cancelled daylight saving time.
After this setting, the CPU goes online and can synchronize the module time to the time the PG/PC. Otherwise it is the factory default date of the PLC.
We can see whether the time and time in the CPU are set correctly by reading the local and system time instructions in the date and time in the extended instruction.
The two instructions are: RD_LOC_T (read local time, ie with time difference) and RD_SYS_T (read system time, ie UTC time)