main.c函数
#include "reg52.h"
#include "onewire.h"
unsigned char duanma[10]={
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char duanma_x[10]={
0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10};
unsigned int temp=0;
void systeminitial();
void HC138(unsigned char channel);
void Delay_SMG(unsigned int t);
void DisplaySMG_Bit(unsigned char pos,unsigned char dat);
void DisplaySMG_temp();
void Delay(unsigned int t);
void Read_DS18B20_temp();
void main()
{
systeminitial();
while(1)
{
Read_DS18B20_temp();
DisplaySMG_temp();
}
}
void Delay(unsigned int t)
{
while(t--)
{
DisplaySMG_temp();
}
}
void DisplaySMG_temp()
{
DisplaySMG_Bit(6,duanma[temp%10]);
Delay_SMG(200);
HC138(6);P0=0X00;HC138(0)