#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uint date;
uchar mm=0,n=0;
uint k1,k2,k3,k4,k5,k6;
uchar code b[]={
0x3f,0x06,0x5b,0x4f,0x66, //0,1,2,3,4,
0x6d,0x7d,0x07,0x7f,0x6f, //5,6,7,8,9,C
0xbf,0x86,0xdb,0xcf,0xe6, //0.,1.,2.,3.,4.,
0xed,0xfd,0x87,0xff,0xef, //5.,6.,7.,8.,9.,
};
sbit P20=P2^0;
sbit P21=P2^1;
sbit P22=P2^2;
sbit P27=P2^7;
sbit wr=P3^6;
sbit rd=P3^7;
sbit P32=P3^2;
void delay_10us(uchar n) //10΢Ã뼶ÑÓʱ
{ do
{ _nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}while(--n);
}
void delay_ms(uint n) //ºÁÃ뼶ÑÓʱ
{ do delay_10us(131);
while(--n);
}
uchar adc0809()
{
wr=0;
_nop_();
_nop_();
wr=1;
_nop_();
_nop_();
while(P32);
rd=0;
date=P0;
delay_10us(10);
rd=1;
delay_ms(1000);
date=date*19.607843;
//date=date*(1000/51);
n=0;
k1=date/1000;//1
k2=date%1000;//234
k3=k2/100;//2
k4=k2%100;//34
k5=k4/10;//3
k6=k4%10;//4
if(n==0)
{TI=0;
SBUF=b[k6];
while(!TI);
TI=0;
SBUF=b[k5];
while(!TI);
TI=0;
SBUF=b[k3];
while(!TI);
TI=0;
SBUF=b[k1+10];
while(!TI);
n=1;
}
}
void main()
{P0=0xff;
P20=0;
P21=0;
P22=0;
P27=0;
while(1)
{
adc0809();
}
}
---- ÔÚÊý¾Ý¿âµÄÓ¦Óÿª·¢ÖУ¬³£³£»áÓöµ½ÐÔÄܺʹú¼ÛµÄÖ®¼äì¶Ü¡£ÒÔ×÷ÕßÔÚ¿ª·¢¹ÉÊÐÐÐ
Çé²éѯºÍ½»Ò×ϵͳÖÐÓöµ½µÄÎÊÌâΪÀý£¬ÒªÔÚʵʱ¼Ç¼1000¶àÖ»¹ÉƱÿ·ÖÖÓ¸üÐÂÒ»´ÎµÄÐÐ
ÇéÊý¾ÝµÄͬʱ£¬ÏìÓ¦´óÁ¿²¢·¢Óû§µÄÊý¾Ý²éѯÇëÇ󡣿¼Âǵ½ÐԼ۱ȺÍÒ×ά»¤ÐÔ£¬ÏµÍ³ÓÖ
ÒªÇóÔÚ»ùÓÚPC·þÎñÆ÷£¬Windows NTƽ̨µÄÈíÓ²¼þ»·¾³ÏÂʵÏÖ¡£¿ª ......
µ±Ï¶¨¾öÐÄÈ¥×öÒ»¼þÊÂÇéµÄʱºò,¾ÍûÓÐʲô¿ÉÒÔ×èµ²ÎÒ£¡Æ©Èçȥ˯¾õ--! from ¡¶¾õÖ÷ÓA·
ÁîÎÒìþìý²»°²µÄ¸ßÊýѧλ֤¿¼ÊÔ¹ýÈ¥ÁË£¬½á¹û»¹ÊÇÂúÒâµÄ¡£ËäÈ»»¨ÁË3ÖܵÄʱ¼äÈ¥×¼±¸¸´Ï°Êýѧ£¬µ«ÊÇÎÒÈ´·¢ÏÖ£¬ÕæÕýȥѧϰµÄʱºòÖ»ÓÐ×îºóÄÇÁ½Ì죬ÒÔÍùµÄʱ¼äÈ«ÊÇÀ˷ѵôÁË¡£ËìÃ÷
°×£¬ÎªÊ²Ã´Í¬Ò»ÖÖ»·¾³ÏµÄÈË£¬ÓеijÉÁËÌì²Å£¬ÓеÄÂÙÎ ......