You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**MCP79412RTC** is an Arduino library that supports the Microchip MCP79412 Real-Time Clock/Calendar. It is intended to be used with the [Arduino Time library] (http://www.arduino.cc/playground/Code/Time).
10
10
11
11
The **MCP79412RTC** library is a drop-in replacement for the **DS1307RTC** library by Michael Margolis that is supplied with the [Arduino Time library](http://www.arduino.cc/playground/Code/Time). To change from using a DS1307 RTC to an MCP79412 RTC, it is only necessary to use `#include <MCP79412RTC.h>` instead of `#include <DS1307RTC.h>`.
@@ -18,14 +18,14 @@ The **MCP79412RTC** library also implements methods to support the additional fe
18
18
The [Microchip MCP79412 Product Page](http://goo.gl/SHfKe0) for specs, datasheet, etc.
19
19
MCP79412 breakout boards are available at [my Tindie Store](http://goo.gl/UzAVcZ)
20
20
21
-
##Installation
21
+
##Installation ##
22
22
To use the **MCP79412RTC** library:
23
23
- Go to https://github.com/JChristensen/MCP79412RTC, click the **Download ZIP** button and save the ZIP file to a convenient location on your PC.
24
24
- Uncompress the downloaded file. This will result in a folder containing all the files for the library, that has a name that includes the branch name, usually **MCP79412RTC-master**.
25
25
- Rename the folder to just **MCP79412RTC**.
26
26
- Copy the renamed folder to the Arduino sketchbook\libraries folder.
27
27
28
-
##Examples
28
+
##Examples ##
29
29
The following example sketches are included with the **MCP79412RTC** library:
30
30
-**rtcSet1:** Set the RTC date and time using a hard-coded value in the sketch.
31
31
-**rtcSet2:** Similar to **rtcSet1**, a different way to hard-code the date and time.
@@ -36,7 +36,7 @@ The following example sketches are included with the **MCP79412RTC** library:
36
36
-**PowerOutageLogger:** A comprehensive example that implements a power failure logger using the MCP79412's ability to capture power down and power up times. Power failure events are logged to the MCP79412's SRAM. Output is to the Arduino serial monitor.
37
37
-**tiny79412_KnockBang:** Demonstrates interfacing an ATtiny45/85 to the MCP79412.
38
38
39
-
#Usage notes
39
+
## Usage notes ##
40
40
Similar to the **DS1307RTC** library, the **MCP79412RTC** library instantiates an RTC object; the user does not need to do this.
41
41
42
42
To use the **MCP79412RTC** library, the Time and Wire libraries must also be included. For brevity, these includes are not repeated in the examples below:
@@ -46,7 +46,7 @@ To use the **MCP79412RTC** library, the Time and Wire libraries must also be inc
46
46
#include<Wire.h>//http://arduino.cc/en/Reference/Wire (included with Arduino IDE)
47
47
```
48
48
49
-
##Methods for setting and reading the time
49
+
##Methods for setting and reading the time ##
50
50
51
51
###get(void)
52
52
#####Description
@@ -139,7 +139,7 @@ else
139
139
//do something else
140
140
```
141
141
142
-
##Methods for reading and writing static RAM (SRAM)
142
+
##Methods for reading and writing static RAM (SRAM) ##
143
143
The MCP79412 RTC has 64 bytes of battery-backed SRAM that can be read and written with the following methods using addresses between 0 and 63. Addresses passed to these functions are constrained to the valid range by an AND function.
144
144
145
145
###sramWrite(byte addr, byte value)
@@ -208,7 +208,7 @@ byte buf[8];
208
208
RTC.sramRead(56, buf, 8);
209
209
```
210
210
211
-
##Methods for Reading and writing EEPROM
211
+
##Methods for Reading and writing EEPROM ##
212
212
The MCP79412 RTC has 128 bytes of non-volatile EEPROM that can be read and written with the following methods using addresses between 0 and 127. Addresses passed to these functions are constrained to the valid range by an AND function.
213
213
214
214
EEPROM is paged memory with a page size of 8 bytes; when writing multiple bytes, this this limits the number of bytes that can be written at one time to 8. Page writes must start on a page boundary.
@@ -279,7 +279,7 @@ byte buf[8];
279
279
RTC.eepromRead(120, buf, 8);
280
280
```
281
281
282
-
##Alarm methods
282
+
##Alarm methods ##
283
283
The MCP79412 RTC has two alarms (Alarm-0 and Alarm-1) that can be used separately or simultaneously. When an alarm is triggered, a flag is set in the RTC that can be detected with the `alarm()` function below. Optionally, the RTC's Multi-Function Pin (MFP) can be driven to either a low or high logic level when an alarm is triggered. When using the MFP with both alarms, be sure to read the comments on the `alarmPolarity()` function below.
284
284
285
285
###setAlarm(byte alarmNumber, time_t alarmTime)
@@ -362,7 +362,7 @@ None.
362
362
RTC.alarmPolarity(HIGH); //drives MFP high when an alarm is triggered
363
363
```
364
364
365
-
##Calibration, power failure, and other methods
365
+
##Calibration, power failure, and other methods ##
0 commit comments