TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 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 (139050 times)
  2. FAT32 Library (71588 times)
  3. Network Ethernet Library (56988 times)
  4. USB Device Library (47326 times)
  5. Network WiFi Library (43005 times)
  6. FT800 Library (42295 times)
  7. GSM click (29754 times)
  8. mikroSDK (27873 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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 6 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.19

mikroSDK Library: 2.0.0.0

Category: RTC

Downloaded: 241 times

Not followed.

License: MIT license  

RTC6 Click carries Microchip’s MCP79410 Real-Time Clock/Calendar IC with built-in 64 bytes of battery-backed SRAM an additional 1 Kbit of EEPROM.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


RTC6 Click

RTC6 Click carries Microchip’s MCP79410 Real-Time Clock/Calendar IC with built-in 64 bytes of battery-backed SRAM an additional 1 Kbit of EEPROM.

rtc6_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : jan 2020.
  • Type : I2C type

Software Support

We provide a library for the Rtc6 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Rtc6 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void rtc6_cfg_setup ( rtc6_cfg_t *cfg );

  • Initialization function.

    RTC6_RETVAL rtc6_init ( rtc6_t ctx, rtc6_cfg_t cfg );

  • Click Default Configuration function.

    void rtc6_default_cfg ( rtc6_t *ctx );

Example key functions :

  • This function enables automatic switch to battery on VCC failure.

    void rtc6_battery_enable ( rtc6_t *ctx );

  • This function gets current GMT time and sets it in the RTC.

    void rtc6_get_gmt_time ( rtc6_t ctx, rtc6_time_t gmt_time );

  • his function calculates current local time.

    void rtc6_get_local_time ( rtc6_t ctx, rtc6_time_t local_time );

Examples Description

This application enables usage of Real-TIme clock and calendar with alarm on RTC 6 Click.

The demo application is composed of two sections :

Application Init

Initializes driver init, sets time zone, sets UTC-GMT time and alarm time


void application_init ( void )
{
    log_cfg_t log_cfg;
    rtc6_cfg_t cfg;
    int8_t time_zone = 2;

    /** 
     * 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.

    rtc6_cfg_setup( &cfg );
    RTC6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rtc6_init( &rtc6, &cfg );

    // Set UTC time

    utc_time.seconds  = 40;
    utc_time.minutes  = 59;
    utc_time.hours    = 23;
    utc_time.monthday = 14;
    utc_time.month    = 12;
    utc_time.year     = 18;

    // Set alarm time

    alarm_time.seconds  = 0;
    alarm_time.minutes  = 0;
    alarm_time.hours    = 0;
    alarm_time.weekdays  = 0;
    alarm_time.monthday = 15;
    alarm_time.month    = 12;
    alarm_time.year     = 18;

    rtc6_default_cfg( &rtc6, time_zone, &utc_time, &alarm_time );
    log_info( &logger, " ----- Init successfully ----- " );
}

Application Task

Reads GMT time and Local time. Checks if the alarm is activated. If the alarm is active, it disable alarm and adjusts the new one within 20 seconds. Logs this data on USBUART every 900ms.


void application_task ( void )
{
    //  Task implementation.

    rtc6_get_gmt_time( &rtc6, &utc_time );
    rtc6_get_local_time( &rtc6, &local_time );

    log_printf( &logger, "--- UTC time ---\r\nTime : %d %d %d\r\n", utc_time.hours, utc_time.minutes, utc_time.seconds );

    log_printf( &logger, "Date : %d %d %d\r\n", utc_time.monthday, utc_time.month, utc_time.year );

    log_printf( &logger, "--- Local time ---\r\nTime : %d %d %d\r\n", local_time.hours, local_time.minutes, local_time.seconds );

    log_printf( &logger, "Date : %d %d %d\r\n \r\n", local_time.monthday, local_time.month, local_time.year );

    if ( rtc6_is_active_alarm( &rtc6 ) != 0 )
    {
        log_printf( &logger, " ----- Active alarm ----- \r\n" );
        rtc6_disable_alarm( &rtc6, RTC6_ALARM_0 );
        rtc6_repeat_alarm( &rtc6, RTC6_ALARM_0, 20 );
    }

    Delay_ms ( 900 );
}  

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Rtc6

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.


ALSO FROM THIS AUTHOR

pH click

5

pH Click is a compact add-on board that provides an opportunity for the user to read pH with the same accuracy and capabilities as with some other expensive solutions.

[Learn More]

Brushless 17 Click

0

Brushless 17 Click is a compact add-on board suitable for controlling brushless DC (BLDC) motors with any MCU. This board features the L6229Q, DMOS fully integrated three-phase BLDC motor driver with overcurrent protection from STMicroelectronics. This motor driver combines isolated DMOS power transistors with CMOS and bipolar circuits on the same chip, realized in BCD (Bipolar-CMOS-DMOS) multipower technology. It includes all the circuitry for a three-phase BLDC motor drive, including a three-phase DMOS bridge, a constant off-time PWM current controller, and the decoding logic for single-ended hall sensors that generate the required sequence for the power stage.

[Learn More]

Pressure 21 Click

0

Pressure 21 Click is a compact add-on board that contains a board-mount pressure sensor. This board features the BMP581, an absolute barometric pressure sensor from Bosch Sensortec. The BMP581 provides a relative accuracy of ±6Pa and typical absolute accuracy of ±30Pa with ultra-low noise, low power consumption, and temperature stability alongside programmable output: temperature-only or both pressure and temperature (pressure-only is not supported). It converts output data into a 24-bit digital value and sends the information via a configurable host interface that supports SPI and I2C serial communications. It measures pressure from 30kPa up to 125kPa over a wide operating temperature range.

[Learn More]