|
熱敏電阻溫度計(jì)仿真原理圖:
0.png (31.85 KB, 下載次數(shù): 61)
下載附件
2017-6-3 17:06 上傳
0.png (69.29 KB, 下載次數(shù): 77)
下載附件
2017-6-3 17:05 上傳
單片機(jī)源程序如下:
- #include<reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- //
- unsigned char code dispbitcode[]=
- {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
- //
- //
- unsigned char code LEDcode[]=
- {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40};
- //
- //
- unsigned char dispbuf[8]={10,10,10,10,10,10,0,0};
- //
- unsigned char dispcount;
- unsigned int uiResult;
- bit sflag;
- sbit START=P3^1;
- sbit OE=P3^0;
- sbit EOC=P3^2;
- sbit P17=P1^7;
- //
- void delay(uint z) //延時函數(shù),約1ms
- {
- uint x,y;
- for(x=z;x>0;x--)
- for(y=110;y>0;y--);
- }
- void Display()
- {for(dispcount=0;dispcount<5;dispcount++)
- {P2=0xff;
- P1=LEDcode[dispbuf[dispcount]];
- if(dispcount==3)
- {P17=1;}
- P2=dispbitcode[dispcount];
- delay(1);
- P2=0xff;
- }
- }
- //
- void ADC0809()
- {
- unsigned char i;
- unsigned long y;
- // START=0;
- START=1;
- START=0;
- P0=0Xff;
- //EOC=1;
- while(EOC==0);
- OE=1;
- uiResult=P0;
- OE=0;
- y=uiResult;
- uiResult=(y*2516)/128;
- if(uiResult<2732)
- { uiResult=2732-uiResult;sflag=1;}
- else
- { uiResult=uiResult-2732;sflag=0;}
- i=4;
- dispbuf[1]=0;
- dispbuf[2]=0;
- dispbuf[3]=0;
- dispbuf[4]=0;
- if(sflag==1)
- { dispbuf[0]=11;}
- else
- { dispbuf[0]=10;}
- dispbuf[5]=10;
- dispbuf[6]=10;
- dispbuf[7]=10;
- while(uiResult/10)
- {dispbuf[i]=uiResult%10;
- uiResult=uiResult/10;
- i--;
- }
- dispbuf[i]=uiResult;
- }
- //
- void main(void)
- {
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
熱敏電阻溫度計(jì).zip
(111.31 KB, 下載次數(shù): 28)
2017-6-3 16:22 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
評分
-
查看全部評分
|