At the end of this article, there are 55 practical case materials.
Introduction: In practical work, for various reasons, it may be necessary to forcibly stop the operation of the PLC. For example, if the final payment for equipment is not received, the PLC needs to stop running at a specified time. So how do we write this program? Actually, it is quite simple; we just need to use the clock reading instruction.
1. Control Requirements
1. When the PLC reaches June 1, 2024 at 21:01, it should stop running.
2. Program Design
1. Configure the PLC, and set the clock time zone in the PLC‘s properties to Beijing time.

Note:
1). Beijing time is 8 hours ahead of UTC standard time (for example, if the UTC time is 12:00 PM on January 21, then Beijing time is 8:00 PM on January 21).
2). Daylight saving time was stopped in China in 1992, so generally, it does not need to be checked in domestic use. However, when exporting to other countries, it is necessary to pay attention to whether it is needed.
3). Daylight saving time is related to local time and is not related to system time.
2. Create a DB data block to store the current time and the set time of the PLC.

3. Use the time reading instruction to read the current time and compare it with the set time. When the condition is met, stop the PLC operation.

4. Program debugging: Set the stop time to 21:02, and when the time is reached, the PLC stops.


5. Knowledge Expansion
1) The time instructions of the 1200 PLC are divided into two types: system time and local time instructions. What is the difference between them?

System Time: Greenwich (UTC) standard time.
Local Time: The local standard time set according to the time zone of the S7-1200CPU (generally set to Beijing time).
The conversion relationship between Greenwich Mean Time and Beijing Time is that Beijing Time is 8 hours ahead of Greenwich Mean Time.
2) Using time instructions can create other types of programs, such as starting a water pump between 8 and 10 o’clock on a certain day, and starting a fan between 11 and 12 o’clock, etc. This type of project can use clock instructions.
Recently, many friends have asked for case books, saying that reading articles on mobile phones is not very convenient. I have taken the time to organize all 55 practical cases, which are quite typical, including cylinder control programs, alarm programs, program frameworks, motion control program encapsulation, analog control of frequency converters, communication, and other practical cases. If you need them, you can add me on WeChat: biao467524527. If you can’t add me, you can send me a private message.


