How does it work?
RTC 21 Click is based on the PT7C4311, an ultra-low power, real-time clock (RTC) time-keeping device from Diodes Incorporated. The PT7C4311 is configured to transmit calendar and time data to the MCU (24-hour format) based on a 32.768kHz quartz crystal and comes with 56 bytes of general-purpose RAM. It reads and writes clock/calendar data from and to the MCU in units ranging from seconds to the last two digits of the calendar year, providing seconds, minutes, hours, dates, days, months, year, and century information. The end-of-the-month date is automatically adjusted for months with fewer than 31 days, including corrections for the leap year until 2100.
This Click board™ communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting a Fast Mode operation up to 400kHz. It also incorporates one open-drain output labeled as FT, which can be used as a frequency test signal (512Hz square-wave password for frequency test purposes) or as a register-configurable output DC level when square-wave is disabled. The PT7C4311 also includes an automatic backup switchover circuit allowing it to be used with a single-button cell battery for an extended period.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
RTC
Applications
Can be used for various time-keeping applications, including daily alarms, metering applications, and others requiring an accurate RTC for their operation
On-board modules
PT7C4311 – real-time clock (RTC) from Diodes Incorporated
Key Features
Low power consumption, programmable square-wave output, high-speed I2C interface, clock/calendar counter, 24-hour format, 56 bytes RAM, automatic lepa year compensation, automatic backup switchover, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on RTC 21 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
RTC 21 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Memory Size | – | – | 56 | bytes |
Date Format | YY-MM-DD | |||
Time Format | HH:MM:SS (24 hr) |
Software Support
We provide a library for the RTC 21 Click as well as a demo application (example), developed using Mikroe compilers. The demo can run on all the main Mikroe development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for RTC 21 Click driver.
Key functions
-
rtc21_set_time
This function sets the starting time values – second, minute and hour. -
rtc21_set_date
This function sets the starting date values – day of week, day, month and year. -
rtc21_read_time
This function reads the current time values – second, minute and hour.
Example Description
This example demonstrates the use of RTC 21 Click board™ by reading and displaying the time and date values.
void application_task ( void )
{
if ( RTC21_OK == rtc21_read_time ( &rtc21, &time ) )
{
log_printf( &logger, " Time: %.2u:%.2u:%.2urn",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
if ( RTC21_OK == rtc21_read_date ( &rtc21, &date ) )
{
log_printf( &logger, " Date: %s, %.2u.%.2u.20%.2u.rn",
rtc21_get_day_of_week_name ( date.day_of_week ),
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
}
Delay_ms ( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.RTC21
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. A UART terminal is available in all Mikroe compilers.
mikroSDK
This Click board™ is supported with mikroSDK – Mikroe Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.