开心就好 发表于 2012-5-16 08:23:05

ChipKIT Uno32上实现RTCC实时时钟功能!

ChipKIT Uno32上实现RTCC实时时钟功能,Uno32的PIC32是自带RTC功能的,这个要比arduino实在一点,Uno32板上也预留了RTC的功能,就是没焊实时时钟的 32.768Khz 晶体 ,正好手头的项目中很多这个晶体,于是拿到Uno32就直接焊上了(有点冲动,呵呵)!
http://www.eeboard.com/data/myspace/71/357997/bbs/2012-05-16/1337127453_ee8105a0.jpg

言归正传,测试程序源码如下:#include <RTCC.h>

void setup()
{
Serial.begin(9600);

// Initialize the RTCC module
RTCC.begin();

// Set the time to something sensible
RTCC.hours(9);
RTCC.minutes(59);
RTCC.seconds(0);
RTCC.year(11);
RTCC.month(05);
RTCC.day(9);

// Set the alarm to trigger every second
RTCC.alarmMask(AL_SECOND);
RTCC.chimeEnable();
RTCC.alarmEnable();

// Attach our routine to send the time through the serial port
RTCC.attachInterrupt(&outputTime);
}

void loop()
{
}

void outputTime()
{
char time;

// Format the time and print it.
sprintf(time,"%02d/%02d/%02d %02d:%02d:%02d\n",
    RTCC.day(),
    RTCC.month(),
    RTCC.year(),
    RTCC.hours(),
    RTCC.minutes(),
    RTCC.seconds()
);
Serial.print(time);
}库文件:
注:库放置位置参考我的另一个帖子 http://www.geek-workshop.com/forum.php?mod=viewthread&tid=944&extra=page%3D1%26filter%3Dauthor%26orderby%3Ddateline%26orderby%3Ddateline

Randy 发表于 2012-5-16 09:10:09

问一下,UNO 32和arduino 写程序方式有啥区别呢?看起来没太大的区别哦!

开心就好 发表于 2012-5-16 09:28:31

程序是基本一样的

zhaoyonghhb 发表于 2015-5-21 14:15:39

你好!咨询下我想实现 2015-05-21 19:30:15时间控制I/O口输出。请问怎么提取实时时间比较,或者怎么实现
页: [1]
查看完整版本: ChipKIT Uno32上实现RTCC实时时钟功能!