資源簡介
數字溫度計,有程序有仿真,有文檔,很全很強大!!!!
代碼片段和文件信息
#include?“reg51.h“
sbit?DQ?=P3^3;???//定義通信端口
unsigned?char?A1A2A3A2tdispno;
unsigned?char?code?table[]={0x3f0x060x5b0x4f0x660x6d0x7d0x070x7f0x6f0x00};
unsigned?int?temp1;
//延時函數
void?delay(unsigned?int?i)
{
?while(i--);
}
//初始化函數
Init_DS18B20(void)
{
?unsigned?char?x=0;
?DQ?=?1;????//DQ復位
?delay(8);??//稍做延時
?DQ?=?0;????//單片機將DQ拉低
?delay(80);?//精確延時?大于?480us
?DQ?=?1;????//拉高總線
?delay(14);
?x=DQ;??????//稍做延時后?如果x=0則初始化成功?x=1則初始化失敗
?delay(20);
}
//讀一個字節
ReadOneChar(void)
{
unsigned?char?i=0;
unsigned?char?dat?=?0;
for?(i=8;i>0;i--)
?{
??DQ?=?0;?//?給脈沖信號
??dat>>=1;
??DQ?=?1;?//?給脈沖信號
??if(DQ)
???dat|=0x80;
??delay(4);
?}
?return(dat);
}
//寫一個字節
WriteOneChar(unsigned?char?dat)
{
?unsigned?char?i=0;
?for?(i=8;?i>0;?i--)
?{
??DQ?=?0;
??D
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7548??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20
?????文件???????1966??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.c
?????文件???????3521??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.hex
?????文件?????????47??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.lnp
?????文件???????4665??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.LST
?????文件??????11836??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.M51
?????文件???????6969??2007-08-02?09:58??數字溫度計\ds18b20\ds18b20c\ds18b20.OBJ
?????文件???????1074??2008-12-25?10:16??數字溫度計\ds18b20\ds18b20c\ds18b20.Opt
?????文件????????172??2008-12-25?10:16??數字溫度計\ds18b20\ds18b20c\ds18b20.plg
?????文件???????2151??2008-12-23?22:28??數字溫度計\ds18b20\ds18b20c\ds18b20.Uv2
?????文件???????7518??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du
?????文件???????2014??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.c
?????文件???????3529??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.hex
?????文件?????????51??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.lnp
?????文件???????4775??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.LST
?????文件??????11911??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.M51
?????文件???????6941??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\ds18b20du.OBJ
?????文件???????1088??2008-12-25?10:21??數字溫度計\ds18b20\ds18b20c\ds18b20du.Opt
?????文件????????174??2008-12-25?10:21??數字溫度計\ds18b20\ds18b20c\ds18b20du.plg
?????文件???????2153??2008-12-25?10:21??數字溫度計\ds18b20\ds18b20c\ds18b20du.Uv2
?????文件???????1088??2007-08-03?13:51??數字溫度計\ds18b20\ds18b20c\ds18b20du_Opt.Bak
?????文件???????2142??2007-08-02?10:55??數字溫度計\ds18b20\ds18b20c\ds18b20du_Uv2.Bak
?????文件???????1083??2008-12-23?22:28??數字溫度計\ds18b20\ds18b20c\ds18b20_Opt.Bak
?????文件???????2140??2007-08-02?10:52??數字溫度計\ds18b20\ds18b20c\ds18b20_Uv2.Bak
?????文件???????5115??2002-04-16?15:32??數字溫度計\ds18b20\ds18b20c\STARTUP.A51
?????文件??????11665??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\STARTUP.LST
?????文件????????749??2007-08-02?10:54??數字溫度計\ds18b20\ds18b20c\STARTUP.OBJ
?????文件??????79629??2008-05-27?21:40??數字溫度計\ds18b20\ds18b20p\ds18b20.DSN
?????文件???????1054??2008-12-25?12:45??數字溫度計\ds18b20\ds18b20p\ds18b20.PWI
?????文件??????79631??2007-08-03?13:52??數字溫度計\ds18b20\ds18b20p\Last?Loaded?ds18b20.DBK
............此處省略12個文件信息
- 上一篇:STM32實現交通燈設計
- 下一篇:純真IP整理器
評論
共有 條評論