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-18
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: RTC
Downloaded: 12845 times
Followed by: 1 user
License: MIT license
Example for RTC click board in mikroBUS form factor. It is a simple demonstration how to read/write date and time from PCF8583 RTC (real-time clock). Date and time are read from the RTC every 10 milliseconds and printed on LCD. Communication with the board is done via I2C interface;
Do you want to subscribe in order to receive notifications regarding "RTC click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "RTC click" changes.
Do you want to report abuse regarding "RTC click".
Front and back view of RTC 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 Click board.
RTC Click communicates with the target board via I2C protocol.
This library contains drivers for write and read data from PCF8583 chip, functions for sets time and date, gets time and date, enable and disable counting, for enable and disable alarms, for sets time and date alarms, etc.
Key functions:
void rtc_setTime( uint8_t timeHours, uint8_t timeMinutes, uint8_t timeSeconds, uint8_t timeHunSec )
- Set time hours, minutes, seconds and hundredth of a seconds function.void rtc_getTime( uint8_t *timeHours, uint8_t *timeMinutes, uint8_t *timeSeconds, uint8_t *timeHunSec )
- Get time hours, minutes, seconds and hundredth of a seconds function.Examples description
The application is composed of the three sections :
void applicationTask() { rtc_getTime( &timeHours, &timeMinutes, &timeSeconds, &timeHunSec ); 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 ); mikrobus_logWrite( "------------------", _LOG_LINE ); timeSecondsNew = timeSeconds; } Delay_1ms(); }
Additional Functions :
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.