How-to
Schedule the PLC by day of week from the HMI clock
Short answer
Copy the panel's weekday system tag into a PLC tag with an event that fires on a change of value, then run the schedule's weekday comparisons on the received text. The adjustable panel clock becomes the only time source, so a PLC left powered down over midnight can no longer miss the weekday transition and drift the schedule.
On this page
- Why the PLC weekday counter drifts
- Take the weekday from the panel's system tag
- Copy it into the PLC when it changes
- Build the schedule on the received value
- Worked example: a Monday-to-Friday output from noon to 1 pm
- Test the clock edit and the power cut
- Fix a schedule that has already drifted
- Questions asked
The weekday you need is already in the panel. The HMI keeps a system tag for day of week, and one Event Manager action can copy it into a PLC tag every time it changes. Point the schedule's weekday comparisons at that received value and the drift disappears. A weekday counter inside the PLC misses its midnight transition whenever the PLC is powered down across it, while the panel's value always comes fresh from the clock your operator adjusts in setup mode. The steps below wire the copy event, handle the text on the PLC side, work a Monday-to-Friday schedule end to end, and finish with the two tests that prove the week stays in step: a clock edit and a power cut across midnight.
Why the PLC weekday counter drifts #
Your present logic steps a weekday register at midnight, and it is right up until the machine is off when the day rolls over. That midnight never happens as far as the counter is concerned, so from the next morning every branch of the schedule runs a day late until somebody corrects it by hand. On an OEM machine the customer owns the power switch, so it is a matter of when, not whether.
Deriving the weekday from the date registers is the other route, and the math is sound, but you take on month lengths and leap-year handling in ladder logic to get there.
You already chose the better base when you fed the panel's adjustable clock into PLC registers. What the panel seemed not to offer was the weekday, and it does have one, as a system tag, one copy event away. If the clock transfer itself still needs building, start with setting HMI clock time from a PC and the PLC daily, then come back for the weekday.
Take the weekday from the panel's system tag #
The tag is SYS Day Week, the C-More system tag for day of week, listed with the clock values in its system tag help. It holds the current weekday as a three-character ASCII string, text rather than a number from 1 to 7, and the exact spelling is whatever your panel shows, so read it live once before building comparisons on it.
Two checks before you write the event. The destination tag in the Click must be able to hold three characters in the representation your driver writes, or the value arrives truncated or mangled. And treat the tag as text end to end: a PLC comparison that expects an integer weekday will read those three characters as something, but never as the day you meant.
Other panels carry more of this job inside their own schedule objects; the walkthrough of weekday and time control in a PLC110 schedule shows how far a panel can take a schedule on its own.
Copy it into the PLC when it changes #
- In the HMI project, choose the Click tag that will hold the weekday text.
- Open the Event Manager and create an event whose trigger is a change of value on SYS Day Week.
- Give the event a single Tag Copy action that copies SYS Day Week into that destination tag.
- Send the project to the panel by its normal download procedure and leave it running.
- Watch the destination register online in the PLC. You want three printable characters; a blank, a truncated pair or a strange number means the destination type or mapping is wrong, and that must be fixed before the schedule logic is touched.
Because the trigger is the value change, the PLC receives the weekday at the moment it becomes true. There is no midnight rung left in the PLC to miss.
Build the schedule on the received value #
Compare as text. One rung per weekday, received text equal to the spelling you read live, gives every branch a clean input. If the rest of the program wants a day number, add a mapping you own: one comparison per day that moves a number you defined into an integer tag, all seven branches tested before release. The panel publishes no numbering, so a day number means only what your mapping says.
Keep the hour and minute permissives exactly as they are. The panel already feeds those registers, so window logic and weekday now come from one clock, and the two can no longer disagree. Change only the weekday input; a wrong mapping then stays easy to isolate from the time logic.
Panels that expose the weekday only as display text force this same text-to-logic step; the guide to mapping the current weekday on an S4TH panel works that conversion in detail.
Worked example: a Monday-to-Friday output from noon to 1 pm #
Inputs #
- Weekday source: SYS Day Week, the panel's system tag, three ASCII characters (panel system tag documentation).
- Time of day: the hour and minute registers this project already copies from the panel clock (existing setup).
- Window: 12:00 to 13:00 panel time (the schedule the OEM case asks for: an output that runs over the lunch hour on workdays).
- Enabled days: Monday through Friday, 5 of the 7 weekdays (the application requirement).
The rule #
The output is ON only when both are true: the received weekday text is one of the five workday strings, and the panel time of day is at or after 12:00 and before 13:00.
Arithmetic #
- Enabled weekdays: Monday, Tuesday, Wednesday, Thursday, Friday = 5 of 7. Inhibited: 7 - 5 = 2, Saturday and Sunday.
- Daily run time: 13:00 - 12:00 = 1 h.
- Weekly run time: 5 days x 1 h/day = 5 h of scheduled run per calendar week.
Result and decision #
A correct build shows exactly 5 enabled weekday comparisons, a 1 h window, and 5 h of scheduled run per week. Count the weekday comparisons your build accepts: for this schedule the number must be exactly 5. Four means one workday string misses, almost always a spelling mismatch; six means a weekend string also matches. Then read the tag after a PLC power cycle across midnight: if it holds the previous day's text while the panel shows the new day, the copy event fired into a dead link, so add a supported re-sync, a rewrite on communication recovery or a short periodic refresh, and retest. If it matches the panel, the single on-change event is enough.
Test the clock edit and the power cut #
Record three values first: the date on the panel, the weekday the panel reports, and the text sitting in the PLC destination.
In setup mode, move the panel clock to a date with a different weekday. The PLC tag should follow within the link's normal update time, because the change event sees the value move; if it only follows after a panel restart, the trigger is on the wrong tag. Restore the production date and confirm the schedule selects the intended branch.
Then the test the old counter could never pass: power the PLC down across a midnight transition, bring it back, and read the tag. It should hold the current weekday. If it still holds yesterday's text, add the re-sync from the worked example and run the test again.
Run both tests with the controlled outputs in a safe state, so a wrong weekday branch cannot start anything while you are proving the logic.
Leave the machine in this state: panel weekday, PLC tag and active schedule branch agree, and the clock reads the correct production time.
Fix a schedule that has already drifted #
Hand-writing the PLC's weekday value back to the truth puts today's schedule straight, but it leaves the missed-midnight failure mode in place. The repair is the on-change copy with re-sync after outages, and it stays in the build after you leave the site. Use the table to tell a quick restore from a repair.
| What you see | Check first | Action |
|---|---|---|
| Panel weekday right, PLC tag stale | Event trigger, destination tag, link status | Correct the copy mapping and add the re-sync |
| PLC tag holds text, wrong branch runs | Text comparisons or the day mapping | Align comparisons with the spelling observed live, or fix the mapping |
| Panel weekday itself wrong | Panel clock and date | Correct the panel clock in setup mode before trusting anything downstream |
After any fix, rerun the clock-edit and power-cut tests before the machine returns to production.
Questions asked
Can I get a numeric day of week instead of comparing text?
Yes, with a mapping you own. Keep the on-change copy as the source, then add one text comparison per day that moves a number you defined into an integer tag, 1 for Monday through 7 for Sunday for instance, and build the schedule on that integer. The panel never publishes a numbering, so the values mean only what your mapping says. Bench-test all seven branches before the machine ships.
What if my HMI has no weekday system tag?
Derive it from the date the panel already sends. Pick an anchor date whose weekday you know, count the days from that anchor to today, and take the remainder after dividing by seven; the remainder maps one-to-one to the days of the week. Month lengths and leap years are already inside that day count, so no calendar tables are needed. This is the calculation you were otherwise about to write in ladder logic.
Does daylight saving time break this schedule?
The weekday survives it: shifting the clock by an hour never changes the day name, so the copy event and the text comparisons keep working. The time-of-day window is what moves. If operators set the panel clock by hand and nobody corrects it in spring, a noon-to-1 pm window fires an hour off until the clock is fixed. Correct the panel clock, or enable its automatic time adjustment if it has one, and retest the window.
Why not just use the PLC's own real-time clock for the weekday?
You could: the Click holds its own clock in the SD19 to SD26 system registers, and weekday logic on top of it is common. It is also the design that drifts in this application, because an OEM customer powers the machine off and the weekday then reflects whatever the PLC last counted rather than the clock the operator adjusts at the panel. Keep one time source and send every calendar value, weekday included, from it.
How often does the copy event actually fire?
Once per day: the panel's weekday value changes when its clock crosses midnight, so the on-change event fires seven times in a normal week, plus whenever a clock edit changes the date. That is light enough to ignore on the link and frequent enough to catch a stale tag within a day, as long as panel and PLC are communicating at the transition. If outages are common on this machine, add a periodic or on-reconnect rewrite as well.