微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > PIC16F877A例程---DS18B20

PIC16F877A例程---DS18B20

时间:11-24 来源:互联网 点击:

asm("NOP");

if (DS18B20) // "1" presented

temp.c[1] |= tmp;

tmp=tmp<1;

US_delay(2);

}

t=((float) temp.x)/16.0 ;

return t;

}

void itoa10(unsigned char *buf, int i)

{

unsigned int rem;

unsigned char *s,length=0;

s = buf;

if (i == 0)

*s++ = 0;

else

{

if (i < 0)

{

*buf++ = -;

s = buf;

i = -i;

}

while (i)

{

++length;

rem = i % 10;

*s++ = rem + 0;

i /= 10;

}

for(rem=0; ((unsigned char)rem)

{

*(buf+length) = *(buf+((unsigned char)rem));

*(buf+((unsigned char)rem)) = *(buf+(length-((unsigned char)rem)-1));

*(buf+(length-((unsigned char)rem)-1)) = *(buf+length);

}

}

*s=0;

}

void US_delay( int i)

{

unsigned char j;

while(i--)

{

j=3;

while(j--);

}

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top