代码拉取完成,页面将自动刷新
#include"1302.h"
#include"12232.h"
#include"keynew.h"
#include"delay.h"
#include "warning.h"
#define uchar unsigned char
#define uint unsigned int
void Write1302 ( uchar addr,dat )
{
uchar i,temp;
CE=0;
SCLK=0;
CE=1;
for ( i=8; i>0; i-- )
{
SCLK = 0;
temp = addr;
DIO = (bit)(temp&0x01);
addr >>= 1;
SCLK = 1;
}
for ( i=8; i>0; i-- )
{
SCLK = 0;
temp = dat;
DIO = (bit)(temp&0x01);
dat >>= 1;
SCLK = 1;
}
CE = 0;
}
uchar Read1302 ( uchar addr )
{
uchar i,temp,dat1,dat2;
CE=0;
SCLK=0;
CE = 1;
for ( i=8; i>0; i-- )
{
SCLK = 0;
temp = addr;
DIO = (bit)(temp&0x01);
addr >>= 1;
SCLK = 1;
}
for ( i=8; i>0; i-- )
{
ACC_7=DIO;
SCLK = 0;
ACC>>=1;
SCLK = 1;
}
CE=0;
dat1=ACC;
dat2=dat1/16;
dat1=dat1%16;
dat1=dat1+dat2*10;
return (dat1);
}
void Initial(void)
{
Write1302 (WRITE_PROTECT,0X00);
Write1302 (WRITE_SECOND,0x00);
Write1302 (WRITE_MINUTE,0x00);
Write1302 (WRITE_HOUR,0x12);
Write1302 (WRITE_PROTECT,0x80);
}
uchar Hex_To_ASCII(uchar bHex)
{
if((bHex>=0)&&(bHex<=9))
bHex += 0x30;
else if((bHex>=10)&&(bHex<=15))
bHex += 0x37;
else bHex = 0xff;
return bHex;
}
/***********************************************************/
uchar ASCII_To_Hex(uchar bChar)
{
if((bChar>=0x30)&&(bChar<=0x39))
bChar -= 0x30;
else if((bChar>=0x41)&&(bChar<=0x46))
bChar -= 0x37;
else if((bChar>=0x61)&&(bChar<=0x66))
bChar -= 0x57;
else bChar = 0xff;
return bChar;
}
void tadj()
{uchar h,m,pq,s;
LCD_clear();
LCD_write_com(0x80);
LCD_write_zfc("õǰʱ");
LCD_write_com(0x91);
h=Read1302 (READ_HOUR);
timeb(h);
LCD_write_zfc("");
m=Read1302 (READ_MINUTE);
timeb(m);
LCD_write_zfc("");
s=Read1302 (READ_SECOND);
timeb(s);
do{
LCD_write_com(0x91);
timeb(h);
LCD_write_com(0x91);
LCD_write_com(0x0f);
if(key_scan()==1)
{h+=1;if(h>24)h=1;}
if(key_scan()==2)
{h-=1;if(h>24)h=24;}
delay_ms(130);
}while(key_scan()!=4);
do
{LCD_write_com(0x93);
timeb(m);
LCD_write_com(0x93);
LCD_write_com(0x0f);
if(key_scan()==1)
{m+=1;if(m>59)m=1;}
if(key_scan()==2)
{m-=1;if(m>59)m=59;}
delay_ms(130);
}while(key_scan()!=4);
do
{LCD_write_com(0x95);
timeb(s);
LCD_write_com(0x95);
LCD_write_com(0x0f);
if(key_scan()==1)
{s+=1;if(s>59)s=1;}
if(key_scan()==2)
{s-=1;if(s>59)s=59;}
delay_ms(130);
}while(key_scan()!=4);
LCD_write_com(0x0c);
Write1302 (WRITE_PROTECT,0X00);
pq=h/10;
h=h%10;
h=(pq<<4)|h;
Write1302 (WRITE_HOUR,h);
pq=m/10;
m=m%10;
m=(pq<<4)|m;
Write1302 (WRITE_MINUTE,m);
pq=s/10;
s=s%10;
s=(pq<<4)|s;
Write1302 (WRITE_SECOND,s);
Write1302 (WRITE_PROTECT,0x80);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。