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]
Rating:
Author: MIKROE
Last Updated: 2019-01-29
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: RTC
Downloaded: 5871 times
Followed by: 7 users
License: MIT license
RTC5 click carries MCP79510, a real-time clock/calendar with an SPI interface. The example sets and reads the time, and displays it on the Lcd.
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 ".
Front and back view of 6DOF IMU click board designed in mikroBUS form factor. mikroBUS is specially designed pinout standard with SPI, I2C, Analog, UART, Interrupt, PWM, Reset and Power supply pins.
View full imageLibrary Description
The library covers all the necessary functions to control RTC 5 Click board. RTC 5 click communicates with the target board via SPI protocol. This library contains drivers for write and read data from MCP79510 chip, set time and date, get time and date, enable and disable counting, clear RTCC and SRAM memory, sets and gets first and secund alarm, set frequency, set special configuration function, etc.
Key functions:
void rtc5_setTime( uint8_t timeHours, uint8_t timeMinutes, uint8_t timeSeconds )
- Set time hours, minutes and seconds function.void rtc5_getTime( uint8_t *timeHours, uint8_t *timeMinutes, uint8_t *timeSeconds )
- Get time hours, minutes and seconds function.void rtc5_getDate( uint8_t *dayOfTheWeek, uint8_t *dateDay, uint8_t *dateMonth, uint16_t *dateYear )
- Get time hours, minutes and seconds function.Examples description
The application is composed of the three sections :
void applicationTask() { rtc5_getTime( &timeHours, &timeMinutes, &timeSeconds ); rtc5_getDate( &dayOfTheWeek, &dateDay, &dateMonth, &dateYear ); if ( timeSecondsNew != timeSeconds ) { mikrobus_logWrite( " Time : ", _LOG_TEXT ); displayLogUart( timeHours ); mikrobus_logWrite( ":", _LOG_TEXT ); displayLogUart( timeMinutes ); mikrobus_logWrite( ":", _LOG_TEXT ); displayLogUart( timeSeconds ); mikrobus_logWrite( "", _LOG_LINE ); displayLogDayOfTheWeek( dayOfTheWeek ); mikrobus_logWrite( " Date: ", _LOG_TEXT ); displayLogUart( dateDay ); mikrobus_logWrite( ".", _LOG_TEXT ); displayLogUart( dateMonth ); mikrobus_logWrite( ".", _LOG_TEXT ); mikrobus_logWrite( "20", _LOG_TEXT ); displayLogUart( dateYear ); mikrobus_logWrite( ".", _LOG_LINE ); mikrobus_logWrite( "------------------", _LOG_LINE ); timeSecondsNew = timeSeconds; } Delay_1ms(); }
Additional Functions :
void displayLogDayOfTheWeek( uint8_t dayOfTheWeek )
- Write day of the week log on USART terminal.void displayLogUart( uint8_t value )
- Write the value of time or date as a two-digit number.Other mikroE Libraries used in the example:
Additional notes and information
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.