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 (139059 times)
  2. FAT32 Library (71592 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 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 5 Click

Rating:

1

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.21

mikroSDK Library: 2.0.0.0

Category: RTC

Downloaded: 300 times

Not followed.

License: MIT license  

RTC5 Click carries MCP79510, a real-time clock/calendar with an SPI interface (mikroBUS MISO, MOSI, SCK and CS pins); along with a programmable interrupt for system output.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


RTC5 Click

RTC5 Click carries MCP79510, a real-time clock/calendar with an SPI interface (mikroBUS MISO, MOSI, SCK and CS pins); along with a programmable interrupt for system output.

rtc5_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : SPI type

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void rtc5_cfg_setup ( rtc5_cfg_t *cfg );

  • Initialization function.

    RTC5_RETVAL rtc5_init ( rtc5_t ctx, rtc5_cfg_t cfg );

  • Click Default Configuration function.

    void rtc5_default_cfg ( rtc5_t *ctx );

Example key functions :

  • Set time hours, minutes and seconds function.

    void rtc5_set_time ( rtc5_t *ctx, uint8_t time_hours, uint8_t time_min, uint8_t time_sec );

  • Set date hours, minutes and seconds function.

    void rtc5_set_date ( rtc5_t *ctx, uint8_t date_day, uint8_t date_month, uint16_t date_year );

  • Get time and date function.

    void rtc5_get_time_and_date ( rtc5_t ctx, rtc5_timedate_t timedate_data );

Examples Description

This is a example which demonstrates the use of RTC 5 Click board.

The demo application is composed of two sections :

Application Init

Initializes GPIO, SPI and LOG structures, sets CS pin as output and INT pin as input. Initialization driver enable's - SPI, clear RTCC and SRAM memory, sets starting time and date, enable counting and start write log.


void application_init ( void )
{
    log_cfg_t log_cfg;
    rtc5_cfg_t cfg;

    /** 
     * 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_printf( &logger, "- Application Init -\r\n" );

    //  Click initialization.

    rtc5_cfg_setup( &cfg );
    RTC5_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rtc5_init( &rtc5, &cfg );

    rtc5_default_cfg ( &rtc5);
    Delay_ms ( 100 );

    rtc5_clear( &rtc5 );
    Delay_ms ( 100 );

    time_sec_new = 255;

    // Set Time: 17h, 59 min and 50 sec
    rtc5_set_time( &rtc5, 23, 59, 50 );

    // Set Day of the week : Wednesday
    rtc5_set_day_of_the_week( &rtc5, RTC5_DAY_OF_THE_WEEK_TUESDAY );

    // Set Date: 31 ( day ), 12 ( month ) and 2019 ( year )
    rtc5_set_date( &rtc5, 31, 12, 2019 );

    // Start counting
    rtc5_set_counting( &rtc5, 1 );
    Delay_ms ( 100 );

    log_printf( &logger, "--------------------\r\n" );
    log_printf( &logger, "    RTC 5  Click    \r\n" );
    log_printf( &logger, "--------------------\r\n" );

}

Application Task

RTC 5 Click communicates with register via SPI by write to register and read from register, display RTC time and date.


void application_task ( void )
{
    rtc5_get_time_and_date( &rtc5, &time_date_data );

    if ( time_sec_new != time_date_data.sec )
    {
        log_printf( &logger, " Time : %02d:%02d:%02d\r\n", time_date_data.hours, time_date_data.min, time_date_data.sec );

        display_log_day_of_the_week( time_date_data.w_day );

        log_printf( &logger, " Date : %02d.%02d.20%02d.\r\n", time_date_data.day, time_date_data.month, time_date_data.year );
        log_printf( &logger, "--------------------\r\n" );

        time_sec_new = time_date_data.sec;
    }
} 

Note

Additional Functions: void display_log_day_of_the_week( uint8_t w_day ) - Write day of the week log.

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

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

ADC 7 Click

0

ADC 7 Click is an advanced 32-bit analog to digital converter (ADC) which uses the LTC2500-32, a 32-bit oversampling SAR ADC with a configurable digital filter. The filter provides several presets (selectable via the hardware pin), as well as programming of the filtering parameters, via the industry-standard SPI interface.

[Learn More]

AM/FM 2 Click

0

AM/FM 2 Click is a compact add-on board that can be used to listen to music from the AM and FM radio bands. This board features the Si4732, a broadcast AM/FM/SE/LW/RDS radio receiver from Skyworks. This radio receiver integrates the complete broadcast tuner and receiver function from antenna input to digital audio output. In addition to the radio receiver, this Click board™ is equipped with the LM4910, a Boomer output capacitor-less stereo 35mW headphone amplifier from Texas Instruments. This amplifier can deliver 35mW of continuous average power to a 32Ω load with less than 1% distortion.

[Learn More]

Mikromedia 5 for STM32F4 Capacitive

0

This project contains example for testing modules on Mikromedia 5 for STM32F4 Capacitive

[Learn More]