How does it work?
RTC 16 Click as its foundation uses the BU9873, an I2C configurable real-time clock/calendar optimized for low power operations from Rohm Semiconductors. The BU9873 is configured to perform the serial transmission of calendar and time data to the MCU and comes with an integrated interrupt generation function. It also contains a built-in high-precision oscillation adjustment circuit which enables the adjustment of time counts with a digital method and correct deviations in the oscillation frequency of the crystal oscillator. This RTC is also characterized by an automatic leap year recognition until the future 2099 year.
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. An alarm and interrupt function is also available that outputs an interrupt signal to the INT pin of the mikroBUS™ socket when the day of the week, hour, or minute matches with the preset time. An alarm may be selectable between ON and OFF for each day of the week, allowing outputting warning every day or on a specific day indicated by a red LED marked as ALARM. Besides, the RTC 16 Click also has an onboard header labeled CLKOUT, which provides clock pulses of 32kHz.
The most common RTC configuration, like this one, is a battery-backed up, which maintains time and continues its work without interruption in the event of a power failure. That’s why, in addition to the BU9873, the RTC 16 Click is equipped with a button cell battery holder compatible with the 3000TR battery holder, suitable for 12mm Coin Cell batteries.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the Click board™ comes equipped with a library that contains 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
BU9873 – CMOS real-time clock that has a built-in interrupt generation function from Rohm Semiconductors
Key Features
Low power consumption, clock/calendar feature, programmable periodic and alarm with interrupt capability, battery back-up, 32kHz clock output, automatic leap year recognition up to the year
2099, and more
Interface
I2C
Feature
No 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 16 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 |
J1 | CLKOUT | Unpopulated | 32kHz Clock Output Header |
RTC 16 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Clock Output CLKOUT | – | 32 | – | kHz |
Operating Temperature Range | -40 | +25 | +85 | °C |
Software Support
We provide a library for the RTC 16 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for RTC 16 Click driver.
Key functions
-
rtc16_set_time
This function sets the starting time values – second, minute and hour. -
rtc16_read_time
This function reads the current time values – second, minute and hour. -
rtc16_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 16 Click board™ by reading and displaying the time and date values.
void application_task ( void )
{
// Wait for interrupt which is synchronized with second count-up
while ( rtc16_get_int_pin ( &rtc16 ) );
rtc16_clear_interrupts ( &rtc16 );
if ( RTC16_OK == rtc16_read_time ( &rtc16, &time ) )
{
log_printf( &logger, " Time: %.2u:%.2u:%.2urn",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
if ( RTC16_OK == rtc16_read_date ( &rtc16, &date ) )
{
log_printf( &logger, " Date: %s, %.2u.%.2u.20%.2u.rnn",
rtc16_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 way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.RTC16
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 MikroElektronika compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika 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.