Overview: The Biweekly Timer Problem on LOGO!
A biweekly (alternating-week) timer is one of the most common scheduling requests on the Siemens LOGO! 8 platform (6ED1052-xxx08-0BA1 / -0BA2) programmed in LOGO!Soft Comfort V8.x and V9.x. The classic requirement is:
- Week A (odd): output ON from Thursday 19:00 through Monday 07:00 of the following week.
- Week B (even): output ON from Friday 07:00 through Monday 07:00 of the following week.
- The cycle then repeats indefinitely.
- Monday 07:00 behavior must remain ON every Monday, regardless of which week the controller is in.
- A 2-week rhythm where Tuesday (and other mid-week days) is ON for one week and OFF the next must be respected.
This pattern cannot be expressed with a single weekly timer because the LOGO! Weekly timer (function block class B6, B007) only supports one recurring on/off window per week. It requires at least one Weekly Timer (or Yearly Timer) feeding an AND/OR gating structure that is then qualified by a Up/Down counter clocked by a once-per-cycle edge.
Prerequisites
| Item | Specification |
|---|---|
| LOGO! base module | LOGO! 8 (6ED1052-1xxx08-0BA1 minimum); RTC must be present (0BA2 strongly recommended) |
| Backup battery | CR2032 or BR2032 installed in BM (sets BM menu: Battery: Install) |
| Programming software | LOGO!Soft Comfort V8.1 or later (V9.0 for 0BA8 firmware 1.81.x and newer features) |
| Firmware on BM | FS: 04 or later recommended for stable RTC; check via LOGO! > Diagnostics > FW Version |
| Power supply | Stable 24 V DC or 115/230 V AC; UPS strongly recommended (see above) |
| I/O used | 1 digital output (Q1 typical); no inputs required for pure time logic |
Confirm the BM clock is running and on the correct weekday before commissioning. Navigate LOGO! menu → Setup → Date/Time and verify Mo Tu We Th Fr Sa Su index and 24-hour time. If the BM clock is wrong the weekly timers will mis-trigger by the same offset.
LOGO! Time Block Inventory
LOGO!Soft Comfort provides four time-related blocks that are relevant to biweekly scheduling:
| Block | Function | Use here |
|---|---|---|
| Weekly Timer (B007) | 3 on-times / 3 off-times per channel, day-of-week mask, hh:mm resolution | Primary base scheduler |
| Yearly Timer (B008 / B009) | Date-range window with optional year-on/off | Optional for holidays / seasonal overrides |
| Astronomical Timer (B058 in V8.3+) | Sunrise/sunset driven | Not used for this pattern |
| Stopwatch / Elapsed-time counter | Edge-to-edge timing | Optional debouncing of week edge |
The Weekly Timer block (B007) accepts up to three ON-cam and three OFF-cam entries. Each entry has its own Day-of-week mask (bit-pattern Mon..Sun). For our base pattern, define:
Weekly Timer Channel A (Week-A schedule)
| Cam | On-time | Off-time | Day mask | Meaning |
|---|---|---|---|---|
| 1 | 19:00 | 23:59 | Th | Thursday evening start |
| 2 | 00:00 | 07:00 | Fr, Sa, Su, Mo | All-day Friday through Monday morning |
| 3 | 00:00 | 19:00 | Th | (Reserved / unused) |
Weekly Timer Channel B (Week-B schedule)
| Cam | On-time | Off-time | Day mask | Meaning |
|---|---|---|---|---|
| 1 | 07:00 | 23:59 | Fr | Friday morning start |
| 2 | 00:00 | 23:59 | Sa, Su | All weekend |
| 3 | 00:00 | 07:00 | Mo | Monday morning close |
These two channels give you two independent weekly patterns. The next step is to alternate them every seven days using a counter.
Biweekly Alternation: Counter-Based Week Selector
The cleanest way to toggle a 2-week rhythm on a LOGO! 8 is to use an Up/Down counter (function block B003) clocked by a single rising edge per ISO week. A single weekly timer configured with a 1-minute ON pulse at Sunday 23:59 provides the clock source. The counter threshold On = 1, Off = 0 produces a clean 0/1/0/1 output that perfectly aligns with Week-A / Week-B selection.
Clock generator (pulses once per week)
- Insert a Weekly Timer (B007) named
WT_CLK. - Cam 1: On
23:59, Off23:59, Day mask Su only. - Insert a Pulse Generator (B002, optional) with PT = 1 s to widen the edge to a reliable counter input.
Week selector counter
- Insert an Up/Down counter (B003) named
CNT_WEEKwith:- On threshold = 1
- Off threshold = 0
- Count direction = count up
- Reset input = M8 (cold-start flag) OR a manual reset via digital input I1
- Wire the rising edge of
WT_CLKtoCnt. - Output
QofCNT_WEEKis 0 in Week-A and 1 in Week-B (assuming initial state 0 after power-up).
Selecting Week-A vs Week-B Output
Use a 2-to-1 multiplexer pattern with two AND gates and one OR gate:
WT_A ----+---[ AND ]---+
| |
~CNT_WEEK -----+ +---[ OR ]--- Q1 (final output)
| |
WT_B ----+---[ AND ]---+
|
CNT_WEEK -----+
Where ~CNT_WEEK is the inverted output (use NOT block B004). The final OR drives the LOGO! output Q1. This guarantees that:
- When the counter is 0, only WT_A is allowed to pass.
- When the counter is 1, only WT_B is allowed to pass.
- Either channel can independently switch OFF in the middle of its own week without affecting the other week.
Forcing Monday ON Every Week
The base requirement that Monday 07:00 must turn the output OFF (end of cycle) is handled implicitly by both weekly timers: WT_A cam 2 ends at Monday 07:00, and WT-B cam 3 ends at Monday 07:00. To instead force Monday to be always ON regardless of which week the controller is in, OR a third weekly timer onto the final OR gate:
| Cam | On-time | Off-time | Day mask | Behavior |
|---|---|---|---|---|
| 1 | 00:00 | 23:59 | Mo | All-day Monday override |
This block is gated by a direct feed (not the counter), so Monday always wins. If you need Monday to be ON only after the weekend cycle, then leave the Monday cam inside WT_A and WT-B as drawn above; do not add a third block.
Alternate Parity Derivation (No UPS, No Battery)
If the application must self-correct the week parity on every cold start (e.g., unreliable power), replace the once-per-week counter clock with a day-of-year counter whose modulus is 14:
- Daily pulse generator: Weekly Timer with cam at 00:00:01 every day → pulse relay to debounce.
- Up/Down counter B003, threshold On=14, Off=0, count up.
- When the counter reaches 14, pulse a reset pulse (B002) with PT=1 cycle to clear it back to 0 and emit a single edge.
- Wire that edge into a second B003 configured as a toggle (threshold On=1, Off=0). Its Q is the week parity.
This pattern is self-healing after a power loss of any duration because the parity is regenerated from elapsed days, not from a non-volatile event log. The trade-off is that you lose the ability to manually skip a week, since the parity is always derived from real time.
Step-by-Step Build in LOGO!Soft Comfort
- Open LOGO!Soft Comfort and select your BM from Tools → Select Hardware → LOGO! 8.
- Drag three Weekly Timer blocks (B007) onto the diagram. Name them
WT_A,WT_B,WT_CLK. - Configure the cams per the tables above. Use 24-hour format. Day-mask bits: Mo Tu We Th Fr Sa Su, click the days to enable.
- Insert one NOT block (B004), two AND blocks (B001), and one OR block (B001 OR variant) for the multiplexer.
- Insert one Up/Down counter (B003). Set On=1, Off=0, Remanence=ON (right-click the block, set Retentive so the count survives power loss with battery present).
- Wire
WT_CLKoutput →CNT_WEEK.Cnt. - Wire
WT_CLKoutput →CNT_WEEK.Rthrough a normally-closed input or skip; do NOT reset weekly, only on cold start. - Wire
WT_A→ AND-A input 1,~CNT_WEEK.Q→ AND-A input 2. - Wire
WT_B→ AND-B input 1,CNT_WEEK.Q→ AND-B input 2. - Wire AND-A.Q and AND-B.Q to OR block; OR.Q → Q1.
- Mark Q1 as Retentive if your application requires the last output state to persist through power-down.
- Save the project as
biweekly_timer.lsc. Click PC → LOGO! to download. Use the Simulation tool first to step through a full 14-day cycle in accelerated mode.
Verification
| Test | Procedure | Expected result |
|---|---|---|
| Clock running | Menu → Setup → Date/Time | Time and weekday correct |
| Battery installed | Menu → Setup → Battery: Installed | Yes |
| Week-A pattern | Set LOGO! clock to a known Thursday 18:59, then advance to 19:00 | Q1 turns ON within 1 minute |
| Week-A close | Advance to following Monday 07:00 | Q1 turns OFF |
| Counter tick | Wait until Sunday 23:59 (or temporarily set clock) and observe CNT_WEEK.Q | Q toggles from 0 to 1 |
| Week-B pattern | Set clock to Friday 06:59, advance to 07:00 | Q1 turns ON (Week-B active) |
| Power-loss retention | Power off BM for 5 minutes, restore, check CNT_WEEK.Q and Q1 | State retained if battery present |
| Simulation 14-day sweep | LOGO!Soft Comfort → Tools → Simulation → Time acceleration 1:500 | Q1 follows the documented biweekly pattern with no glitches |
Always run a 14-day accelerated simulation before live deployment. Set time acceleration to 1:500 (one real second = 500 simulated seconds), start on a known Monday 00:00, and let it run for ~5 minutes real time. Q1 should produce exactly two distinct active windows matching Week-A and Week-B.
Troubleshooting Matrix
| Symptom | Likely cause | Fix |
|---|---|---|
| Q1 never turns on | Verify CNT_WEEK.Q via online monitor; check day-mask; verify date/time | |
| Q1 stuck on Week-A only | Verify WT_CLK cam is active on Sunday 23:59; check pulse generator PT | |
| Q1 toggles every day | Re-check WT_CLK day mask; only Sunday should be enabled | |
| Q1 reverses after power loss | Set CNT_WEEK as Retentive; install CR2032; or switch to the day-of-year parity derivation | |
| Monday doesn't fire | Check that Mo is in the mask of the cam ending at 07:00; LOGO! applies off-time at the start of the listed day | |
| LOGO!Soft Comfort rejects day mask | Convert program via Tools → Convert → LSC V7 to V8 | |
| Error Block limit exceeded | Check BM part number; consolidate cams where possible |
Alternative: LOGO! 8 Web Editor / TDE HMI
For larger installations where you want to display the active week (A/B) and remaining time on the LOGO! TDE text display or via the integrated web server, expose two virtual flags:
-
M1= Week-A active flag (set whenCNT_WEEK.Q = 0) -
M2= Week-B active flag (set whenCNT_WEEK.Q = 1)
Drag these onto the LOGO! display under Tools → Message Text for live monitoring. The web server (http://<logo-ip>) shows the same flags under Variables.
Edge Cases and Field-Proven Caveats
- DST transitions. LOGO! 8 with firmware ≥ FS:04 handles DST automatically. Older 0BA1 units do NOT; verify DST behavior with the seasonal override logic or use a Yearly Timer to bracket the DST weekend.
- Leap second. LOGO! 8 inserts a leap second at 23:59:60 UTC. If your application crosses UTC midnight, plan a one-minute allowance in the cams.
- Multi-BM networks. If you have multiple LOGO! BMs coordinating one schedule, use one BM as the master (with the counter) and broadcast Q1 over Ethernet using a Network input (function block B090 / NI) referencing the master's output.
- First-power parity. If the system is commissioned in the middle of an active Week-A window, the counter starts at 0 and is already correct. If commissioned mid Week-B, force a reset of the counter via a digital input wired to I1 so the next Sunday pulse aligns parity correctly.
- Counter wrap protection. The Up/Down counter with On=1, Off=0 will not wrap on its own; once it hits 1 it stays at 1 until reset, even if you keep clocking. That is exactly the behavior you want.
FAQ
How does the LOGO! Weekly Timer day mask work?
The day mask is a 7-bit field with bits for Mon..Sun. When the LOGO! internal clock reaches a masked day's 00:00, the cam's on-time is evaluated; when it reaches a masked day's 23:59, the off-time is evaluated. A cam with mask "Th" and on=19:00, off=23:59 means the timer is active from Thursday 19:00 through Friday 00:00 (i.e., the off-time fires at the start of Friday).
Can a single Weekly Timer block hold both Week-A and Week-B schedules?
No. A single Weekly Timer block expresses one repeating weekly pattern only. Two independent Weekly Timer blocks are required for the biweekly pattern, then combined with a counter-driven multiplexer.
Will the schedule survive a 24-hour power outage without a battery?
Only if the BM retains its RTC through the outage (battery installed) or you use the day-of-year parity derivation pattern. With no battery and no UPS, a 24-hour outage misaligns the weekly pattern by exactly the outage duration.
How do I simulate a 14-day cycle in LOGO!Soft Comfort?
Open Tools → Simulation, click the clock icon, and set acceleration to 1:500 or higher. Then click the calendar to set a known Monday 00:00 start. Watch Q1 over ~5 minutes of real time. Online monitoring under Window → Online Test shows live counter values.
What happens if I delete or skip a Week-A cycle manually?
The counter increments once per Sunday pulse regardless of Q1 state, so the parity advances on schedule. If you need to skip one full cycle, increment the counter twice (manually via I1 reset, then let the next Sunday pulse fire) before the next Week-A starts.
Does this same pattern work on LOGO! 0BA0 or 0BA1 (first generation)?
The first-generation LOGO! (0BA0, 6ED1052-1xxxx-0BA0) has no RTC; it cannot execute weekly or yearly timers. Only the LOGO! 0BA1 (with optional RTC module) and all 0BA2+ (built-in RTC) support the pattern described here.