这个程序中包含了oupt()这个函数,windowsXP中用不了啊
谁帮我把这个程序用keil生成一个hex文件,我要用proteus仿真,谢谢啦,我qq 836136846 email [email protected]
#include<conio.h>
#define CON 0x63
#define PA 0x60
#define PB 0x61
#define PC 0x62
#define uchar unsigned char
#define uint unsigned intuchar step[]={0x10,0x30,0x20,0x60,0x40,0xc0,0x80,0x90};
uchar table[]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xfb};
uchar xuan[]={0x7f,0xbf,0xdf,0xef};
uchar temp,num,key;
uchar jiou;
int max;
uchar set,clr,start;
uchar ge,shi,bai;
int ge1,shi1,bai1;
int xianshi;
int adc();
void clear();
void dianji(int degree);
void delay(uint zz);
void display(uchar w4,uchar w3,uchar w2,uchar w1);
void keyscan();void main()
{
int tt,kk,chazhi;
max=0;xianshi=0;
tt=0;kk=0;
chazhi=0;
xianshi=0;
jiou=0;
ge=0;shi=0;bai=0;
ge1=0;shi1=0;bai1=0;
outp(CON,0x81);
while(1)
{
keyscan();
if(set==1)
{ ge=0;shi=0;bai=0;
while(1)
{
display(0,bai,shi,ge);
keyscan();
if(clr==1)
{
  clear();
break;
}
if(start==1)break;
}
if(start==1)
{ max=bai*100+shi*10+ge;
while(clr!=1)
{
kk=max/15*(adc())/0xff; //下一次的角度;
tt=kk-(xianshi/15);//和上一次相差的度數;
if(tt!=0)
dianji(tt);
keyscan();
}
clear();
} } display(0,0,0,0); } }void display(uchar w4,uchar w3,uchar w2,uchar w1)
{
bai1=xianshi/100;
shi1=xianshi%100/10;
ge1=xianshi%10;
outp(PA,table[w1]);
outp(PB,xuan[0]);
delay(5);

outp(PA,table[w2]);
outp(PB,xuan[1]);
delay(5);

outp(PA,table[w3]);
outp(PB,xuan[1]);
delay(5);

outp(PA,table[w4]);
outp(PB,xuan[1]);
delay(5);}void keyscan()
{
outp(PB,0xef);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{
delay(5);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{

temp=inp(PC);
temp=temp&0x03;
switch(temp)
{
case 0x02:set=1; 
break;
case 0x01:
break;
}
while(temp!=0x03)
{
outp(PB,0xef);
temp=inp(PC);
temp=temp&0x03;
display(0,bai,shi,ge);
}
} }
outp(PB,0xdf);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{
delay(5);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{

temp=inp(PC);
temp=temp&0x03;
if(set==1)
{
switch(temp)
{
case 0x02:clr=1; 
break;
case 0x01:if(start==0)
{
shi++;if(shi>9)shi=0; 
}
break;
}
}
while(temp!=0x03)
{
outp(PB,0xdf);
temp=inp(PC);
temp=temp&0x03;
display(0,bai,shi,ge);
}
} }
outp(PB,0xbf);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{
delay(5);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{

temp=inp(PC);
temp=temp&0x03;
if(set==1)
{
switch(temp)
{
case 0x02:if(start==0)
{
ge++;if(ge>9)ge=0; 
}
break;
case 0x01:start=1; 
break;
}
}
while(temp!=0x03)
{
outp(PB,0xbf);
temp=inp(PC);
temp=temp&0x03;
display(0,bai,shi,ge);
}
} } outp(PB,0x7f);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{
delay(5);
temp=inp(PC);
temp=temp&0x03;
while(temp!=0x03)
{

temp=inp(PC);
temp=temp&0x03;
if(set==1)
{
switch(temp)
{
case 0x02: 
break;
case 0x01:if(start==0)
{
bai++;if(bai>9)bai=0; 
}
break;
}
}
while(temp!=0x03)
{
outp(PB,0x7f);
temp=inp(PC);
temp=temp&0x03;
display(0,bai,shi,ge);
}
} }
}void dianji(int degree)  //电机程序,精度为15度
{
int i,j,k,l;
if(degree>0)
{ for(i=degree;i>0;i--)
{
if(jiou==0)
{
for(j=0;j<4;j++)
{
outp(PC,step[j]);
display(0,bai1,shi1,ge1);
}
jiou=1;goto loop_1;

}
if(jiou==1)
{
for(k=4;k<8;k++)
{
outp(PC,step[k]);
display(0,bai1,shi1,ge1);
}
jiou=0;goto loop_1;
}
loop_1: xianshi=xianshi+15; display(0,bai1,shi1,ge1);
}
}

if(degree<0)
{ for(i=-(degree);i>0;i--)
{
if(jiou==0)
{
for(j=7;j>3;j--)
{
outp(PC,step[j]);
display(0,bai1,shi1,ge1);
}
jiou=1;
goto loop_2;
}
if(jiou==1)
{
for(k=3;k>-1;k--)
{
outp(PC,step[k]);
display(0,bai1,shi1,ge1);
}
jiou=0;goto loop_2;
}
loop_2: xianshi=xianshi-15; display(0,bai1,shi1,ge1); }
}}void clear()
{
int huiwei;
huiwei=-xianshi;
huiwei=huiwei/15;
if(huiwei!=0)
dianji(huiwei);
ge=0;bai=0;shi=0;xianshi=0;
start=0;set=0;clr=0;
}int adc() //ad转换函数
{
uint dat;
outp(0x00,0x0d);
dat=inp(0x00);
display(0,bai1,shi1,ge1);
dat=inp(0x00);
return dat;
}void delay(uint zz)
{
uint x,y;
for(x=zz;x>0;x--)
for(y=110;y>0;y--);
}