ADC0808与AT89c51的数字电压表仿真,运行后只显示000为什么啊...

2019-07-18 10:37发布

C程序如下:#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar getdata,i,count;
uchar code weima[]={0xfe,0xfd,0xfb};
uchar code duanma1[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
uchar wei[3]={10,10,10};
sbit EOC=P3^2;
sbit OE=P3^1;
sbit ST=P3^0;
void main()
{
ET0=1;
EA=1;
TMOD=0x01;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
TR0=1;
while(1)
{ST=0;
ST=1;
ST=0;
while(EOC==0);
OE=1;
getdata=P1;
OE=0;
i=getdata*196;
wei[2]=i/10000;
i%=10000;
wei[1]=i/1000;
wei[0]=i%1000;
}
}
void t0() interrupt 1
{TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
P0=duanma1[wei[count]];
  P2=weima[count];
  count++;
  if(count==3) { count=0;}
    }





原理图 原理图
仿真后 仿真后
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。