单片机温度计设计.C(3): warning C318: can't open file 'DS18b20.h'
单片机温度计设计.C(4): warning C318: can't open file 'eeprom52.h'
单片机温度计设计.C(5): warning C318: can't open file 'Nixie tube.h'
单片机温度计设计.C(39): warning C206: 'Nixietube': missing function-prototype
单片机温度计设计.C(39): error C267: 'Nixietube': requires ANSI-style prototype
单片机温度计设计.C - 1 Error(s), 4 Warning(s).
- #include <reg52.h>
- #include "intrins.h"
- #include "DS18b20.h"
- #include "eeprom52.h"
- #include "Nixie tube.h"
- #define uchar unsigned char
- #define uint unsigned int
- uchar code ss[]=
- {
- 0xc0,0xf9,0xa4,0xb0,0x99,
- 0x92,0x82,0xf8,0x80,0x90
- };
- uchar code ss1[]=
- {
- 0x40,0x79,0x24,0x30,0x19,
- 0x12,0x02,0x78,0x00,0x10,
- 0xc7,0x89,0xbf
- };
- uchar ms;
- sbit key1=P3^4;
- sbit key2=P3^5;
- sbit key3=P3^3;
- sbit led_0=P1^0;
- sbit led_2=P1^2;
- char H,L;
- uchar flag;
- sbit beep=P1^6;
- bit s0,beep_1=1;
- int temp,i;
- void delay(uint T)
- {
- while(T--);
- }
- void display()
- {
- if(flag==0&&temp>=0)
- {
- if(temp>999) Nixietube(ss[temp/1000%10],ss[temp/100%10],ss1[temp/10%10],ss[temp%10]);
- if(temp>99) Nixietube(0xff,ss[temp/100%10],ss1[temp/10%10],ss[temp%10]);
- if(temp<99&&temp/100%10<=0) Nixietube(0xff,0xff,ss1[temp/10%10],ss[temp%10]);
- }
- if(flag==0&&temp<0)
- {
- if(temp*-1/100%10<=0) Nixietube(0xff,ss1[12],ss1[temp*-1/10%10],ss[temp*-1%10]);
- if(temp*-1/100%10>0) Nixietube(ss1[12],ss[temp*-1/100%10],ss1[temp*-1/10%10],ss[temp*-1%10]);
- }
- if(flag==1)
- {
- if(H>99) Nixietube(ss1[11],ss[H/100],ss[H%100/10],ss[H%10]);
- if(H>=10&&H<=99) Nixietube(ss1[11],0xff,ss[H/10],ss[H%10]);
- if(H<10&&H>=0) Nixietube(ss1[11],0xff,0xff,ss[H%10]);
- if(H<0&&H>=-9) Nixietube(ss1[11],0xff,ss1[12],ss[H*-1%10]);
- if(H<0&&H<-9) Nixietube(ss1[11],ss1[12],ss[H*-1%100/10],ss[H*-1%10]);
- }
- if(flag==2)
- {
- if(L>99) Nixietube(ss1[10],ss[L/100],ss[L%100/10],ss[L%10]);
- if(L>=10&&L<=99) Nixietube(ss1[10],0xff,ss[L/10],ss[L%10]);
- if(L<10&&L>=0) Nixietube(ss1[10],0xff,0xff,ss[L%10]);
- if(L<0&&L>=-9) Nixietube(ss1[10],0xff,ss1[12],ss[L*-1%10]);
- if(L<0&&L<-9) Nixietube(ss1[10],ss1[12],ss[L*-1%100/10],ss[L*-1%10]);
- }
-
- }
- void key()
- {
-
- if(!key1)
- {
- delay(500);
- if(!key1)
- {
- while(!key1);
- if(flag==1)
- {
- if(H<125)H++;
- SectorErase(0x2000);
- byte_write(0x2000,H);
- }
- else if (flag==2)
- {
- if(L<H-1) L++;
- SectorErase(0x2200);
- byte_write(0x2200,L);
- }
- }
- }
- if(!key2)
- {
- delay(500);
- if(!key2)
- {
- while(!key2);
- if(flag==1)
- {
- if(H>L+1) H--;
- SectorErase(0x2000);
- byte_write(0x2000,H);
- }
- else if (flag==2)
- {
- if(L>-55)L--;
- SectorErase(0x2200);
- byte_write(0x2200,L);
- }
- }
- }
- if(!key3)
- {
- delay(1000);
- if(!key3)
- {
- while(!key3);
- flag=(flag+1)%3;
- }
- }
- }
- void alarm()
- {
- if(temp/10>=H||temp/10<=L)
- {
- beep_1=0;
- }
- else
- {
- beep_1=1;
- }
- if(temp/10>=H)
- {
- led_0=0;
- }
- else
- {
- led_0=1;
- }
-
- if(temp/10<=L)
- {
- led_2=0;
- }
- else
- {
- led_2=1;
- }
- }
- void main()
- {
- do
- {
- temp=Temper();
- }
- while(temp==850);
- delay(1000);
- H=byte_read(0x2000);
- L=byte_read(0x2200);
- if((H>99)||(L>99)||(L>=H))
- {
- H=35;
- L=16;
- }
- TMOD=0x01;
- TH0=(65536-10000)/256;
- TL0=(65536-10000)%256;
- EA=1;
- ET0=1;
- TR0=1;
-
- while(1)
- {
- key();
- alarm();
-
-
- }
- }
- void UART_1() interrupt 1
- {
- TH0=(65536-10000)/256;
- TL0=(65536-10000)%256;
- ms++;
- display();
- if(ms>100)
- {
- ms=0;
- temp=Temper();
- }
- if(ms%5==0)
- {
- if(beep_1==0)
- {
- beep=!beep;
- }
- else
- {
- beep=1;
- }
- }
- }
复制代码
|