This case uses three counters to count time, it uses 24-hour clock as an example.
2. I/O list
|M8013||Oscillates once per second|
The program uses M8013 (oscillation once per second) to provide pulses for the seconds counter C0. When C0 counts up to 60, i.e., for one minute, C0 automatically reset, and triggers C1 to count 1.
When C1 counts up to 60, i.e., for one hour, C1 automatically reset, and triggers C2 to count 1.
When the C2 counts up to 24, C2 automatically reset, 24-hour count is completed. If the user needs a 12-hour clock, just change 24 to 12.