温度传感器

来源:百度知道 编辑:UC知道 时间:2024/06/22 05:01:24
用C++编写的控制DS1624的程序,采用并口技术。分一定倾其所有。

#include <AT89X52.H>
#include <INTRINS.H>

unsigned char code displaybit[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
unsigned char code displaycode[]={0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,0x00};

unsigned char code dotcode[32]={0,3,6,9,12,16,19,22,
25,28,31,34,38,41,44,48,
50,53,56,59,63,66,69,72,
75,78,81,84,88,91,94,97};

sbit SDA=P1^6;
sbit SCL=P1^7;

unsigned char displaybuffer[8]={0,1,2,3,4,5,6,7};
unsigned char eepromdata[8];
unsigned char temperdata[2];

unsigned char timecount;
unsigned char displaycount;

bit secondflag=0;
unsigned char secondcount=0;