求大神指教,急!
时间:10-02
整理:3721RD
点击:
#include "reg52.h" //电机IO
#define GPIO_MOTOR P1
//sbit F1 = P1^0;
//sbit F2 = P1^1;
//sbit F3 = P1^2;
//sbit F4 = P1^3;
//按键IO
sbit K1=P3^0;
sbit K2=P3^1;
sbit K3=P3^2;
sbit K4=P3^3;
unsigned char code FFW[8]={0xf1,0xf3,0xf2,0xf6,0xf4,0xfc,0xf8,0xf9}; //反转顺序
unsigned char code FFZ[8]={0xf9,0xf8,0xfc,0xf4,0xf6,0xf2,0xf3,0xf1}; //正转顺序
unsigned char Direction,Speed;
void Delay(unsigned int t);
void Motor();
void main(void)
{
unsigned char i;
Speed=30;
while(1)
{
if(K1==0) //检测按键K1是否按下
{ Delay(1); //消除抖动
if(K1==0)
{
Direction=1;
}
while((i<200)&&(K1==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K2==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K2==0)
{
Direction=2;
}
while((i<200)&&(K2==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K3==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K3==0)
{
Speed=13;
}
while((i<200)&&(K3==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K4==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K4==0)
{
Speed=40;
}
while((i<200)&&(K4==0)) //检测按键是否松开
{
Delay(1);
i++;
} i=0;
} Motor();
}
}
void Motor()
{
unsigned char i;
for(i=0;i<8;i++)
{
if(Direction==1)
GPIO_MOTOR = FFW[i]&0x1f; //取数据
if(Direction==2)
GPIO_MOTOR = FFZ[i]&0x1f;
Delay(Speed); //调节转速
}
}
void Delay(unsigned int t)
{
unsigned int k;
while(t--)
{
for(k=0; k<80; k++)
{ }
}
}
完了之后显示错误:
Build target 'Target 1'
assembling Main.asm...
A51 MACRO ASSEMBLER V8.00 - SN: K1U9C-3F31ZR
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2005
"f:\Keil\C51\BIN\A51.EXE" "Main.asm" SET (SMALL) DEBUG EP
A51 FATAL ERROR -
ERROR: LIMIT EXCEEDED: SYMBOL-TABLE SPACE EXHAUSTED
A51 TERMINATED.
Target not created
#define GPIO_MOTOR P1
//sbit F1 = P1^0;
//sbit F2 = P1^1;
//sbit F3 = P1^2;
//sbit F4 = P1^3;
//按键IO
sbit K1=P3^0;
sbit K2=P3^1;
sbit K3=P3^2;
sbit K4=P3^3;
unsigned char code FFW[8]={0xf1,0xf3,0xf2,0xf6,0xf4,0xfc,0xf8,0xf9}; //反转顺序
unsigned char code FFZ[8]={0xf9,0xf8,0xfc,0xf4,0xf6,0xf2,0xf3,0xf1}; //正转顺序
unsigned char Direction,Speed;
void Delay(unsigned int t);
void Motor();
void main(void)
{
unsigned char i;
Speed=30;
while(1)
{
if(K1==0) //检测按键K1是否按下
{ Delay(1); //消除抖动
if(K1==0)
{
Direction=1;
}
while((i<200)&&(K1==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K2==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K2==0)
{
Direction=2;
}
while((i<200)&&(K2==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K3==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K3==0)
{
Speed=13;
}
while((i<200)&&(K3==0)) //检测按键是否松开
{
Delay(1);
i++;
}
i=0;
}
if(K4==0) //检测按键K1是否按下
{
Delay(1); //消除抖动
if(K4==0)
{
Speed=40;
}
while((i<200)&&(K4==0)) //检测按键是否松开
{
Delay(1);
i++;
} i=0;
} Motor();
}
}
void Motor()
{
unsigned char i;
for(i=0;i<8;i++)
{
if(Direction==1)
GPIO_MOTOR = FFW[i]&0x1f; //取数据
if(Direction==2)
GPIO_MOTOR = FFZ[i]&0x1f;
Delay(Speed); //调节转速
}
}
void Delay(unsigned int t)
{
unsigned int k;
while(t--)
{
for(k=0; k<80; k++)
{ }
}
}
完了之后显示错误:
Build target 'Target 1'
assembling Main.asm...
A51 MACRO ASSEMBLER V8.00 - SN: K1U9C-3F31ZR
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2005
"f:\Keil\C51\BIN\A51.EXE" "Main.asm" SET (SMALL) DEBUG EP
A51 FATAL ERROR -
ERROR: LIMIT EXCEEDED: SYMBOL-TABLE SPACE EXHAUSTED
A51 TERMINATED.
Target not created
怎么改啊,真的很着急,谢谢大家
程序写得如此,正常的人看了都晕。
这应该不是程序得问题,应该是头文件,或者路径的问题
如果需要PIC原装芯片或者替代芯片的都可以联系我。颜生13430885511(微信同号)/qq2355910801