Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / Low-Frequency Timing and System Power

The MCP7940N keeps time after power loss. How can you preserve the outage and restoration times?

After a cold-room logger experiences an outage, its display shows the correct time, but service personnel still need to know the outage duration. An MCP7940N with an external watch crystal can use its power-fail timestamps. It records minute, hour, date, and month separately for main power loss and return. There are no seconds or year fields. Preserve that resolution in the software. Two events reported within the same minute do not establish a one-second outage.

Copy the timestamps before clearing the fault flag

Check whether PWRFAIL is set, then save both raw timestamp groups and the current trusted date in a persistent log. Clear PWRFAIL only after confirming the save. The manufacturer says clearing it also clears the timestamp registers and is required to capture the next pair. If general initialization clears it immediately, later service inspection may see a clock running normally with no remaining outage evidence.

On the bench, verify the VBAT input is enabled, backup power is available, and the oscillator is running. Record the starting time and switch main power off across a minute boundary. Restore power and read the registers. Use an independent logger to record the supply transitions and compare at the RTC's minute resolution. Repeat to check that storing the previous record really enables the next event to be captured.

Also simulate a log-write failure and check that the software leaves the registers available for retry. If reset occurs between a successful write and clearing the flag, detect the duplicate event to avoid counting the same outage twice. Record backup-battery configuration, raw timestamp fields, and host save status separately. This can expose a firmware change in outage-history handling even when a new watch crystal keeps time correctly.Microchip MCP7940N data sheet: power-fail timestamps

Send us a part number or your requirements

Brand, frequency, quantity and delivery target — a useful place to start.

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.