文档介绍:附录1
(1)本设计使用的单片机程序如下:
#include <>
//*************************
void INIT()
{
ADCON1=0X07;
TRISC=0X80;
TRISB=0X00;
TRISD=0X00;
RD1=0;
RD0=0;
TRISA=0X0f;
TRISE=0X00;
}
//*************************
#include <>
#include ""
#include ""
//*************************
unsigned char i;
unsigned int delay;
extern unsigned char a;
extern unsigned char temph;
extern unsigned char templ;
//***************************
void main()
{
//初始化
INIT();
for(delay=65536;delay>0;delay--) asm("clrwdt");
temph=0x35;
templ=0x30;
do
{
asm("clrwdt");
PROCDIANPIN();
RC0=0;
RC1=0;
}while(1);
}
#include <>
#include ""
//*********************
union adres
{
int y1;
unsigned char adre[2];
}adresult;
extern unsigned int delay;
unsigned int temp;
unsigned int y;
unsigned char receive;
unsigned char a;
extern unsigned char rxbuf[];
unsigned char temph;
unsigned char templ;
extern unsigned char i;
//******************************
void PROCDIANPIN()
{
ADCON0=0X89;
ADCON1=0X84;
ADIF=0;
ADGO=1;
for(delay=0x8ff;delay>0;delay--) asm("nop");
while(ADIF==0)
{
asm("clrwdt");
}
asm("clrwdt");
ADIF=0;
[0]=ADRESL;
[1]=ADRESH;
if((<=0x204)&&(>=0xD9))
{
temp=0x10;
for(
y=0x204;<=y;=+0x07)
{
temp+