求前辈看下,这个电路有什么问题1?
时间:10-02
整理:3721RD
点击:
下面是图和代码,仿真结果,无法放大,数码管不亮,一点反应都没,调了两天,还是没用。求前辈看下,仿真图和代码哪有问题?急用!
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code LEDData[]=
{
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f
};//共阴数码管
sbit OE=P1^0;
sbit EOC=P1^1;
sbit ST=P1^2;
sbit CLK=P1^3;
sbit K1=P2^6;
sbit K2=P2^7;
void DelayMS(uint ms)
{
uchar i;
while(ms--)
{
for(i=0;i<120;i++);
}
}
void Display_Result(uchar d)
{
P2=0xf8;
P0=LEDData[d%10];
DelayMS(5);
P2=0xf4;
P0=LEDData[d%100/10];
DelayMS(5);
P2=0xf2;
P0=LEDData[d/100];
DelayMS(5);
}
void AD()
{
ST = 0;
ST = 1;
ST = 0;
while(EOC == 0);
OE = 1;
Display_Result(P3);
OE = 0;
}
void kz()
{
if(K1==0)
{
DelayMS(5);
while(!K1);
P3=P3+5;
}
if(K2==0)
{
DelayMS(5);
while(!K2);
P3=P3-5;
}
}
void main()
{
TMOD=0x01;
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
EA=1;
ET0=1;
TR0=1;
P1=0x3f;
while(1)
{
AD();
kz();
}
}
void Timer0_INT() interrupt 1
{
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
CLK =!CLK;
}
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code LEDData[]=
{
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f
};//共阴数码管
sbit OE=P1^0;
sbit EOC=P1^1;
sbit ST=P1^2;
sbit CLK=P1^3;
sbit K1=P2^6;
sbit K2=P2^7;
void DelayMS(uint ms)
{
uchar i;
while(ms--)
{
for(i=0;i<120;i++);
}
}
void Display_Result(uchar d)
{
P2=0xf8;
P0=LEDData[d%10];
DelayMS(5);
P2=0xf4;
P0=LEDData[d%100/10];
DelayMS(5);
P2=0xf2;
P0=LEDData[d/100];
DelayMS(5);
}
void AD()
{
ST = 0;
ST = 1;
ST = 0;
while(EOC == 0);
OE = 1;
Display_Result(P3);
OE = 0;
}
void kz()
{
if(K1==0)
{
DelayMS(5);
while(!K1);
P3=P3+5;
}
if(K2==0)
{
DelayMS(5);
while(!K2);
P3=P3-5;
}
}
void main()
{
TMOD=0x01;
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
EA=1;
ET0=1;
TR0=1;
P1=0x3f;
while(1)
{
AD();
kz();
}
}
void Timer0_INT() interrupt 1
{
TH0=(65536-4000)/256;
TL0=(65536-4000)%256;
CLK =!CLK;
}
proteus仿真图
。。
复位电路是不是接错了,RST是复位,EA看低电平有效还是高电平有效
EA是要结高电平,proteus仿真时,不接RST。
不知道为什么,仿真时,ADC0808的OE段始终是高电平