»ùÓÚ51µ¥Æ¬»úµÄ¾Æ¾«²âÊÔÒÇÉè¼Æ±ÏÒµÉè¼Æ˵Ã÷Êé

ep0;

return result;

lcd_wcmdunsigned char cmd //дָÁîÊý¾Ýµ½LCD

whilelcd_bz rs0; rw0; ep0; _nop_; _nop_; P0cmd; _nop_; _nop_; ep1; _nop_; _nop_; ep0;

lcd_posunsigned char pos //

É趨ÏÔʾλÖà lcd_wcmdpos | 0x80;

lcd_wdatunsigned char dat //дÈëÏÔʾÊý¾Ýµ½LCD

whilelcd_bz; rs1; rw0; ep0; P0dat; _nop_; _nop_; ep1; _nop_; _nop_; ep0;

lcd_init //LCD³õʼ»¯

lcd_wcmd0x38; delay1; lcd_wcmd0x0c;

delay1; lcd_wcmd0x06; delay1; lcd_wcmd0x01; delay1;

Init_DS18B20void //DS18B20³õʼ»¯

unsigned char x0; DQ1; delay28; DQ0; delay285; DQ1; delay214; delay220;

ReadOneCharvoid // ÏòDS18B20¶ÁÒ»×Ö½ÚÊý¾Ý

unsigned char i0;

unsigned char dat0; fori8;i0;i-- DQ1; delay21; DQ0; dat1; DQ1; ifDQ dat|0x80; delay24;

returndat;

WriteOneCharunsigned char dat //

unsigned char i0; fori8;i0;i-- DQ0; DQdat&0X01; delay25;

ÏòDS18B20дһ×Ö½ÚÊý¾Ý DQ1; dat1; delay24;

ReadTemperaturevoid //ÏòDS18B20¶ÁζÈÖµ

Init_DS18B20; WriteOneChar0xcc; WriteOneChar0x44; delay2125; Init_DS18B20; WriteOneChar0xcc; WriteOneChar0xbe; tempLReadOneChar; tempHReadOneChar;

temperaturetempH*256+tempL*0.0625; delay2200; returntemperature; main

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ì滻Ϊ@) ËÕICP±¸20003344ºÅ-4