Skip to content
Arnd edited this page Jan 6, 2021 · 12 revisions

MCP7940 library

img src="https://github.com/Zanduino/MCP7940/blob/master/Images/MCP7940M-PDIP-8.png" width="175" align="right"/> Arduino library for accessing the Microchip MCP7940 real time clock. There are two versions of the RTC, MCP7940M and MCP7940N, which differ only in that the MCP7940N has a battery backup supply pin and keeps the clock running on power failure. The MCP7940N also has additional registers which store the timepoint of power failure and point in time when power was restored. In addition there are 3 more RTC chips, the MCP79400, MCP79401 and MCP79402 which are backwards compatible but include a special EEPROM storage for EUI address and these are also supported by this library

Overview

The MCP7940M, MCP7940N and MCP7940x datasheets describe the chip in detail. While there is no breakout board available for this RTC at the present time, it is not difficult to build into a project. The MCP7940 is available as a PDIP 8 pin which allows for easy use on a breadboard and the only additional parts necessary are a 32.768kHz crystal with 2 small capacitors (~6pF, depends upon circuit capacitance) and some pull-up resistors for the I2C data lines as well as for the multifunction pin, if that is to be used.

Features

Apart from performing as a real-time clock, the MCP4790 has 64 Bytes of SRAM storage available and features 2 separate alarms that can be set to be recurring or a single use. The alarm state can be checked using library functions or can pull down the the MFP (multi-function pin) for a hardware interrupt or other action. The MCP7940 allows for software trimming and the library has functions which support fine-tuning the RTC to increase accuracy.

Description

The functions and methods used in the library are listed in the menu bar to the right.

Clone this wiki locally