Optimize your engineering projects with efficient real-time clock, delivering reliable and accurate timekeeping for critical operations
A
A
Hardware Overview
How does it work?
RTC 12 Click is based on the DS1343, a low-current RTC that consumes an extremely low timekeeping current, permitting longer life from a backup supply source from Analog Devices. The devices provide a full binary-coded decimal clock calendar accessed by a simple serial interface. The clock/calendar provides information on seconds, minutes, hours, days, dates, months, and years. The month's end date is automatically adjusted for months with fewer than 31 days, including corrections for the leap year through 2099. The clock operates in either a 24-hour or 12-hour format with an AM/PM indicator. As performed on this Click board™, the most common configuration is a battery-backed-up RTC, which maintains time and may hold data in 96 bytes of NV RAM provided for data storage. In addition to
the DS1343, the RTC 12 Click is equipped with a button cell battery holder compatible with the 3000TR battery holder, suitable for 12mm Coin Cell batteries. Furthermore, it has a built-in temperature-compensated power-sense circuit that detects power failures and automatically switches to the backup supply, thus allowing for uninterrupted operation. The DS1343 communicates with MCU using the standard SPI serial interface that supports modes 1 and 3 with a maximum frequency of 4 MHz. It also provides two programmable time-of-day alarms. Each alarm can generate an interrupt on a programmable combination of seconds, minutes, hours, and days, available on the INT pin of the mikroBUS™ socket. The interrupt selection can be made by positioning the SMD jumper labeled INT SEL to an
appropriate position. Both interrupt outputs operate when the device is powered by mikroBUS™ power rails or backup supply voltage. In addition to the features mentioned above, the user can use another indicator routed to the AN pin of the mikroBUS™ socket labeled as PF to indicate a loss of a primary power supply, VCC, from mikroBUS™ power rails. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for RTC 12 Click driver.
Key functions:
rtc12_set_time
- RTC 12 set time functionrtc12_get_time
- RTC 12 get time functionrtc12_get_date
- RTC 12 get date function
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief Rtc12 Click example
*
* # Description
* This is an example that demonstrates the use of the RTC 12 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 27.05.'21.
*
* ## Application Task
* This is an example that shows the use of a RTC 12 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.
*
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "rtc12.h"
static rtc12_t rtc12;
static log_t logger;
static uint8_t new_sec = 255;
static rtc12_time_t time;
static rtc12_date_t date;
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
rtc12_cfg_t rtc12_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.
rtc12_cfg_setup( &rtc12_cfg );
RTC12_MAP_MIKROBUS( rtc12_cfg, MIKROBUS_1 );
err_t init_flag = rtc12_init( &rtc12, &rtc12_cfg );
if ( init_flag == SPI_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
rtc12_default_cfg ( &rtc12 );
log_info( &logger, " Application Task " );
Delay_ms( 100 );
date.day_of_week = 4;
date.day = 27;
date.month = 5;
date.year = 21;
rtc12_set_date( &rtc12, date );
Delay_ms( 100 );
time.hours = 23;
time.min = 59;
time.sec = 50;
rtc12_set_time( &rtc12, time );
Delay_ms( 100 );
}
void application_task ( void ) {
rtc12_get_time( &rtc12, &time );
Delay_ms( 1 );
rtc12_get_date( &rtc12, &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 );
}
}
void main ( void ) {
application_init( );
for ( ; ; ) {
application_task( );
}
}
// ------------------------------------------------------------------------ END