Home > other >  Who can complement that looked up, only the main function
Who can complement that looked up, only the main function

Time:10-06

Void main (void)
{
Uchar m;
Sys_init ();
Init_DS18B20 ();
While (presence)
{
Beep ();
Delayms (100);
Init_DS18B20 ();
}

WriteOneChar (0 XCC);
X44 WriteOneChar (0);
The display [6]=0 x0a;
Temperature_conver ();
For (m=0; M<60; M + +)
Temp_play ();
While (1)
{
Read_Temperature ();
Temperature_conver ();
For (m=0; M<60; M + +)
{
Temp_play ();
Scankey ();
Temp_compare ();
}
}
}
Void Read_Temperature (void)
{
Init_DS18B20 ();
If (presence)
{
Beep ();
Delayms (100);
}
The else
{
WriteOneChar (0 XCC);
The xbe WriteOneChar (0);
Temp_data [0]=ReadOneChar ();
Temp_data [1]=ReadOneChar ();
Temp_alarm [0]=ReadOneChar ();
Temp_alarm [1]=ReadOneChar ();
Temp_comp=((temp_data [0] & amp; 0 xf0) & gt;> (4) | (temp_data [1] & amp; 0 x0f) & lt; <4);
Init_DS18B20 ();
WriteOneChar (0 XCC);
X44 WriteOneChar (0);
}
}
Void Temperature_conver ()
{
Bit minus=0;
Uchar temp.

The display [0]=0 x0b;
The display [1]=0 x0c;
If (temp_data [1] & gt; 127)
{
Temp_data [0]=(~ temp_data [0]) + 1;
If ((~ temp_data [0]) & gt;=0 XFF)
Temp_data [1]=(~ temp_data [1]) + 1;
The else
Temp_data [1]=~ temp_data [1].
Minus=1;
}
Temp=temp_data [0] & amp; 0 x0f;
The display [2]=(temp * 10)/16;
Temp=temp_comp;
The display [5]=temp/100;
The display [4]=(\ % 100)/10;
The display [3]=temp % 10;
if (! The display [5])
{
The display [5]=0 x0a;
if (! The display [4])
The display [4]=0 x0a;
}
If (minus)
{
The display [5]=0 x0d;
}
}

CodePudding user response:

Move the main in the end!
  • Related