TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 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 (139566 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47617 times)
  5. Network WiFi Library (43220 times)
  6. FT800 Library (42566 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26933 times)
  10. microSD click (26309 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 13 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.15

mikroSDK Library: 2.0.0.0

Category: RTC

Downloaded: 228 times

Not followed.

License: MIT license  

RTC 13 Click is a compact add-on board that accurately keeps the time of a day. This board features the PCF2123, an SPI configurable real-time clock/calendar optimized for low power operations from NXP Semiconductors. The PCF2123 provides year, month, day, weekday, hours, minutes, and seconds based on a 32.768kHz quartz crystal. Data is transferred serially via an SPI interface with a maximum data rate of 6.25 Mbit/s. An alarm and timer function is also available, providing the possibility to generate a wake-up signal on an interrupt line, in addition to a programmable square-wave clock output. This Click board™ is suitable for various time-keeping applications, including high-duration timers, metering, daily alarms, low standby power applications, and many more.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


RTC 13 Click

RTC 13 Click is a compact add-on board that accurately keeps the time of a day. This board features the PCF2123, an SPI configurable real-time clock/calendar optimized for low power operations from NXP Semiconductors. The PCF2123 provides year, month, day, weekday, hours, minutes, and seconds based on a 32.768kHz quartz crystal. Data is transferred serially via an SPI interface with a maximum data rate of 6.25 Mbit/s. An alarm and timer function is also available, providing the possibility to generate a wake-up signal on an interrupt line, in addition to a programmable square-wave clock output.

rtc13_click.png

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jul 2021.
  • Type : SPI type

Software Support

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

Standard key functions :

  • rtc13_cfg_setup Config Object Initialization function.

    void rtc13_cfg_setup ( rtc13_cfg_t *cfg );
  • rtc13_init Initialization function.

    err_t rtc13_init ( rtc13_t *ctx, rtc13_cfg_t *cfg );
  • rtc13_default_cfg Click Default Configuration function.

    err_t rtc13_default_cfg ( rtc13_t *ctx );

Example key functions :

  • rtc13_get_time RTC 13 get time function.

    err_t rtc13_get_time ( rtc13_t *ctx, rtc13_time_t *rtc_time );
  • rtc13_set_time RTC 13 set time function.

    err_t rtc13_set_time ( rtc13_t *ctx, rtc13_time_t rtc_time );
  • rtc13_get_date RTC 13 get date function.

    err_t rtc13_get_date ( rtc13_t *ctx, rtc13_date_t *rtc_date );

Example Description

This is an example that demonstrates the use of the RTC 13 Click board™.

The demo application is composed of two sections :

Application Init

Initialization of SPI module, log UART and additional pins. After driver initialization and default settings, the app set the time to 23:59:50 and set the date to 04.08.2021.


void application_init ( void )
{
    log_cfg_t log_cfg;      /**< Logger config object. */
    rtc13_cfg_t rtc13_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.

    rtc13_cfg_setup( &rtc13_cfg );
    RTC13_MAP_MIKROBUS( rtc13_cfg, MIKROBUS_1 );
    err_t init_flag  = rtc13_init( &rtc13, &rtc13_cfg );
    if ( SPI_MASTER_ERROR == init_flag )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    rtc13_default_cfg ( &rtc13 );
    log_info( &logger, " Application Task " );
    Delay_ms ( 100 );

    date.weekday = 3;
    date.day = 4;
    date.month = 8;
    date.year = 21;
    rtc13_set_date( &rtc13, date );
    Delay_ms ( 100 );

    time.hours = 23;
    time.min = 59;
    time.sec = 50;
    rtc13_set_time( &rtc13, time );
    Delay_ms ( 100 );
}

Application Task

This is an example that shows the use of a RTC 13 Click board™. In this example, we read and display the current time and date, which we also previously set. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB changes every 1 sec.


void application_task ( void )
{  
    rtc13_get_time( &rtc13, &time );
    Delay_ms ( 1 );
    rtc13_get_date( &rtc13, &date );
    Delay_ms ( 1 );

    if ( time.sec != new_sec ) 
    {
        log_printf( &logger, "  Date      : %.2d-%.2d-%.2d\r\n", ( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
        log_printf( &logger, "  Time      : %.2d:%.2d:%.2d\r\n", ( uint16_t ) time.hours, ( uint16_t ) time.min, ( uint16_t ) time.sec );
        log_printf( &logger, "- - - - - - - - - - - -\r\n" );
        new_sec = time.sec;
        Delay_ms ( 1 );
     }
}

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

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

Boost 2 click

5

Boost 2 click is a DC-DC step-up (boost) regulator that has a fixed 5V output, which can be obtained from any low voltage input - such as NiCd, NiMH or one cell Li-Po/Li-Ion batteries.

[Learn More]

Driver 2 Click

0

Driver 2 Click is a compact add-on board that contains a gate driver with a level-shift technology with an additional Shutdown function. This board features the IR2104S, a high voltage, high-speed power MOSFET and IGBT driver with typical 0.21 A source and 0.36 A sink currents and independent high and low side referenced output channels from Infineon Technologies.

[Learn More]

DC Motor 13 Click

0

DC Motor 13 Click is a compact add-on board with a brushed DC motor driver. This board features the TB67H481FNG, a dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor that uses the PWM IN interface to control the DC motor outputs. Fabricated with the BiCD process (DMOSFET is used for output power transistor), it covers a wide operating voltage range of 8.2V to 44V with a maximum output current capacity of 2A. It also offers helpful features like a robust and reliable operation, like the decay modes selection function, PWM constant-current drive, torque settings, protection features, and one anomaly detection indicator.

[Learn More]