#include "LCD 1602define.h "
# contains "18b20.h"
# Define uchar unsigned characters
Void delayms (unsigned integer count); //Delay program
Void delayms (unsigned integer count)
{
Unsigned int i, j;
for(I = 0; I < count; i++)
for(j = 0; j & lt 120; j++);
}
* * * * * * * * * * * Main program * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Master ()
{
uchar tem_h,tem _ l;
Wuqia I, Su [7];
uint tem
delayms( 1000); //Start the delay program
LCD _ initial(); //LCD initialization
LCD _ clr all();
/* * * * * In order to avoid displaying the temperature of 85°C at the 1 reading * * * * * *
tem = read temperature(); //Read the temperature value
tem _ h = tem/ 10+0x 30; //High temperature
tem _ l = tem % 10+0x 30; //Low temperature
delayms( 1000); //Delay program
/***************************************/
LCD _ cursor(0); //Cursor start address, the first line address is 0x00~0x0F, and the second line address is 0x40~0x4f.
LCD_prints(" DS 18B20 test ");
LCD _ cursor(0x 40);
LCD_prints ("temperature:");
//////LCD1602 display degree-day' c//////
LCD _ cursor(0x4e);
LCD _ printc(0x df);
LCD _ cursor(0x4f);
LCD _ printc(0x 43);
while( 1)
{
tem = read temperature(); //Read the temperature value
tem _ h = tem/ 10+0x 30; //High temperature
tem _ l = tem % 10+0x 30; //Low temperature
//////The LCD shows the temperature//////
LCD _ cursor(0x4c);
LCD _ printc(tem _ h);
LCD _ cursor(0x4d);
LCD _ printc(tem _ l);
}
}