在维修中对于一些不定时变化的测量数据,很难判断,有了这个,就方便多了.
调试过程说明
STC15W4K最高实验用于27MHZ晶体,用30MHZ温度18B20不正常工作
在高速的晶体下写入EEPROM时要等待几十毫秒的写入时间。
// w_testeeprom();//24C测试
// led =~led;
// for(i=0;i<65535;i++);
// //w_ascii_8x16();
// led =~led;
// for(i=0;i<65535;i++);
// r_testeeprom();//24C测试
// led =~led;
// for(i=0;i<65535;i++);
// //xianshiwendu(0,40);////温度显示
r_pcf8563();//读时钟
xianshi_shijian(0,50); //显示一行时间// 2018-10-27
wendulerbiao();//显示温度列表2017-02-27//
//r_testeeprom();//24C测试
led =~led;
for(i=0;i<65535;i++);
eeprom_xianshishijian(16,40);//显示记录时间表//显示一个时间表由K2输入
key_shijian();//调节时间2018-10-28
单片机源程序如下:
- #include"stc15w4k.h"
- #include"lcd.h"
- #include"18b20.h"
- #include"at24cxx.h"
- //#include"ht1380.h"
- #include"pcf85.h"
- u8 xdata i_temp;
- u8 xdata wendu_w;//温度写入标志位//
- void w_ascii_8x16()
- {
- i_temp++;
- ascii_8x16(0,0, "abcdefghijklmn");
- //aascii_0_9(0,57,(i_temp>>4)&0x0f);//指定地址写入数字
- //aascii_0_9(0,60,i_temp&0x0f);//指定地址写入数字
- aascii_0_9(0,54,i_temp/100);//指定地址写入数字
- aascii_0_9(0,57,i_temp%100/10);//指定地址写入数字
- aascii_0_9(0,60,i_temp%10);//指定地址写入数?
- }
- //ascii_8x16(u8 x,u8 y,u8
- void shao()
- {
- LCD_PutString(0,0,"邵建雄");//写入-判断是ASCII还是汉字//
- }
- void xianshiwendu(u8 xx,u8 yy)////温度显示
- {//晶振要用12MHZ//
- u16 xdata wendu;
- u8 xdata k;
- //xx=33;
- //yy=0;
- EA=0;
- wendu=rr18b20();//读出温度//
- EA=1;
- LCD_PutString(xx,yy,"温度");//写入-判断是ASCII还是汉字//
- wendu=(u16)((u32)wendu*625/1000);
- if(k=wendu/100)aascii_0_9(xx,yy+13,k);//100指定地址写入数字
- else ascii_8x16(xx,yy+13," ");
-
- k=wendu%100/10;
- aascii_0_9(xx,yy+16,k);//100指定地址写入数字
- ascii_8x16(xx,yy+19,".");
-
- k=wendu%10;
-
- aascii_0_9(xx,yy+21,k);//100指定地址写入数字
- ascii_8x16(xx,yy+25,"C");
-
-
- //EA=1;
-
-
- }
- //..........................................................................................
- /*
- 温度时间存于0X0F,0XE0
- 温度存于0X0F,0XF0
- */
- void wendulerbiao()//显示温度列表2017-02-27//
- { u8 xdata shijian1_12[]={1,2,3,4,5,6,7,8,9,0x10,0x11,0x12};//时钟
- u8 xdata wen_du0_9[]={0,1,2,3,4,5,6,7,8,9,0x10,0x11};//用于记录10小时前的数据//
- // u8 idata i,k,xx,yy,ex,ey,wen_du0_max,wen_du0_min;
- u8 xdata i,k,xx,yy,ex,ey,wen_du0_max,wen_du0_min;
- u8 xdata h1,h2,h3,h4,h5;
- //u8 idata bershu,wen_du0_max_r,wen_du0_min_r;//温度倍数//
- u8 xdata bershu,wen_du0_max_r,wen_du0_min_r;//温度倍数//
- //u16 wendu_r;
- u16 xdata wendu_r;
-
- h1=0x10;
- h2=0x20;
- h3=0x30;
- h4=0x40;
- h5=0x50;
- read_24cxx_n(0x0f,0xe0,12);//连续读12时间字节//
- for(i=0;i<12;i++)
- {
- shijian1_12[i]=at24c32[i];//读写24CXX//
-
-
- }
- read_24cxx_n(0x0f,0xf0,12);//连续读12温度字节//
- for(i=0;i<12;i++)
- {
- wen_du0_9[i]=at24c32[i];//读写24CXX//
-
-
- }
-
- xianshiwendu(0,10);////温度显示
-
- wendu_r=rr18b20();//读出温度//
- wendu_r=(u16)((u32)wendu_r*625/1000);
- k=wendu_r/100;
- //ascii_12x12_12x6_bye(90,50,(k));//12x6宽6高12写入 字节//2017-2-25
- k=(k<<4)+(wendu_r%100/10);//+优先级比<<高//
-
- if((fen==0)&&(mao<3)&&(wendu_w==0))//(fen==0)&&
- {
-
- for(i=0;i<11;i++) //把温度数据向前记录一次//
- {
-
- wen_du0_9[i]=wen_du0_9[i+1];//温度列表//
- shijian1_12[i]=shijian1_12[i+1];//时间列表//
-
- }
- ////////////////////
- wen_du0_9[11]=k;
- shijian1_12[11]=shi;
- /////////写入///////////////////
- for(i=0;i<12;i++)
- {
- at24c32[i]=shijian1_12[i];//写24CXX//
-
-
- }
- write_24cxx(0x0f,0xe0,12);//写入12个字节时间字节//
- st7529_delay1(20); //24CXX页写要10MS等等时间//
- for(i=0;i<12;i++)
- {
-
- at24c32[i]=wen_du0_9[i];//写24CXX//
-
- }
- write_24cxx(0x0f,0xf0,12);//写入12个字节温度字节//
- st7529_delay1(20);
- ////////////////////////////////////
- ////////////////////////////
- wendu_w=1;//温度写入标志位//
- // xx=80;
- //
- // ex=125;
- // yy=3;
- // ey=yy+60;
- // yishu(xx,ex,yy,ey,0);//清除图形区域//
- clr_st7529();//从255X160清所有地址位?/清除图形区域//
- //...................................................
- // //.......................//温度图形显示2017-2-28..........................//
- // //if(fen==0x10);
- // //yilie(125,0,1,1);//127行0列写入1列高亮,ler列显示试验//
- //
- //
- //
- //
- // //yishu(80,127,0,1,1);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- // xx=57;//80;//57--125
- //
- // ex=125;
- // yy=3;
- // ey=4;
- // //.............显示窗口..........................................................................
- // //yishu(71,125,0,1,0x20);////一竖显示以 六 点为一竖0x3f=0011 1111//
- // yishu(xx-1,ex,0,1,0x20);////一竖显示以 六 点为一竖0x3f=0011 1111//
- // //yishu(71,125,83,84,0x01);////一竖显示以 六 点为一竖//
- // yishu(xx-1,ex,83,84,0x01);////一竖显示以 六 点为一竖0x3f=0011 1111//
- // yiler_w(ex,ex+1,yy-3,yy+81,0x3f);///0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- // yiler_w(xx,xx,0,84,0x3f);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- // //................显示温度虚线...每次写入6个点.............//
- // //yiler_w(ex-5,ex-5,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- // yiler_w(ex-10,ex-10,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- //
- //
- // yiler_w(ex-20,ex-20,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- //
- //
- // yiler_w(ex-30,ex-30,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- //
- //
- // yiler_w(ex-40,ex-40,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//.
- // yiler_w(ex-50,ex-50,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//.
- //...................................................
- }
- if(mao>10)//温度写入标志位//fen==1
- {
- wendu_w=0;//温度写入标志位//
-
- }
- ascii_12x12_12x6_bye(16,0,wendu_w);//12x6宽6高12写入 字节//2017-2-25
- xx=28;
- yy=2;
- for(i=0;i<12;i++)//时间列表//
- {
- if(shijian1_12[i]>>4)ascii_12x12_12x6_bye(xx,yy,(shijian1_12[i]>>4));//12x6宽6高12写入 字节//2017-2-25
- else ascii_12x12_12x6(xx,yy," ");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+2,(shijian1_12[i]&0x0f));//12x6宽6高12写入 字节//2017-2-25
- yy+=6;
- }
- ascii_12x12_12x6(xx,yy-2,":");//12x6宽6高12写入//2017-2-25
- //ascii_12x12_12x6(xx,yy,"00");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy,(fen>>4));//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+2,(fen&0x0f));//12x6宽6高12写入 字节//2017-2-25
-
- ascii_12x12_12x6(xx,yy+4,":");//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(xx,yy+6,(mao>>4));//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+8,(mao&0x0f));//12x6宽6高12写入 字节//2017-2-25
- xx=xx+15;
- yy=2;
- for(i=0;i<12;i++)//温度列表//
- {
- if(wen_du0_9[i]>>4)ascii_12x12_12x6_bye(xx,yy,(wen_du0_9[i]>>4));//12x6宽6高12写入 字节//2017-2-25
- else ascii_12x12_12x6(xx,yy," ");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+2,(wen_du0_9[i]&0x0f));//12x6宽6高12写入 字节//2017-2-25
- yy+=6;
- }
-
- ascii_12x12_12x6(xx,yy+2,"C");//12x6宽6高12写入//2017-2-25
-
- //.......................//温度图形显示2017-2-28..........................//
- //if(fen==0x10);
- //yilie(125,0,1,1);//127行0列写入1列高亮,ler列显示试验//
-
-
-
-
- //yishu(80,127,0,1,1);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- xx=57;//80;//57--125
-
- ex=125;
- yy=3;
- ey=4;
- //.............显示窗口..........................................................................
- //yishu(71,125,0,1,0x20);////一竖显示以 六 点为一竖0x3f=0011 1111//
- yishu(xx-1,ex,0,1,0x20);////一竖显示以 六 点为一竖0x3f=0011 1111//
- //yishu(71,125,83,84,0x01);////一竖显示以 六 点为一竖//
- yishu(xx-1,ex,83,84,0x01);////一竖显示以 六 点为一竖0x3f=0011 1111//
- yiler_w(ex,ex+1,yy-3,yy+81,0x3f);///0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- yiler_w(xx,xx,0,84,0x3f);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- //................显示温度虚线...每次写入6个点.............//
- //yiler_w(ex-5,ex-5,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
- yiler_w(ex-10,ex-10,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
-
-
- yiler_w(ex-20,ex-20,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
-
-
- yiler_w(ex-30,ex-30,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//
-
-
- yiler_w(ex-40,ex-40,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//.
- yiler_w(ex-50,ex-50,0,84,0x01);//////0x3f全亮在一个窗口里写入或清屏TEMP=0清屏//=0x3f就填充//.
- //.......................测试高度值....................................
- // wen_du0_9[0]=0x15;//相差10
- // wen_du0_9[1]=0x16;
- // wen_du0_9[2]=0x17;
- // wen_du0_9[3]=0x18;
- // wen_du0_9[4]=0x19;
- // wen_du0_9[5]=0x20;
- // wen_du0_9[6]=0x21;
- // wen_du0_9[7]=0x22;
- // wen_du0_9[8]=0x23;
- // wen_du0_9[9]=0x24;
- // wen_du0_9[10]=0x25;
- // wen_du0_9[11]=0x24;
- //.........15.........
- // wen_du0_9[0]=0x15;//相差10
- // wen_du0_9[1]=0x17;
- // wen_du0_9[2]=0x19;
- // wen_du0_9[3]=0x21;
- // wen_du0_9[4]=0x23;
- // wen_du0_9[5]=0x25;
- // wen_du0_9[6]=0x27;
- // wen_du0_9[7]=0x29;
- // wen_du0_9[8]=0x30;
- // wen_du0_9[9]=0x32;
- // wen_du0_9[10]=0x34;
- // wen_du0_9[11]=0x36;
- //................寻找最大最小值..把最大值放在上面线,最小值放在下面线...测试温度处理图形表...................................
- wen_du0_max=wen_du0_9[0];//0;寻找最大//
- wen_du0_min=wen_du0_9[0];//0x50寻找最小值//
- for(i=0;i<12;i++)//wen_du0_r寻找最小的数值//
- {
-
- //if(wen_du0_9[i]>wen_du0_max)wen_du0_max=wen_du0_9[i];
- //if(wen_du0_9[i]<wen_du0_min)wen_du0_min=wen_du0_9[i];
- if(wen_du0_9[i]>wen_du0_max)wen_du0_max=wen_du0_9[i];
- if(wen_du0_9[i]<wen_du0_min)wen_du0_min=wen_du0_9[i];
-
- }
- //....处理wen_du0_r值....
- // if(wen_du0_max>0x10);
- // else if(wen_du0_max>0x20);
- // else if(wen_du0_max>0x30);
- // else wen_du0_max=0;
- //..................计算图形高度差......BCD->HEX......HEX->BCD..........................................//
- wen_du0_max_r=wen_du0_max;
- wen_du0_min_r=wen_du0_min; //把BCD码转为16进//
-
- wen_du0_min_r=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- wen_du0_max_r=((wen_du0_max>>4)*0x0a)+(wen_du0_max&0x0f);///BCD码转16进数bcd->16h//
- //...................................................
- if((wen_du0_max_r-wen_du0_min_r)>=20)
- {
-
- i=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- k=i+20;
- h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //............................
-
- k=i+15;
- h4=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+10;//5;
- h3=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+5;//3;
- h2=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- h1=wen_du0_min;
- bershu=2;//温度倍数//
- }
- else if((wen_du0_max_r-wen_du0_min_r)>=15)
- {
- i=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- k=i+19;
- h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //............................
-
- k=i+15;
- h4=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+10;
- h3=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+5;
- h2=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- h1=wen_du0_min;
- bershu=2;//温度倍数//
- }
- else if((wen_du0_max_r-wen_du0_min_r)>=10)
- {
- i=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- k=i+10;
- h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //............................
-
- k=i+8;
- h4=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+5;
- h3=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+2;
- h2=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- h1=wen_du0_min;
- bershu=4;//温度倍数//
- }
- else if((wen_du0_max_r-wen_du0_min_r)>5)
- {
-
- // h1=wen_du0_min;
- // //h5=wen_du0_min+0x05;//wen_du0_max;
- // k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+5;///BCD码转16进数bcd->16h//
- // h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //...........................
-
-
- i=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- k=i+8;
- h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //............................
-
- k=i+6;
- h4=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+4;
- h3=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- k=i+2;
- h2=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- h1=wen_du0_min;
- bershu=5;//温度倍数//yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- }
- else if((wen_du0_max_r-wen_du0_min_r)<=5)
- {
-
- //h5=wen_du0_min+0x04;//wen_du0_max;
- i=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f);///BCD码转16进数bcd->16h//
- //k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+4;
- k=i+4;
- h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
-
- //............................
- //k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+3;///BCD码转16进数bcd->16h//
- k=i+3;
- h4=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- //k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+2;///BCD码转16进数bcd->16h//
- k=i+2;
- h3=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- //k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+1;///BCD码转16进数bcd->16h//
- k=i+1;
- h2=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- //h4=k/4;
- h1=wen_du0_min;
- bershu=10;//温度倍数//
-
- }
-
- /*
- //16进转BCD码//2017-03-07//
- temp=pBuff[i]/10;
- time[i]=pBuff[i]%10+temp*16;
- 演变为h5=((k/10)*16)+(k%10);//16进转BCD码//2017-03-07//
- ////BCD码转16进数bcd->16h//
- temp =pBuff[i] / 16;
- pBuff[i] = temp * 10 + pBuff[i] % 16;
- 演变为k=((wen_du0_min>>4)*0x0a)+(wen_du0_min&0x0f)+4;///BCD码转16进数bcd->16h//
-
- */
- //..........................显示虚线数字温度...................................//
- //ascii_12x12_12x6(ex-12,78,"10");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(ex-12,78,(h1>>4));//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(ex-12,80,(h1&0x0f));//12x6宽6高12写入 字节//2017-2-25
-
- ascii_12x12_12x6_bye(ex-24,78,h2>>4);//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(ex-24,80,h2&0x0f);//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(ex-38,78,(h3>>4));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(ex-38,80,(h3&0x0f));//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(ex-50,78,(h4>>4));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(ex-50,80,(h4&0x0f));//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(ex-60,78,(h5>>4));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(ex-60,80,(h5&0x0f));//12x6宽6高12写入//2017-2-25
- //......................................................................................//
- wen_du0_min_r=wen_du0_min;
- if(wen_du0_min_r>>4)
- {
- wen_du0_min_r=((wen_du0_min_r>>4)*0x0a)+(wen_du0_min_r&0x0f);
- }
- //yishu(xx,yy,ex,ey,0);//一竖显示以 六 点为一竖//
- k=wen_du0_9[0];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k-),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[1];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[2];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[3];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[4];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[5];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[6];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[7];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[8];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[9];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[10];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- yy=yy+4;
- ey=yy+1;
- k=wen_du0_9[11];
- if(k>>4)
- {
- k=((k>>4)*0x0a)+(k&0x0f);
- }
- //yishu((ex-k),ex,yy,ey,0x3f);////一竖显示以 六 点为一竖//
- yishu((ex-((k-wen_du0_min_r)*bershu)-10),ex,yy,ey,0x3f);//////一竖显示以 六 点为一竖0x3f=0011 1111//
- //........................................................................//
- // htrr();//读时钟//
- // shifenmao(0,50);//指定地址写入时间表//
- // laozhong(0x12,0x05);//12:10时间到蜂鸣叫//
- // laozhong(0x13,0x12);//13:17时间到蜂鸣叫//
- // laozhong(0x18,0x05);//时间到蜂鸣叫//
- // laozhong_BZZ(0x1200);//时间到蜂鸣叫//
- //......................显示最大最小值........................................//
- xx=58;
- yy=10;
- ascii_12x12_12x6(xx,yy,"max");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+6,(wen_du0_max>>4));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+8,(wen_du0_max&0x0f));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6(xx,yy+12,"min");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+18,(wen_du0_min>>4));//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(xx,yy+20,(wen_du0_min&0x0f));//12x6宽6高12写入//2017-2-25
- }
- void eeprom_xianshishijian(u8 x,u8 y)//显示记录时间表//显示一个时间表由K2输入
- {
- // u8 xx,yy;
- if(k2_inc==0)
- {
- st7529_delay1(3);
- if(k2_inc==0)
- {
- BBZZ(255);
- at24c32[0]=shi>>4;
- at24c32[1]=shi&0x0f;
-
- at24c32[2]=fen>>4;
- at24c32[3]=fen&0x0f;
-
- at24c32[4]=mao>>4;
- at24c32[5]=mao&0x0f;
- write_24cxx(0,0x60,6);//d 0x0012EEPROM写入6个字节 写入 最大12个字节//
- st7529_delay1(20);
-
- }
-
- }
- read_24cxx_n(0,0x60,6);//连续读12时间字节//
- // xx=17;
- // yy=20;
- if(at24c32[0])ascii_12x12_12x6_bye(x,y,at24c32[0]);//12x6宽6高12写入//2017-2-25
- else ascii_12x12_12x6(x,y," ");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(x,y+2,at24c32[1]);//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6(x,y+4,":");//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(x,y+6,at24c32[2]);//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(x,y+8,at24c32[3]);//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6(x,y+10,":");//12x6宽6高12写入//2017-2-25
-
- ascii_12x12_12x6_bye(x,y+12,at24c32[4]);//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(x,y+14,at24c32[5]);//12x6宽6高12写入//2017-2-25
- }
- void xianshi_shijian(u8 x,u8 y) //显示一行时间// 2018-10-27
- { //r_pcf8563();//读时钟
- // y=y+10;
- // if(yifen>>4)ascii_12x12_12x6_bye(x,y,yifen>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+2,yifen&0x0f);//12x6宽6高12写入 字节//2017-2-25
- // ascii_12x12_12x6(x,y+4,"-");//12x6宽6高12写入//2017-2-25
- // if(riqi>>4)ascii_12x12_12x6_bye(x,y+6,riqi>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y+6," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+8,riqi&0x0f);//12x6宽6高12写入 字节//2017-2-25
-
- if(shi>>4)ascii_12x12_12x6_bye(x,y+12,shi>>4);//12x6宽6高12写入 字节//2017-2-25
- else ascii_12x12_12x6(x,y+12," ");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(x,y+14,shi&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6(x,y+16,":");//12x6宽6高12写入//2017-2-25
-
- //if(fen>>4)
- ascii_12x12_12x6_bye(x,y+18,fen>>4);//12x6宽6高12写入 字节//2017-2-25
- //else ascii_12x12_12x6(x,y+18," ");//12x6宽6高12写入//2017-2-25
- ascii_12x12_12x6_bye(x,y+20,fen&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6(x,y+22,":");//12x6宽6高12写入//2017-2-25
-
-
- ascii_12x12_12x6_bye(x,y+24,mao>>4);//12x6宽6高12写入 字节//2017-2-25
-
- ascii_12x12_12x6_bye(x,y+26,mao&0x0f);//12x6宽6高12写入 字节//2017-2-25
-
- // ascii_12x12_12x6(x,y+28,"open");//12x6宽6高12写入//2017-2-25
- // //..........................................................
- //
- //
- // if(yifen>>4)ascii_12x12_12x6_bye(x,y+40,yifen>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y+40," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+42,yifen&0x0f);//12x6宽6高12写入 字节//2017-2-25
- // ascii_12x12_12x6(x,y+44,"-");//12x6宽6高12写入//2017-2-25
- // if(riqi>>4)ascii_12x12_12x6_bye(x,y+46,riqi>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y+46," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+48,riqi&0x0f);//12x6宽6高12写入 字节//2017-2-25
- //
- // if(shi>>4)ascii_12x12_12x6_bye(x,y+52,shi>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y+52," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+54,shi&0x0f);//12x6宽6高12写入 字节//2017-2-25
- // ascii_12x12_12x6(x,y+56,":");//12x6宽6高12写入//2017-2-25
- //
- // if(fen>>4)ascii_12x12_12x6_bye(x,y+58,fen>>4);//12x6宽6高12写入 字节//2017-2-25
- // else ascii_12x12_12x6(x,y+58," ");//12x6宽6高12写入//2017-2-25
- // ascii_12x12_12x6_bye(x,y+60,fen&0x0f);//12x6宽6高12写入 字节//2017-2-25
- // ascii_12x12_12x6(x,y+62,":");//12x6宽6高12写入//2017-2-25
- //
- //
- // ascii_12x12_12x6_bye(x,y+64,mao>>4);//12x6宽6高12写入 字节//2017-2-25
- //
- // ascii_12x12_12x6_bye(x,y+66,mao&0x0f);//12x6宽6高12写入 字节//2017-2-25
- //
- // ascii_12x12_12x6(x,y+68,"cl");//12x6宽6高12写入//2017-2-25
- //
-
-
- }
- void w_testeeprom()//24C测试 32k= 0xfffh
- {
- at24c32[0]=0x01;
- at24c32[1]=0x23;
- at24c32[2]=0x45;
- at24c32[3]=0x67;
- at24c32[4]=0x89;
- at24c32[5]=0x98;
- at24c32[6]=0x76;
- at24c32[7]=0x54;
- write_24cxx(0x05,0,8);//写入i个字节//
- }
- void r_testeeprom()//24C测试
- {
- u8 x=16,y=20;
- at24c32[0]=0;
- at24c32[1]=0;
- at24c32[3]=0;
- at24c32[2]=0;
- at24c32[4]=0;
- at24c32[5]=0;
- at24c32[6]=0;
- at24c32[7]=0;
- // read_24cxx_n(0x05,0,4);//连续读4字节//
- read_24cxx_n(0x05,0,8);//连续读4字节//
- ascii_12x12_12x6_bye(x, y,at24c32[0]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+2,at24c32[0]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+6,at24c32[1]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+8,at24c32[1]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+12,at24c32[2]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+14,at24c32[2]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+18,at24c32[3]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+20,at24c32[3]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+23,at24c32[4]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+25,at24c32[4]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+28,at24c32[5]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+30,at24c32[5]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+33,at24c32[6]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+35,at24c32[6]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+38,at24c32[7]>>4);//12x6宽6高12写入 字节//2017-2-25
- ascii_12x12_12x6_bye(x,y+40,at24c32[7]&0x0f);//12x6宽6高12写入 字节//2017-2-25
- }
- u8 bcd_add_dce(u8 i)//BCD加法进位与借位
- {
-
- u8 j;
- if((i&0x0f)==0x0a)
- {
- j=i+6;
- return j;
-
- }
- //if(i==0xff) return -1;
- if((i&0x0f)==0x0f)
- {
- if(i==0xff)return i;
- j=i-6;
-
- return j;
-
- }
- return i;
- }
- void key_shijian()//调节时间2018-10-28
- {
- u32 delay10s;
- u8 wei_k;
-
- if(k1_muen==0)
- { wei_k = 0;
- Delay_ms(10);
- do{
- if(k1_muen==0)
- {
- //wei_k = 0;
- st7529_delay1(10); //27mhz
- ////
- if(k1_muen==0)
- {
- BBZZ(255);//蜂鸣器子程序
- delay10s=1355350;
- wei_k++;
- if(wei_k==3)wei_k=0;
- ascii_12x12_12x6_bye(0,0,wei_k);//12x6宽6高12写入 字节//2017-2-25
-
-
- }
- while(!k1_muen);
-
- }
- if(k2_inc==0) //加一
- {
- st7529_delay1(30);
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
stc15w4k56s4_7135_2019-4-14 - 副本.rar
(236.54 KB, 下载次数: 20)
|