Creating a 168-Hour Countdown in BB Controller with DOY and TIME Functions (Survives Reboots)

I have a scenario where after every 1 hour i have to manual the VAR 50 for 3 sec. and then auto it back.
is there a specific way to do that in T3000 using the coding and registers???

Could you describe your requirements in more detail? You can set the value of VAR at regular intervals. It’s completely achievable

Maurice did reply to this earlier, but for some reason the message didn’t appear on the forum. I’m reposting his response here on his behalf:

"There’s no programmatic control over the manual setting by design, but I’m sure there’s a way to do this through some crafty programming and another variable or two.
I am operating from my phone for a while or I’d put some suggested programming together."
– Maurice [Temco Controls]

I’m using this BB Controller code to run a 168‑hour (604,800‑second) countdown:

10 IF TIMERST = 1 THEN TIMER = 604800, TIMERST = 0
20 IF TIMERST = 0 THEN TIMER = TIMER - 1
30 IF TIMER > 1 AND TIMER <= 10 THEN TIMERST = 1
40 WAIT 1

The problem is that, whenever the controller reboots, the timer resets to its initial value instead of resuming. I discovered that if I manually switch VAR 50 (TIMER) from AUTO to MANUAL for two seconds—and then back to AUTO—the controller preserves the current timer value across reboots. That’s exactly the behavior I need.

Now I want to automate this “2‑second manual” hack: every hour, VAR 50 should switch to MANUAL mode for two seconds, then return to AUTO so the countdown continues uninterrupted even after a reboot.

Thanks for the clarification. Could you draft a snippet of that “clever logic” in BB Controller code so I can see exactly how you’d automate the AUTO→MANUAL switch for VAR 50 each hour? Having your example implementation would really help me integrate it into my timer routine.

Based on your goal of creating a 168-hour countdown that survives reboots, we’ve put together a simple BB controller program that uses the DOY and TIME system functions to track elapsed time.

Here’s how it works:

DOY is the day-of-year counter (e.g., Jan 1 = 1, Dec 31 = 365).
TIME is the number of seconds since midnight (e.g., 43200 = 12:00:00 PM).
VAR1 stores the starting DOY, and VAR2 stores the starting TIME.
VAR50 will hold the remaining countdown time in seconds.

10 REM === Start countdown: Record initial DOY and TIME (in seconds) ===
20 IF TIMERST = 1 THEN VAR1 = DOY, VAR2 = TIME, TIMERST = 0
30 REM === Calculate time difference ===
40 DOY_DIFF = DOY - VAR1
50 TIME_DIFF = TIME - VAR2
60 TOTAL_DIFF = DOY_DIFF * 86400 + TIME_DIFF
70 REM === Calculate remaining time ===
80 VAR50 = 604800 - TOTAL_DIFF
90 IF VAR50 < 0 THEN VAR50 = 0

With this setup, your countdown will resume accurately even after a reboot, as long as VAR1 and VAR2 are retained. If you ever need to restart the countdown, simply set TIMERST = 1

Thanks @Lijun It is quite helpful.