⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 111._c

📁 温度测量ds18b20.rar
💻 _C
字号:
//ICC-AVR application builder : 2008/11/19 20:51:44
// Target : M8
// Crystal: 8.0000Mhz

#include <iom8v.h>
#include <macros.h>
#include "mydelay.h"
#include "ds18b20.h"

void delay1s(void)
{
 unsigned char i,j,k;
 for (i=100;i>0;i--)
  for (j=100;j>0;j--)
   for (k=20;k>0;k--)
    ;
}
void port_init(void)
{
 PORTB = 0x00;
 DDRB  = 0xff;
 PORTC = 0x00; //m103 output only
 DDRC  = 0x00;
 PORTD = 0x00;
 DDRD  = 0xff;
}

//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();

 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

void main(void)
{
 unsigned int data;
 init_devices(); 
 while(1)
 {
   convert();
   data=rdtemp();
   PORTB=data;
   PORTD=data>>8;
 delay1s();
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -