|
這是一款數碼管可顯示負值的DS18B20測溫程序,程序在PROTEUS7.8仿真軟件下通過仿真運行,下面是仿真截圖。
18B20測溫仿真
18B20測溫仿真
程序:
- #define _MAIN_C_
- #include <reg52.h>
- #include "typedef.h"
- #include "main.h"
- #include "device_init.h"
- #include "display.h"
-
- main()
- {
- init_various();
- while(1)
- {
- if(b10msEvent)
- {
- b10msEvent = false;
- dynamic_display(); //顯示
- if(b500msEvent)
- {
- b500msEvent = false;
- set_temp_data(); //讀溫度
- }
- }
- }
- }
- /*********************************************
- * 定時器0中斷
- *********************************************/
- void timer0(void) interrupt 1
- {
- static u8 SecCount = 0;
- TH0 = TH0HIGH;
- TL0 = TL0LOWW;
- b10msEvent = true; //10毫秒中斷
- if(++SecCount == 50)
- {
- SecCount = 0;
- b500msEvent = true; //1秒到時
- }
- }
復制代碼
數碼管顯示51單片機DS18B20溫度測量源程序及仿真.rar
(431.52 KB, 下載次數: 308)
2016-5-27 23:18 上傳
點擊文件名下載附件
|
評分
-
查看全部評分
|