Fireduino Buy

Dual-Core Cortex-M3 processor, integrated high-quality audio Codec and WiFi module, have IOT expansion performance, perfectly compatible with the Arduino interface and Arduino IDE programming, and supports FireBlock graphics programming.

RTC

Update time:2018-04-13 Views:1407

RTC -- HYM5863

HYM8563 is a low power CMOS real-time clock / calendar chip, which provides a programmable clock output, interrupt output and a brown-out detector, all of the address and data are communication with a serial I2C bus interface. The maximum bus speed of 400Kbit / s, each read and write data, built-in word address register is automatically incremented.

Fireduino RTC

Fireduino RTC use external devices for the I2C interface HYM5863, articulated in Wire1 Interface

Fireduino RTCTime Struct

//datetimeInfo structtypedef struct{unsigned short year;//year (1900 ~ 2099)unsigned char  mon;//month,begin from 1 to 12unsigned char  week;//week (0:Sunday 1:Monday ... 6:Saturday)unsigned char  day;//day,begin from 1 to 31unsigned char  hour;//hour,24-hourunsigned char  min;//minuteunsigned char  sec;//second}RTCTime;

Fireduino RTC API

getTime(RTCTime *time)

   Description
        Get RTCTime 
   Syntax
        RTC.getTime(&time);
   Parameter
        RTCTime type point
   Returns 
        None

setTime(RTCTime *time)

   Description 
         Set RTCTime 
   Syntax
         RTC.setTime(&time);
   Parameter 
         RTCTime type point
   Returns 
         None

Fireduino RTC Example

#include "Arduino.h"#include "Wire.h"#include "RTC.h"RTCTime time;void setup(void){
	Serial.begin(115200);
	Serial.print("\r\n FireDuino Setup ...\r\n");time.year  = 2016;//year (1900 ~ 2099)time.mon   = 3;//month,begin from 1 to 12time.week  = 1 ;//week (0:Sunday 1:Monday ... 6:Saturday)time.day   = 14;//day,begin from 1 to 31time.hour  = 23;//hour,24-hourtime.min   = 59;//minutetime.sec   = 50;//second
	Wire1.begin();
	RTC.setTime(&time);}void loop(void){
	delay(100);
	RTC.getTime(&time);
	Serial.println();
	Serial.print("Y:");
	Serial.print(time.year,DEC);
	Serial.print(" M:");
	Serial.print(time.mon,DEC);
	Serial.print(" W:");
	Serial.print(time.week,DEC);
	Serial.print(" d:");
	Serial.print(time.day,DEC);
	Serial.print(" h:");
	Serial.print(time.hour,DEC);
	Serial.print(" m:");
	Serial.print(time.min,DEC);
	Serial.print(" s:");
	Serial.print(time.sec,DEC);
	Serial.println();}