ADC0808与AT89C51单片机的数字电压表,ALE怎么没有脉冲信号输...

2019-07-18 09:34发布

源程序:
#include<reg51.h>
#include<absacc.h>
#define uchar unsigned char
#define uint  unsigned int
#define IN0 XBYTE[0x7FF8]
uchar code duanma[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar code  weima[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07};
static uchar data s[4];
uchar xdata *ad_adr;
uchar i,j=0,w=0;
void delay(uint m)
{uint n;
while(m--)
   for(n=0;n<250;n++);
}
void main()
{IT0=1;
EA=1;
EX0=1;
i=0;
ad_adr=&IN0;
*ad_adr=i;
while(1);
}
void  int0() interrupt 0
{uint k;
uchar getdata,first,second;
s[j]=P0;
getdata=s[j];
first=getdata*196/10000;
second=getdata*196%10000/1000;
for(k=0;k<2;k++)
{P2=weima[w];
   if(w%2==0) P1=duanma[first]|0x80;
    else P1=duanma[second];
   if(w<8) w++;
    else w=0;
   delay(2);}
ad_adr++;
  j++;
if(j<4) *ad_adr=i;
    else  {ad_adr=&IN0;*ad_adr=i;}
}

运行前 运行前
运行后 运行后
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。