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;//清标志
}
}
}
{
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;//清标志
}
}
}
S3C2440实时时钟RT 相关文章:
- 五 ARM9(S3C2440)的实时时钟(RTC)-理论知识及程序实例讲解(11-27)
- S3C2440 实时时钟RTC(11-21)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)