#include "1602.h"
#include "18b20.h"
#include "main.h"
__CONFIG(0X0B31);
main()
{
char msg[2][16] = {" Temperature: "," .C"};
delay_us2 (40, 40);
delay_us2 (100, 200);
initial();
while(1) {
start_convert();
change_to_ascii (get_temp (), &msg[1][3]);
display2(&msg[0][0],&msg[1][0]);
}
}
//------------------------us级延时----------------------------//
void delay_us2 (char x, char y)
{
char z;
do { z=y;
do {;} while(--z);
} while(--x);
}
//------------------------1秒延时--------------------------------//
void delay_1s(unsigned int x)
{
unsigned a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
//-----------------------------------------------------------------------//
void delay_us1 (char d)
{
while(--d) ;
}
18b20_c.rar
(20.47 KB, 下载次数: 27)
|