c语言 prototype_keil c语言出现错误C206 missing function-prototype

本文介绍了一个使用C语言在Keil环境下编写的程序,涉及LCD初始化、字符显示、键盘扫描以及AT24Cxx存储器的数据读写。程序实现了一个简单的6位密码验证系统,通过LCD显示提示信息并接收用户输入。当输入的密码与预设的密码匹配时,系统会给出相应提示。
摘要由CSDN通过智能技术生成

#include

#include

#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);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值