-
Notifications
You must be signed in to change notification settings - Fork 22
getPowerFail()
(MCP7940N only)
This function returns a boolean true if a power fail has occurred. The MCP7940N sets this flag upon power failure and also stores the datetime when the failure occurred and when the power was restored. These values remain in memory and are not overwritten even if subsequent power failures occur. They are only cleared when the power fail flag is reset using clearPowerFail.
...
MCP7940_Class MCP7940; // Create an instance of the MCP7940
...
void setup() {
Serial.begin(SERIAL_SPEED);
while (!MCP7940.begin()) { // Initialize RTC communications
Serial.println("Unable to find MCP7940. Checking again in 1 second.");
delay(1000);
} // of loop until device is located
MCP7940.begin(); // start with compile date-time
MCP7940.setSQWSpeed(2); // set SQW to 8192 Hz
MCP7940.setSQWState(true); // turn on the square wave
...
if (MCP7940.getPowerFail()) {
Serial.println("Power failure has occurred!");
MCP7940.clearPowerFail(); // reset flag
} // of if we had a power failure
...
Overview
Installation
Class Instantiation
DateTime Helper Class
TimeSpan Helper Class
begin()
deviceStatus()
deviceStart()
deviceStop()
now()
adjust()
calibrate()
calibrateOrAdjust()
getCalibrationTrim()
weekdayRead()
weekdayWrite()
readRAM()
writeRAM()
setMFP()
getMFP()
setAlarm()
getAlarm()
setAlarmState()
setAlarmPolarity()
getAlarmState()
clearAlarm()
getSQWSpeed()
setSQWSpeed()
setSQWState()
getPowerFail()
clearPowerFail()
getBattery()
setBattery()
getPowerDown()
getPowerUp()
readEUI() {00/01/02 only}
writEUI() {00/01/02 only}
-none-
SetAndCalibrate.ino
SetAlarms.ino
SquareWave.ino
TestBatteryBackup.ino
SimpleBatteryBackup.ino
AccessMemory.ino
RegressionTests.ino