微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机的ds1302驱动程序

51单片机的ds1302驱动程序

时间:12-01 来源:互联网 点击:

RCC_Clocks->SYSCLK_Frequency= (HSE_Value >>

for(i=8; i>

ACC = ACC >>

ds1302->

ds1302->

ds1302->

ds1302->

ds1302->

ds1302->

ds1302->

ds1302->timestr[0] = ds1302->

ds1302->timestr[1] = ds1302->

ds1302->

ds1302->

ds1302->

ds1302->timestr[3] = ds1302->

ds1302->timestr[4] = ds1302->

ds1302->

ds1302->

ds1302->

ds1302->timestr[6] = ds1302->

ds1302->timestr[7] = ds1302->

ds1302->

ds1302->

ds1302->

成液晶显示字符串,放到数组里DateString[]

{ if(flagyear<2) //这里的if,else语句都是判断位闪烁,<2显示数据,>2就不显示,输出字符串为 2007/07/22

{

ds1302->datestr[0] = 2;

ds1302->datestr[1] = 0;

ds1302->datestr[2] = ds1302->Year/10 + 0;

ds1302->datestr[3] = ds1302->Year%10 + 0;

}

else

{

ds1302->datestr[0] = ;

ds1302->datestr[1] = ;

ds1302->datestr[2] = ;

ds1302->datestr[3] = ;

}

ds1302->datestr[4] = /;

if(flagmonth<2)

{

ds1302->datestr[5] = ds1302->Month/10 + 0;

ds1302->datestr[6] = ds1302->Month%10 + 0;

}

else

{

ds1302->datestr[5] = ;

ds1302->datestr[6] = ;

}

ds1302->datestr[7] = /;

if(flagday<2)

{

ds1302->datestr[8] = ds1302->Day/10 + 0;

ds1302->datestr[9] = ds1302->Day%10 + 0;

}

else

{

ds1302->datestr[8] = ;

ds1302->datestr[9] = ;

}

if(flagweek<2)

{

week_value[0] = ds1302->Week%10 + 0;

   //星期的数据另外放到 week_value[]数组里,跟年,月,日的分开存放,因为等一下要在最后显示

}

else

{

week_value[0] = ;

}

week_value[1] = ;

ds1302->datestr[10] = ; //字符串末尾加 ,判断结束字符

}

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

网站地图

Top