2、s.h>#defineucharunsignedchar//无符号字符0-255#defineuintunsignedint//无符号整型0-65535#defineCYCLE_1_00x698//1688us#defineCYCLE_1_50x9E4//2532#defineCYCLE_2_00xD30//3376us#defineTH_CYCLE_1_0(CYCLE_1_0>>8>#defineTH_CYCLE_1_5(CYCLE_1_5>>8>#defineTH_CYCLE_2_0(CYCLE_2_0>>8>//用于解码
3、的变量unsignedintSAA3010RecvCode=0。//保存解码数值<1个控制位5个地址位6个命令位>p1EanqFDPwunsignedcharSAA3010BitCount=0。//记录已经解码的位数DXDiTa9E3dunsignedcharSAA3010State=0。//初始状态sbitrelayout0=P1^0。sbitrelayout1=P1^1。sbitrelayout2=P1^2。sbitrelayout3=P1^3。sbitrelayout4=P1^4。charcodeTab[16]="012
4、3456789ABCDEF"。sbitACC0=ACC^0。sbitACC7=ACC^7。sbitP3_2=P3^2。sbitP3_4=P3^4。sbitT_CLK=P1^6。/*实时时钟时钟线引脚*/sbitT_IO=P3^5。/*实时时钟数据线引脚*/sbitT_RST=P1^7。/*实时时钟复位线引脚*/sbitAdd_Key=P3^6。//加1键,S1sbitDec_Key=P3^7。//减1键,S2sbitOK_Key=P2^0。//确定键,S3sbitBell_Out=P2^1。//闹钟管脚输出。低电平有效sbit
5、DQ=P2^3。//ds1820data//这三个引脚参考资料sbitE=P2^7。//1602使能引脚sbitRW=P2^6。//1602读写引脚sbitRS=P2^5。//1602数据/命令选择引脚29/29bitflag,secs=0,mins=0,hours=0,years=0,mons=0,days=0,weeks=0。//闪烁标志位RTCrpUDGiTbitBell_Swh,Hourb,Minb,Secb,Kgb。//闹钟调时闪烁标志位bitflag_min=0,flag_sec=0。//整点报警标志位unsign
6、edcharid,id2,d,e,S_1302,H_1302,H_Bell,S_Bell。//id为第几个调整对象,5PCzVD7HxAucharsec,min,hour,day,month,year,week。/************************************************************/jLBHrnAILg//函数声明voiddelay(>。voidDelay1(intnum>。//延时函数ucharbcdtodec(ucharbcd>。ucharConvert(ucharIn_
7、Date>。//形参主函数付的值uchardectobcd(uchardec>。voidDisp(void>。//显示和闪烁函数voidenable(uchardel>。voidid_case1_key(void>。//id为1时的下一级选择voidL1602_char(ucharhang,ucharlie,charsign>。voidL1602_init(void>。voidL1602_string(ucharhang,ucharlie,uchar*p>。voidRun_DS1302(void>。ucharuc_RTOutp
8、utByte(void>。voidv_BurstR1302R(uchar*pReDa>。voidv_BurstR1302T(uchar*pSecDa>。voidv_BurstW1302R(uchar*pReDa>。voidv_BurstW1302T(uchar*pSecDa>