How does it work?
RTC 9 click is based on the M41T82, an extreme low power real-time clock/calendar (RTC) module from ST Microelectronics. Thanks to its high integration level, this module provides high time accuracy, factory calibrated to ±5 ppm even after two reflows, with a very low count of external components required. It has a full RTC function, offering programmable counters, alarms, and an interrupt engine with selectable event reporting sources. The operational parameters are stored within the internal user SRAM memory, which is battery-backed, thus allowing their persistence in the event of the complete power failure.
M41T82 features a built-in 32.768 kHz oscillator. However, RTC 9 click has an external oscillator too, in order to achieve the best accuracy possible. Eight bytes of the register map are used for the clock/calendar function and are configured in binary-coded decimal (BCD) format. An additional 17 bytes of the register map provide status/control of the two alarms, watchdog, 8-bit counter, and square wave functions. An additional seven bytes are made available as user SRAM. M41T82 supports the I2C communication interface, which is also used on the RTC 9 click for communicating with the main microcontroller through the mikroBUS socket.
Functions available to the user include a non-volatile, time-of-day clock/calendar, two alarm interrupts, watchdog timer, programmable 8-bit counter, and square wave outputs. The eight clock address locations contain the century, year, month, date, day, hour, minute, second, and tenths/hundredths of a second in 24-hour BCD format. Corrections for 28, 29 (leap year), 30, and 31 day months are made automatically.
This Click Board™ is designed to be operated with both 3.3V and 5V logic levels that can be selected via VCC SEL jumper. This allows for both 3.3V and 5V capable MCUs to use the I2C communication lines properly.
Specifications
Type
RTC
Applications
RTC 9 click is a perfect solution for the development of the IoT, wearable and portable devices, logging devices, industrial and health-related time metering applications, and all the other applications that require an accurate time-base for various purposes.
On-board modules
M41T82, real-time clock (RTC) with battery switchover, from ST Microelectronics.
Key Features
Factory-calibrated accuracy of ±5 ppm typically, automatic switchover and reset output circuitry, programmable alarm with interrupt function, 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 9 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 | Power Supply Voltage Selection 3V3/5V, left position 3v3, right position 5v |
RTC 9 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage (for R version) | 2.70 | 3.3 | 5.5 | V |
Supply Current | – | 365 | – | nA |
Accuracy | – | 5 | – | ppm |
Operating Temperature Range | -40 | – | 85 | °C |
Software Support
We provide a library for the RTC 9 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library contains basic functions for working with RTC 9 click. The user is enabled to adjust and read the time and date. it also has the ability to set alarms.
Key functions:
void rtc9_set_time( uint8_t hour, uint8_t min, uint8_t sec )
– Set new time – 24 hour format.void rtc9_set_date ( uint8_t day, uint8_t day_of_week, uint8_t month, uint8_t year )
– Set new date.void rtc9_wakeup ( void )
– Wake-up process.
Examples description
The application is composed of three sections :
- System Initialization – Initializes the I2C module and all necessary gpio pins.
- Application Initialization – Starts waking the chip and sets the start time and date.
- Application Task – It reads current time and date and logs to usb uart every 1000 ms.
void application_init ( ) { rtc9_i2c_driver_init ( ( rtc9_obj_t )&_MIKROBUS1_GPIO, ( rtc9_obj_t )&_MIKROBUS1_I2C, RTC9_SLAVE_ADDRESS ); Delay_ms( 500 ); rtc9_wakeup( ); rtc9_set_time( 12, 15, 45 ); rtc9_set_date ( 20, RTC9_DAY_FRIDAY, RTC9_MONTH_MARCH, 20 ); } void application_task ( ) { time_process( ); date_process( ); mikrobus_logWrite( "----------------------------------------", _LOG_LINE ); Delay_ms( 1000 ); }
Additional Functions :
- time_process ( ) – Reads and displays current time
- date_process ( ) – Reads and displays current date
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- UART
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
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.