How does it work?
RTC 19 Click is based on the MAX31334, an ultra-low power, real-time clock (RTC) time-keeping device from Analog Devices. The MAX31334 is configured to transmit calendar and time data to the MCU (24-hour/12-hour format) based on a 32.768kHz quartz crystal and comes with an integrated interrupt generation function. 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, days, months, year, and date information. The end-of-the-month date is automatically adjusted for months with fewer than 31 days, including corrections for the leap year.
The MAX31334 features an integrated high-side power pass switch (detectable through a PSW pin and drawn to the TP1 testpoint for external use), enabling idle, ultra-low power modes on duty-cycled applications by disconnecting power to other devices on the system. The power switch ON/OFF durations can be controlled by periodic interrupt sources such as a countdown timer (programmable from 100ms to 1hr), alarms (1s resolution), or by an external interrupt from a DIN pushbutton.
The DIN signal represents a digital Schmitt trigger that records timestamps or asserts an interrupt on its falling/rising edge. In addition to the DIN button, the state of this signal can also be changed digitally using the DIN pin, routed on the RST pin of the mikroBUS™ socket. The selection can be performed using an onboard SMD jumper labeled DIN SEL, placing it in an appropriate position marked as MB or T, where MB stands for mikroBUS and T for the button.
This Click board™ communicates with the 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 an alarm circuitry configured to generate a time-of-day/date interrupt signal. An alarm (interrupt) signal, marked as INA and routed to the INT pin of the mikroBUS™ socket, allows outputting warning every day or on a specific day visually indicated by a red LED marked as ALARM.
By utilizing an automatic backup switch, when the main supply drops below the programmed threshold voltage, this RTC can use an external power source (220mF supercapacitor), allowing uninterrupted operation. Besides an automatic backup switchover circuit, this board also carries a header for additional alarm/interrupt and a programmable clock output signal for frequencies from 1Hz to 32kHz available on an onboard J1 header. In addition, this signal also exists on the AN pin of the mikroBUS™ socket marked with INTB.
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 general-consumer applications, including daily alarms, metering applications, and others requiring an accurate RTC for their operation
On-board modules
MAX31334 – real-time clock from Analog Devices
Key Features
Low power consumption, automatic backup supply switch, integrated power switch, high accuracy, clock/calendar feature, programmable interrupt and clock output, automatic leap year recognition, 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 19 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 |
LD2 | ALARM | – | Alarm LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | DIN SEL | Right | Schmitt Trigger Selection MB/T: Left position MB, Right position T |
J1 | J1 | Unpopulated | Programmable Clock/Interrupt Output Header |
T1 | DIN | – | External Trigger Button |
RTC 19 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Memory Size (RAM) | – | – | 32 | bytes |
Clock Output | 1 | – | 32 | kHz |
Software Support
We provide a library for the RTC 19 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 19 Click driver.
Key functions
-
rtc19_set_time
This function sets the starting time values – second, minute and hour. -
rtc19_read_time
This function reads the current time values – second, minute and hour. -
rtc19_read_date
This function reads the current date values – day of week, day, month and year.
Example Description
This example demonstrates the use of RTC 19 Click board™ by reading and displaying the time and date values.
void application_task ( void )
{
// Wait for a timer countdown flag configured at 1 Hz
while ( rtc19_get_inta_pin ( &rtc19 ) );
Delay_ms ( 100 );
rtc19_clear_interrupts ( &rtc19 );
if ( RTC19_OK == rtc19_read_time ( &rtc19, &time ) )
{
log_printf( &logger, " Time: %.2u:%.2u:%.2urn",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
if ( RTC19_OK == rtc19_read_date ( &rtc19, &date ) )
{
log_printf( &logger, " Date: %s, %.2u.%.2u.20%.2u.rn",
rtc19_get_day_of_week_name ( date.day_of_week ),
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
}
}
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.RTC19
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. 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 the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.