电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

HT1380时钟芯片C语言源代码

HT1380时钟芯片C语言源代码_第1页
1/7
HT1380时钟芯片C语言源代码_第2页
2/7
HT1380时钟芯片C语言源代码_第3页
3/7
#ifndef _HT1380_H_ #define _HT1380_H_ //#include "ht1380.h" //读数据长度 #define Long_ReadData (uint8)3//7 //读取的数据转换成显示数据 #define ClockSwitch_TSEC(x) ((x>>4)&0X07)*10 + (x&0x0f) #define ClockSwitch_TMIN(x) ((x>>4)&0X07)*10 + (x&0x0f) #define ClockSwitch_THOR(x) ((x>>4)&0x03)*10 + (x&0x0f) //显示数据转换成读取的数据 -- 设置时间时 #define ClockSwitchB_TSEC(x) (((x/10)<<4) + (x%10)) #define ClockSwitchB_TMIN(x) (((x/10)<<4) + (x%10)) #define ClockSwitchB_THOR(x) (((x/10)<<4) + (x%10)) /* //----HT1381----DS1302 #define P_SLK1380 PB2_OUT #define P_DAT1380Out PB3_OUT #define P_DAT1380In PB3_IN #define P_RST1380 PB4_OUT */ //==================================== extern void HT1380SetTime(uint8 *pSecDa) ; extern void HT1380ReadTime(uint8 *ucCurtime) ; extern void Init_TH1380(void) ; extern void ClockSwitchMCU(uint8 *ClockDat,uint8 *McuDat ) ; extern void MCUSwitchClock(uint8 *McuDat,uint8 *ClockDat) ; #endif #include "global.h" #include "ht1380.h" #define HT1380OSC_ENB (uint8)0X00 //振荡使能 #define HT1380OSC_DIS (uint8)0X80 #define MCLOCK24H (uint8)0x00 //24H 制 #define MCLOCK12H (uint8)0x80 //----------------------------- #define HT1380SLK_HIGH P_SLK1380 = 1 #define HT1380SLK_LOW P_SLK1380 = 0 #define HT1380DAT_HIGH P_DAT1380Out = 1 #define HT1380DAT_LOW P_DAT1380Out = 0 #define HT1380RST_HIGH P_RST1380 = 1 #define HT1380RST_LOW P_RST1380 = 0 //读数据端口 #define HT1380DatIn P_DAT1380In //----------------------------------------- void delay1380(void) { uint8 i = 0 ; for(i=10;i>0;i--) { _asm("nop"); _asm("nop"); _asm("nop"); _asm("nop"); _asm("nop"); _asm("nop"); _asm("nop"); } } /******************************************************************** * * 名称: HT1380WriteByte * 说明: * 功能: 往 HT1381 写入 1Byte 数据 * 调用: * 输入: ucDa 写入的数据 * 返回值: 无 ******************...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

HT1380时钟芯片C语言源代码

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部