Current location - Education and Training Encyclopedia - Graduation thesis - Temperature alarm based on single chip microcomputer
Temperature alarm based on single chip microcomputer
Add a comparison program to set the upper and lower temperatures.

Uint compare (uint Xia, uint shang, uint wen)//Xia is the lower limit temperature, shang is the upper limit temperature, and wen is the real-time temperature.

{

int t;

If (Wen< Xia || Wen> Shang)

t = 1;

Otherwise t = 0;;

Return (t);

}

//Out of range, the return value is 1, otherwise it is 0.