您好,欢迎访问三七文档
#ifndef_DS1302_#define_DS1302_#includeconfig.h//**********************DS1302管脚定义**********************///*DS1302复位脚*/#defineRESET_CLRP6OUT&=~BIT7//电平置低#defineRESET_SETP6OUT|=BIT7//电平置高#defineRESET_INP6DIR&=~BIT7//方向输入#defineRESET_OUTP6DIR|=BIT7//方向输出/*DS1302双向数据*/#defineIO_CLRP6OUT&=~BIT6//电平置低#defineIO_SETP6OUT|=BIT6//电平置高#defineIO_RP6IN&BIT6//电平读取#defineIO_INP6DIR&=~BIT6//方向输入#defineIO_OUTP6DIR|=BIT6//方向输出/*DS1302时钟信号*/#defineSCK_CLRP6OUT&=~BIT5//时钟信号#defineSCK_SETP6OUT|=BIT5//电平置高#defineSCK_INP6DIR&=~BIT5//方向输入#defineSCK_OUTP6DIR|=BIT5//方向输出/*DS1302命令与相关地址*/#defineDS1302_sec_add0x80//秒数据地址#defineDS1302_min_add0x82//分数据地址#defineDS1302_hr_add0x84//时数据地址#defineDS1302_date_add0x86//日数据地址#defineDS1302_month_add0x88//月数据地址#defineDS1302_day_add0x8a//星期数据地址#defineDS1302_year_add0x8c//年数据地址#defineDS1302_control_add0x8e//控制数据地址#defineDS1302_charger_add0x90#defineDS1302_clkburst_add0xbevoidDS1302_write_byte(unsignedcharaddr,unsignedchard);unsignedcharDS1302_read_byte(unsignedcharaddr);voidDS1302_init(void);voidDS1302_write_time(void);voidDS1302_read_time(void);#endif
本文标题:DS1302.H
链接地址:https://www.777doc.com/doc-6350088 .html