标题:
keil c语言出现错误C206 missing function-prototype
[打印本页]
作者:
赵一帆
时间:
2020-4-20 13:00
标题:
keil c语言出现错误C206 missing function-prototype
03AE7182-FA2E-43A9-8836-83A5C84186F9.png
(362.08 KB, 下载次数: 29)
下载附件
2020-4-20 13:00 上传
C206 missing function-prototype
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
static unsigned char table[6]={0,0,0,0,0,0};
//Declare functions
uchar Busy_Check();
void Initialize_LCD();
void Write_LCD_Data(uchar dat);
void Write_LCD_Command(uchar cmd);
void Display_String(uchar x,uchar y,uchar *str);
void Display_char(uchar hang,uchar lie,char sign);
// void write_add(uchar address,uchar date);// 向 AT24Cxx 中的指定地址写入数据 uchar read_add(uchar address);// 从 AT24Cxx 中的指定地址读取数据
void init();
uchar h=20;
sbit touch=P2^1;
sbit touch1=P2^2;
sbit speaker=P2^0;
void delay(unsigned char ms) // 延时 **ms
{
unsigned char i;
while(ms--)
{
for(i=250;i>0;i--)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
unsigned char keyscan() // 扫描键盘
{
unsigned char temp,y,j;
unsigned char anjian[]={0xfe,0xfd,0xfb,0xf7};
for(y=0;y<4;y++)
{
P1 = anjian[y];
temp = 0x10;
for(j=0;j<4;j++)
{
if(!(P1&temp))
{
return(j+y*4);
}
temp = _crol_(temp,1);
}
}
}
void judge()
{
P1 = 0xf0; if(P1!=0xf0) // 判断是否有按键
{
delay(50); delay(50); // 消抖
if(P1!=0xf0)
{
h=keyscan();
}
}
}
void main()
{
unsigned char a=1,i=0,k=0,l=1,m=1,n,f=0,s=0;
int q;
Initialize_LCD();
init();
Display_String(1,1,"Welcome To Use ");
Display_String(2,1," ");
touch1=0; //第一个 while 循环
while(1)
{
judge();
if(h<10)
{
if(h==table[i])
k++;
Display_String(2,a,"*");
a++;
i++;
if(a==7)
a=1;
if(i==6)
i=0;
h=16;
}
if(h==14)
{
Display_String(1,1,"Input Password");
Display_String(2,1," ");
h=16;
touch=1;
touch1=0;
k=0;
l=1;
q=0;
}
if(h==12)
{
if(k==6)
{
Display_String(1,1,"Password Right");
Display_String(2,1,"Lock Opened!");
touch=~touch;
}
else
{
Display_String(1,1,"Password Error");
Display_String(2,1," ");
l=0;
q++;
while(q==3)
{
speaker=0;
delay(200);
delay(200);
delay(200);
speaker=1 ;
q=0;
}
h=14;
}
delay(255);
k=0;
h=16;
while(l)
{
judge();
if(h==11)
{ Display_String(1,1,"New Code");
Display_String(2,1," ");
while(m==1)
{
judge();
touch1=~touch1;
if(h<10)
{
table[n]=h;
write_add(s,h);
s++;
Display_String(2,a,"*");
a++;
n++;
h=16;
if(n==6)
{
n=0;
s=0;
}
}
if(h==15)
{
if(n==0)
n=6;
s=6;
a--;
s-- ;
Display_String(2,a," ");
n--;
h=16;
}
if(h==13)
m=0;
}
if(h==13)
h=13;
f=1;
}
if(h==14)
{
l=0;
}
if(h==13)
{
Display_String(2,1," ");
for(n=0;n<6;n++)
Display_char(2,n+1,(uchar)(table[n]+48) );h=13;l=0;f=1;}
k=0;
}
}
if(h==15)
{
a--;
Display_String(2,a," ");
k--;
i--;
h=16;
}
if(h==13)
{ if(f==1)
{ for(n=0;n<6;n++)
Display_char(2,n+1,(uchar)(table[n]+48) );f=0; }
else
Display_String(2,1," ****** ");
delay(255);
delay(255);
Display_String(1,1," Welcome To Use ");
Display_String(2,1," ");
l=1;a=1;k=0;n=0;m=1;
h=16;
}
}
for(s=0;s<6;s++)
{ table[s]=read_add(s);
delay(50);
}
}
复制代码
作者:
xuyaqi
时间:
2020-4-20 16:09
错误太多,程序结构都有问题。
作者:
man1234567
时间:
2020-4-20 17:47
write_add()函数在第12行被注释掉了但在第138行被调用。
作者:
0445
时间:
2020-6-7 07:15
/********************引脚定义*********************/ #include "reg51.h" typedef unsigned int uint; typedef unsigned char uchar; #define Duty_cycle 35 //占空间 #define Cycle 100 //PWM周期 sbit sensor_1 = P1^1; //红外检测 sbit sensor_2 = P1^1; sbit sensor_3 = P1^3; sbit Motor_1H = P2^0; //电机驱动控制信号 sbit Motor_1L = P2^1; sbit Motor_2H = P2^2; sbit Motor_2L = P2^3; sbit En_pwm1 = P2^4; //使能信号(RWM) sbit En_pwm2 = P2^5; uchar timer1; //定义变量 /***************主函数*********************/ void mian( ) { TimelConfig();//定时器初始化 while(1) { if(Sensor_1==0 && Sensor_2==1 && Semsor_3==0) //状态:轨迹居中 Go_Straight(); //向前 else if(Sensor_1==0 && Sensor_2==0 && Semsor_3==1) //偏左 Turn_Right(); //右转 else if(Sensor_1==1 && Sensor_2==0 && Semsor_3==0) //偏右 Turn_left(); //左转 else if(Sensor_1==0 && Sensor_2==0 && Semsor_3==0) //偏离轨道 Go_Back(); //后退 else Go_Straight( ); //前进 } } /**************设置定时器***********/ void Time1Config() { TMOD|= 0x10; //设置定时计数器T1工作在模式1 /***定时器赋初始值, 12MHZ下定时0.5ms***/ TH1 = 0xFE; TL1 = 0x0c; ET1 = 1; //开启定时器1中断 EA = 1; TR1 = 1; //开启定时器 } /********************定时器1的中断函数********************/ void Time1(void) interrupt 3 //3 为定时器1的中断号 { timer1++; if(timer1>Cyc1e) //PWM周期为100*0.5ms { timer1=0; } if(timer1 < Duty_cyc1e) //改变Duty_cyc1e这个值可以改变直流电机的速度 { En_pwm1=1; En_pwm2=1; } e1se { En_pwm1=0; En_pwm2=0; } TH1 = 0xFE; //重新赋初值 TL1 = 0x0c; }
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1