ADC0809仿真时OE口输入1后为什么是高阻态的
时间:10-02
整理:3721RD
点击:
如硬件图,用Proteus仿真时,明明OE口输入1了,管脚却是灰色的,说明是高阻态
程序如下:(desplay是用数码管显示AD转换的数,老是显示0,所以我怀疑是OE的问题,注意程序倒数第七行,已经把0E置1了)
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit oe=P0^0;
sbit eoc=P0^1;
sbit start=P0^2;
uchar table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
uchar temp;
void delay(uint i)
{
while(i--);
}
void deplay(uchar a)
{ P3=0x01;
P2=table[a%10];
delay(50);
P3=0x02;
P2=table[a/10];
delay(50);
}
void main(void)
{ while(1)
{ uint t=500;
P1=0xff;
oe=0;
start=0;
start=1;
start=0; //给start一个正脉冲启动AD转换
while(0==eoc);
oe=1;
temp=P1;
while(1) //说明已经运行到这步了,且oe没成功置1;
{ deplay(temp);
}
}
}
图有点乱不好意思
程序如下:(desplay是用数码管显示AD转换的数,老是显示0,所以我怀疑是OE的问题,注意程序倒数第七行,已经把0E置1了)
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit oe=P0^0;
sbit eoc=P0^1;
sbit start=P0^2;
uchar table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
uchar temp;
void delay(uint i)
{
while(i--);
}
void deplay(uchar a)
{ P3=0x01;
P2=table[a%10];
delay(50);
P3=0x02;
P2=table[a/10];
delay(50);
}
void main(void)
{ while(1)
{ uint t=500;
P1=0xff;
oe=0;
start=0;
start=1;
start=0; //给start一个正脉冲启动AD转换
while(0==eoc);
oe=1;
temp=P1;
while(1) //说明已经运行到这步了,且oe没成功置1;
{ deplay(temp);
}
}
}
图有点乱不好意思