找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

帖子
查看: 5190|回復(fù): 2
收起左側(cè)

AVR16 AVR128的DS18B20溫度傳感器protues仿真與源碼

[復(fù)制鏈接]
ID:275720 發(fā)表于 2018-1-14 00:04 | 顯示全部樓層 |閱讀模式
單片機(jī)溫度計(jì)設(shè)計(jì)仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
0.png 0.png 0.png 0.png

有AVR16芯片和AVR128芯片2個(gè)版本

單片機(jī)源程序如下:
  1. /*-------------------------------
  2. 作者:小新
  3. email:xuxing1261207@126.com
  4. --------------------------------*/
  5. #include <iom16v.h>
  6. #include <macros.h>
  7. #include "lcd.h"
  8. #include "ds18b20.h"
  9. unsigned int  temp1=20,temp2=35;

  10. void main(void)
  11. {
  12.    unsigned char i=0;
  13.    
  14.    DDRD=0xff;
  15.    PORTD=0x00;
  16.    DDRC=0x00;
  17.    PORTC=0xFF;
  18.    CLI();
  19.    LCD_init();
  20.    SEI();
  21.    LCD_DisplayString(1,1,"Down:     Up:  ");
  22.    LCD_DisplayString(2,1,"T=");
  23.    while(1)
  24.    {
  25.      i=PINC;
  26.      if((i&0x01)==0)
  27.          {
  28.         //while(!(i&0x01));
  29.                   temp1++;
  30.          }
  31.          if((i&0x04)==0)
  32.          {
  33.             //while(!(i&0x04));
  34.                 temp1--;
  35.          }
  36.          
  37.          if((i&0x10)==0)
  38.          {
  39.         //while(!(i&0x01));
  40.                   temp2++;
  41.          }
  42.          if((i&0x40)==0)
  43.          {
  44.             //while(!(i&0x04));
  45.                 temp2--;
  46.          }
  47. ……………………

  48. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
DS18B20溫度傳感器protues仿真 avr16128 ds18b20單片機(jī)仿真程序.zip (183.14 KB, 下載次數(shù): 145)


評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:738803 發(fā)表于 2020-5-4 12:22 | 顯示全部樓層
老鐵,謝謝分享有用的資料!
回復(fù)

使用道具 舉報(bào)

ID:599609 發(fā)表于 2020-5-6 16:27 | 顯示全部樓層
非常感謝,還沒(méi)入門(mén)
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表