┊ 网站导航 ┊ 管理登陆 ┊ 免责声明 ┊ 问题反馈 ┊ 友链说明┊本站部分内容来自网络共享资源,如有冒犯您的权利请来信告之删除或纠正! 不得对本站进行复制、盗链或镜像,转载内容须获得同意或授权;欢迎友情链接、站务合作! ![]() ![]() ![]() ![]() ![]() ![]() 本站学习交流群:138..158(高级群1-满)、77930286(高级群2)、61804809(群3) Copyright© MCUSY All Rights Reserved 本站网警备案号: WZ36040002485 ICP备案证书号:粤ICP备09034963号 |
日历时钟DS12887/146818的C51源程序 #define uchar unsigned char #define uint unsigned int #include <reg52.h> #include <stdio.h> #include <absacc.h> #include <math.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #define P128870 XBYTE[0xa000] #define P128871 XBYTE[0xa001] #define P128872 XBYTE[0xa002] #define P128873 XBYTE[0xa003] #define P128874 XBYTE[0xa004] #define P128875 XBYTE[0xa005] #define P128876 XBYTE[0xa006] #define P128877 XBYTE[0xa007] #define P128878 XBYTE[0xa008] #define P128879 XBYTE[0xa009] #define P12887a XBYTE[0xa00a] #define P12887b XBYTE[0xa00b] #define P12887c XBYTE[0xa00c] #define P12887d XBYTE[0xa00d] #define P12887e XBYTE[0xa00e] #define P12887f XBYTE[0xa00f] void setup12887(uchar *p); void read12887(uchar *p); void start12887(void); void setup12887(uchar *p) //设置系统时间 { uchar i; i=P12887d; P12887a=0x70; P12887b=0xa2; P128870=*p++; P128871=0xff; P128872=*p++; P128873=0xff; P128874=*p++; P128875=0xff; P128876=*p++; P128877=*p++; P128878=*p++; P128879=*p++; P12887b=0x22; P12887a=0x20; i=P12887c; } void read12887(uchar *p) //读取系统时间 { uchar a; do{ a=P12887a; } while((a&0x80)==0x80); *p++=P128870; *p++=P128872; *p++=P128874; *p++=P128876; *p++=P128877; *p++=P128878; *p++=P128879; } void start12887(void) //启动时钟 { uchar i; i=P12887d; P12887a=0x70; P12887b=0xa2; P128871=0xff; P128873=0xff; P128875=0xff; P12887b=0x22; P12887a=0x20; i=P12887c; }
┊ 网站导航 ┊ 管理登陆 ┊ 免责声明 ┊ 问题反馈 ┊ 友链说明┊本站部分内容来自网络共享资源,如有冒犯您的权利请来信告之删除或纠正! 不得对本站进行复制、盗链或镜像,转载内容须获得同意或授权;欢迎友情链接、站务合作! ![]() ![]() ![]() ![]() ![]() ![]() 本站学习交流群:138..158(高级群1-满)、77930286(高级群2)、61804809(群3) Copyright© MCUSY All Rights Reserved 本站网警备案号: WZ36040002485 ICP备案证书号:粤ICP备09034963号 |