本帖最后由 Mr叶 于 2016-3-18 21:22 编辑
在进行
仿真的过程中,仿真速度过慢
采取的措施有:1.将模拟电阻变为数字电阻,采集的信息便会出错
2.去掉温度补偿电阻(与555控制电压端口CV相连的电阻)或减小温度补偿电阻,便无法采集信息
3.去掉虚拟示波器后,仿真速度任然过慢
不知道还有没有其他解决的方法?
附录程序:
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit WEIlatch = P2^1;
sbit DUANlatch = P2^0;
uchar code DuanMa[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0xbf};
uchar code WeiMa[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar table[]={10,10,10,10,10,10,10,10};
uint num,i,cishu;
uint RH;
void Delay_50us(uint a)
{
uint x,y;
for(x=a; x>0; x--)
for(y=19; y>0; y--);
}
void DisplaySeg(uchar *p)
{
uchar i;
for(i=0; i<8; i++)
{
WEIlatch = 1;
P0 = WeiMa
;
WEIlatch = 0;
DUANlatch = 1;
P0 = DuanMa[*(p+i)];
DUANlatch = 0;
Delay_50us(20);
DUANlatch = 1;
P0 = 0xff;
DUANlatch = 0;
}
}
void Init(void)
{
EA = 1;
TMOD = 0X10;
TH1 = (65536-50000)/256;
TL1 = (65536-50000)%256;
ET1 = 1;
TR1 = 1;
EX0 = 1;
IT0 = 1;
}
void main()
{
Init();
while(1)
{
DisplaySeg(table);
}
}
void extert0()interrupt 0
{
num++;
}
void timet1()interrupt 3
{
TH1 = (65536-50000)/256;
TL1 = (65536-50000)%256;
i++;
if(i == 20)
{
i = 0;
cishu = num;
RH = (7351-cishu)/12;
table[0] = RH/100;
table[1] = RH%100/10;
table[2] = RH%10;
num = 0;
}
}
一周热门 更多>