keil4出现目标未被创建_求助KEIL目标没有产生怎么办,高人们看看怎么解决啊?...

);

in3(du[tt3]);

out3();

delay1(200);

}

}

/**********************键盘*****************************************/

void BB(uint i)

{

uint a,b;

for(a=i;a>0;a--)

{

for(b=50;b>0;b--);

fen=~fen;

}

}

void key()

{

uchar j,shi,fen,miao,xq,nian,yue,ri;

display();

nian=time[0]/16*10+time[0]%16;

xq    =time[1]/16*10+time[1]%16;

yue =time[2]/16*10+time[2]%16;

ri  =time[3]/16*10+time[3]%16;

shi =time[4]/16*10+time[4]%16;

fen =time[5]/16*10+time[5]%16;

miao=time[6]/16*10+time[6]%16;

if(!k1)

{

delay(5);

if(!k1)

{

BB(100);

while(!k1);

j++;

if(j==8)

{

j=0;

}

}

}

if(j!=0)

{

if(!k2)

{

delay(5);

if(!k2)

{

BB(100);

while(!k2);

if(j==1)

{

miao++;

if(miao>59)

{

miao=0;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[6],miao/10*16+miao%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==2)

{

fen++;

if(fen>59)

{

fen=0;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[5],fen/10*16+fen%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==3)

{

shi++;

if(shi>23)

{

shi=0;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[4],shi/10*16+shi%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==4)

{

xq++;

if(xq>7)

{

xq=1;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[1],xq/10*16+xq%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==5)

{

ri++;

if(((yue==1)||(yue==3)||(yue==5)||(yue==7)||(yue==8)||

(yue==10)||(yue==12))&&(ri>31))

{

ri=1;

}

if(((yue==4)||(yue==6)||(yue==9)||(yue==11))&&(ri>30))

{

ri=1;

}

if(yue==2)

{

if(((nian%4==0)&&(nian%100!=0))||(nian%400==0))

{

if(ri>29)

{

ri=1;

}

}

else

{

if(ri>28)

{

ri=1;

}

}

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[3],ri/10*16+ri%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==6)

{

yue++;

if(yue>12)

{

yue=1;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[2],yue/10*16+yue%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==7)

{

nian++;

if(nian>99)

{

nian=0;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[0],nian/10*16+nian%10);

write_dat_ds1302(0x8e,0x80);

}

}

}

if(!k3)

{

delay(5);

if(!k3)

{

BB(100);

while(!k3);

if(j==1)

{

miao--;

if(miao==-1)

{

miao=59;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[6],miao/10*16+miao%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==2)

{

fen--;

if(fen==-1)

{

fen=59;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[5],fen/10*16+fen%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==3)

{

shi--;

if(shi==-1)

{

shi=23;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[4],shi/10*16+shi%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==4)

{

xq--;

if(xq<1)

{

xq=7;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[1],xq/10*16+xq%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==5)

{

ri--;

if(((yue==1)||(yue==3)||(yue==5)||(yue==7)||(yue==8)||

(yue==10)||(yue==12))&&(ri<1))

{

ri=31;

}

if(((yue==4)||(yue==6)||(yue==9)||(yue==11))&&(ri<1))

{

ri=30;

}

if((yue==2))

{

if((nian%4==0)&&(nian%100!=0)||(nian%400==0))

{

if(ri<1)

{

ri=29;

}

}

else

{

if(ri<1)

{

ri=28;

}

}

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[3],ri/10*16+ri%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==6)

{

yue--;

if(yue<1)

{

yue=12;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[2],yue/10*16+yue%10);

write_dat_ds1302(0x8e,0x80);

}

if(j==7)

{

nian--;

if(nian<0)

{

nian=99;

}

write_dat_ds1302(0x8e,0x00);

write_dat_ds1302(write_add[0],nian/10*16+nian%10);

write_dat_ds1302(0x8e,0x80);

}

}

}

}

if(!k4)

{

delay(5);

if(!k4)

{

BB(100);

while(!k4);

j=0;

}

}

}

/*****************主函数************************************************/

void main()

{

set_time();

while(1)

{

key();

}

}

这个是DS1302的程序#include"ds1302.h"

void write_byte_ds1302(uchar dat)

{

uchar i;

ACC=dat;

for(i=8;i>0;i--)

{

io=ACC0;

sclk=1;

sclk=0;

ACC>>=1;

}

}

uchar read_byte_ds1302()

{

uchar i;

for(i=0;i<8;i++)

{

ACC>>=1;

ACC7=io;

sclk=1;

sclk=0;

}

return (ACC);

}

void write_dat_ds1302(uchar add,uchar dat)

{

rst=0;

sclk=0;

rst=1;

write_byte_ds1302(add);

write_byte_ds1302(dat);

sclk=1;

sclk=0;

rst=0;

sclk=1;

}

uchar read_dat_ds1302(uchar add)

{

uchar value;

rst=0;

sclk=0;

rst=1;

write_byte_ds1302(add);

value=read_byte_ds1302();

sclk=1;

sclk=0;

rst=0;

sclk=1;

return value;

}

这个是ds18b20的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值