微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > s3c2440实时时钟的应用

s3c2440实时时钟的应用

时间:11-19 来源:互联网 点击:
uartISP(void)
{
char ch;
static char temp;
static char count;
rSUBSRCPND |= 0x3;
rSRCPND |= 0x1<28;
rINTPND |= 0x1<28;

if(rUTRSTAT0 & 1)//接收数据处理部分
{

ch = rURXH0;//接收字节数据
if(ch==0xaa&&temp==0)//表示接收到修改时间的命令
{
temp=1;
count=0;
}
else if(temp==1)//接收时间数据
{
date_buffer[count]=ch;//依次存入时间数组内
count++;
if(count==7)//7个时间数据全部接收完毕
{
rUTXH0=0xaa;//发送0xAA
set_date();//设置时间
count=0;
temp=0;
flag=1;//更新LCD上显示的时间
}
}
else
rUTXH0=ch;//不是接收时间的命令

}
}

void Main(void)
{
//初始化寄存器,内容省略
……
Brush_Background(0xffffff);//LCD背景为白色
show_date();//在LCD上显示时间

flag=0;//清标志

while(1)
{
if(flag)//需要更新LCD上的显示时间
{
Brush_Background(0xffffff);
show_date();
flag=0;//清标志
}
}
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top