-
Notifications
You must be signed in to change notification settings - Fork 22
getPowerUp()
(MCP7940N only)
This function will return a "DateTime" class representing the datetime when the first power restore after failure occurred. This value is kept until the power failure flag is removed using clearPowerFail(). The MCP7940N does not store the seconds at which the power came back up and also does not store the year, these values are set to 0 in the returned class.
...
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.setBattery(true); // enable battery backup mode
...
if (MCP7940.getPowerFail()) {
DateTime restoreTime = MCP7940.getPowerDown();
char inputBuffer[40];
sprintf(inputBuffer,"Power restored at ????-%02d-%02d %02d:%02d:??",
restoreTime.month(), restoreTime.day(), restoreTime.hour(), restoreTime.minute());
Serial.println(inputBuffer);
} // of if-then a power failure occurred
...
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