51单片机DS1302程序带仿真
#include"reg52.h" #define uchar unsigned char #define uint unsigned int sbit ds1302_rst=P3^4; sbit ds1302_io=P3^6; sbit ds1302_sclk=P3^5; uchar a[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uint miao; void delay(int n) { int i,j; for(i=0;i4)*10+(bcd&0x0f); return(c); } 转化成十进制数再进行处理 { uchar c; c=((bcd&0xf0)>>4)*10+(bcd&0x0f); return(c); }
用户评论