TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (387 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (120 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (140167 times)
  2. FAT32 Library (72621 times)
  3. Network Ethernet Library (57641 times)
  4. USB Device Library (47954 times)
  5. Network WiFi Library (43553 times)
  6. FT800 Library (42942 times)
  7. GSM click (30140 times)
  8. mikroSDK (28669 times)
  9. PID Library (27055 times)
  10. microSD click (26552 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

RTC 18 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: RTC

Downloaded: 223 times

Not followed.

License: MIT license  

RTC 18 Click is a compact add-on board that accurately keeps the time of a day. This board features the RV-3032-C7, an I2C-configurable real-time clock module that incorporates an integrated CMOS circuit and an XTAL from Micro Crystal AG. The RV-3032-C7 is a temperature compensated RTC with premium accuracy (0.22 sec/day) and extremely low power consumption, allowing it to be used with a single button cell battery for an extended period. It can measure temperature with a typical accuracy of ±1°C and a resolution of 0.0625°C/step with a programmable alarm on top and bottom temperature limits. It features standard RTC functions with automatic leap year correction, and standard interrupt for Periodic Countdown Timer and Periodic Time Update (seconds, minutes), date/hour/minute alarm, and an external event.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "RTC 18 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "RTC 18 Click" changes.

Do you want to report abuse regarding "RTC 18 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


RTC 18 Click

RTC 18 Click is a compact add-on board that accurately keeps the time of a day. This board features the RV-3032-C7, an I2C-configurable real-time clock module that incorporates an integrated CMOS circuit and an XTAL from Micro Crystal AG. The RV-3032-C7 is a temperature compensated RTC with premium accuracy (0.22 sec/day) and extremely low power consumption, allowing it to be used with a single button cell battery for an extended period. It can measure temperature with a typical accuracy of ±1°C and a resolution of 0.0625°C/step with a programmable alarm on top and bottom temperature limits. It features standard RTC functions with automatic leap year correction, and standard interrupt for Periodic Countdown Timer and Periodic Time Update (seconds, minutes), date/hour/minute alarm, and an external event.

rtc18_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : May 2022.
  • Type : I2C type

Software Support

We provide a library for the RTC 18 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 18 Click driver.

Standard key functions :

  • rtc18_cfg_setup Config Object Initialization function.

    void rtc18_cfg_setup ( rtc18_cfg_t *cfg );
  • rtc18_init Initialization function.

    err_t rtc18_init ( rtc18_t *ctx, rtc18_cfg_t *cfg );
  • rtc18_default_cfg Click Default Configuration function.

    err_t rtc18_default_cfg ( rtc18_t *ctx );

Example key functions :

  • rtc18_read_time This function reads the current time values - second, minute and hour.

    err_t rtc18_read_time ( rtc18_t *ctx, rtc18_time_t *time );
  • rtc18_read_date This function reads the current date values - day of week, day, month and year.

    err_t rtc18_read_date ( rtc18_t *ctx, rtc18_date_t *date );
  • rtc18_read_temperature This function reads temperature measurements in Celsius.

    err_t rtc18_read_temperature ( rtc18_t *ctx, float *temperature );

Example Description

This example demonstrates the use of RTC 18 Click board by reading and displaying the time and date values as well as the temperature measurements in Celsius.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger and performs the Click default configuration which enables the periodic interrupt on seconds count-up, and sets the starting time and date.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    rtc18_cfg_t rtc18_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    rtc18_cfg_setup( &rtc18_cfg );
    RTC18_MAP_MIKROBUS( rtc18_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == rtc18_init( &rtc18, &rtc18_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( RTC18_ERROR == rtc18_default_cfg ( &rtc18 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    time.hour = 23;
    time.minute = 59;
    time.second = 50;
    if ( RTC18_OK == rtc18_set_time ( &rtc18, &time ) )
    {
        log_printf( &logger, " Set time: %.2u:%.2u:%.2u\r\n", 
                    ( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
    }
    date.day_of_week = RTC18_SATURDAY;
    date.day = 31;
    date.month = 12;
    date.year = 22;
    if ( RTC18_OK == rtc18_set_date ( &rtc18, &date ) )
    {
        log_printf( &logger, " Set date: %s, %.2u.%.2u.20%.2u.\r\n", 
                    rtc18_get_day_of_week_name ( date.day_of_week ),
                    ( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Waits for the second count-up interrupt and then reads and displays on the USB UART the current time and date values as well as the temperature measurements in Celsius.

void application_task ( void )
{
    float temperature;

    // Wait for a second count-up interrupt
    while ( rtc18_get_int_pin ( &rtc18 ) );

    Delay_ms ( 10 );
    rtc18_clear_periodic_interrupt ( &rtc18 );

    if ( RTC18_OK == rtc18_read_time ( &rtc18, &time ) )
    {
        log_printf( &logger, " Time: %.2u:%.2u:%.2u\r\n", 
                    ( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
    }
    if ( RTC18_OK == rtc18_read_date ( &rtc18, &date ) )
    {
        log_printf( &logger, " Date: %s, %.2u.%.2u.20%.2u.\r\n", 
                    rtc18_get_day_of_week_name ( date.day_of_week ),
                    ( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
    }
    if ( RTC18_OK == rtc18_read_temperature ( &rtc18, &temperature ) )
    {
        log_printf( &logger, " Temperature: %.2f C\r\n\n", temperature );
    }
}

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.RTC18

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.


ALSO FROM THIS AUTHOR

Angle 6 Click

0

Angle 6 Click is a compact add-on board that detects the absolute angular position of a permanent magnet, typically a diametrically magnetized cylinder on a rotating shaft. This board features the MAQ470GQE, a 12-bit contactless angle sensor with PWM output from Monolithic Power Systems. It supports a wide range of magnetic field strengths and spatial configurations, with both end-of-shaft and off-axis (side-shaft mounting), supported configurations. Fast data acquisition and processing provides accurate angle measurement at speeds from 0 to 60,000 rpm, alongside magnetic field strength detection with programmable thresholds.

[Learn More]

Cap Extend Click

0

Cap Extend Click is a mikroBUS add-on board with a SEMTECH SX8633 low power, capacitive button touch controller. It has 12 pins for connecting capacitive inputs (either touch-buttons or proximity sensors).

[Learn More]

Fan 5 Click

0

Fan 5 Click is a compact add-on board specially designed for fan speed management. This board features Microchip’s TC654, a PWM mode fan speed controller with FanSense™ technology suitable for brushless DC fans.

[Learn More]