// 串口工作于方式1
TH1=0xfD; //装入初值,11.0592MHZ的晶振,9600的波特率
TL1=0xfD;
TR1=1;
SCON=0x40;
//PCON=0x00; //波特率无倍增
TI=1; //开启定时器1开始工作
}
/****************************************************************/
void Read_calendar(void) //读取系统时间
{
unsigned char i;
REG_B=0x06;//0X06 0x20
do{ temp=REG_A;} //读积存器A
while(temp&0x80);//为1时间更新很快将要发生。既为1时一直读并判断
for(i=0;i<7;i++)
calendar_time[i]=*(calendar_address+at[i]); ///读时间
}
void Start_calendar(void) //启动时钟%%
{
unsigned char temp;
REG_A=0x20;
temp=REG_C;
temp=REG_D;
REG_B=0x06;
}
/*****************************************************************
void Stop_calendar(void)//停止时钟
{
REG_A=0x70;
}
*******************************************************************/
/****************************************************************
时钟显示
void Display_calendar(void)//下排7289
{
dat = (calendar_time[5]%10);//秒
ZLG7289_Download0(1,0,0,dat);
dat =(calendar_time[5]/10);
ZLG7289_Download0(1,1,0,dat);
dat = (calendar_time[4]%10);//分
ZLG7289_Download0(1,2,0,dat);
dat =(calendar_time[4]/10);
ZLG7289_Download0(1,3,0,dat);
dat=(calendar_time[3]%10);
ZLG7289_Download0(1,4,0,dat);//时
dat =(calendar_time[3]/10);
ZLG7289_Download0(1,5,0,dat);
}
************************************************************/
void addisplay (void)//电压显示
{
dat=result%10;//
ZLG7289_Download0(1,0,0,dat);//译码方式1
dat=result/1000;
ZLG7289_Download0(1,3,0,dat);
result=result/10;
dat=result%10;
ZLG7289_Download0(1,1,1,dat);//有小数点
result=result/10;
dat=result%10;
ZLG7289_Download0(1,2,0,dat);//下载数据
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-39167-36.html
好自为之
老美如果没多少牌了