欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 'Keydown': missing function-prototype [打印本頁]

作者: hdfc    時間: 2021-6-21 22:16
標題: 'Keydown': missing function-prototype
#include<reg52.h>

#define uchar unsigned char  
#define uint unsigned int
extern        unsigned char KeyDown();
extern void Lcd1602_Delay1ms(uint c);  
extern void LcdInit();        
extern void LcdWriteCom(uchar com);
extern void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s);
extern void LCD_Write_Char(unsigned char x,unsigned char y,unsigned char Data);
uchar code password[]={1,2,3,4,1,1};
sbit led=P3^0;

main()
{
  uchar num,i=0,j;                  
        uchar passwordtemp[6];        

        uchar passwordlength,PLEN;     
  bit flag;
  PLEN=sizeof(password)/sizeof(password[0]);

  PLEN=9;
        LcdInit()        ;         
        Lcd1602_Delay1ms(10);        
        LcdWriteCom(0x01);      
        LCD_Write_String(0,0,"  Welcome! ");   
  LCD_Write_String(0,1,"Input password!");   

while(1)
{        
                        num=Keydown();  
                        if(num!=0xff)  
                        {
                                if(i==0)  
                                LCD_Write_String(0,0,"                ");
                                if(i<16)
                                {
                                        passwordtemp[ i]=num;
                                        LCD_Write_Char(i,1,'*');
                                }
                                i++;   
                                if(i==8)
                                {
                                                passwordlength=i-1;
                                                i=0;
                                        if(passwordlength==PLEN)
                                        {        
                                                flag=1;
                                                for(j=0;j<PLEN;j++)
                                                flag=flag&&(passwordtemp[j]==password[j]);
                                        }
                                        if(flag)
                                        {
                                                LCD_Write_String(0,1,"                       ");
                                                LCD_Write_String(0,1,"Right Open!>>>>");
                                                led=0;
                                                Lcd1602_Delay1ms(30000);
                                                led=1;
                                       
                                                flag=0;     
                                        }
                                        else
                                        {
                                                LCD_Write_String(0,1,"                      ");
                                                LCD_Write_String(0,1,"Wrong! Retry!");
                                       
                                                
                                        }

                                }
                        }        
                }

        }


#include<reg52.h>
typedef unsigned int uint;
typedef unsigned char uchar;
#define GPIO_KEY P1
uchar KeyValue;
uchar KeyState;
void Delay10ms();
unsigned char KeyDown();
unsigned char KeyDown()
{
   char a;
   GPIO_KEY=0x0f;
   if(GPIO_KEY!=0x0f)
   {
      Delay10ms();
      if(GPIO_KEY!=0x0f)
{
       KeyState=1;
       GPIO_KEY=0X0F;
       Delay10ms();
     switch(GPIO_KEY)  
   {
      case(0x07):KeyValue=0;break;
      case(0X0b):KeyValue=1;break;
      case(0X0d):KeyValue=2;break;
            case(0X0e):KeyValue=3;break;
   }

GPIO_KEY=0XF0;  
                        Delay10ms();
                        switch(GPIO_KEY)
                        {
                                case(0X70):        KeyValue=KeyValue;break;
                                case(0Xb0):        KeyValue=KeyValue+4;break;
                                case(0Xd0): KeyValue=KeyValue+8;break;
                                case(0Xe0):        KeyValue=KeyValue+12;break;
                                }
while((a<50)&&(GPIO_KEY!=0xf0))         

{
       Delay10ms();
                                a++;
}
a=0;
}
}
return KeyValue;
}
void Delay10ms(void)   
{
    unsigned char a,b,c;
    for(c=1;c>0;c--)
        for(b=38;b>0;b--)
            for(a=130;a>0;a--);
}



#include"reg52.h"
#define LCD1602_DATAPINS P0

#define uchar unsigned char
#define uint unsigned int
uchar x;
sbit LCD1602_RW=P2^5;
sbit LCD1602_RS=P2^6;
sbit LCD1602_E=P2^7;

void Lcd1602_Delay1ms(uint c);   

void LcdWriteCom(uchar com);

void LcdWriteData(uchar dat)        ;
               
void LcdInit();                                                  

void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s);
         
void LCD_Write_Char(unsigned char x,unsigned char y,unsigned char Data);

void Lcd1602_Delay1ms(uint c)            
{
    uchar a,b;
        for (; c>0; c--)
        {
                 for (b=199;b>0;b--)
                 {
                          for(a=1;a>0;a--);
                 }      
        }
            
}


void LcdWriteCom(uchar com)         
{
        LCD1602_E = 0;   
        LCD1602_RS = 0;           
        LCD1602_RW = 0;           
        
        LCD1602_DATAPINS = com;     
        Lcd1602_Delay1ms(1);               

        LCD1602_E = 1;                  
        Lcd1602_Delay1ms(5);         
        LCD1602_E = 0;
}

void LcdWriteData(uchar dat)                        
{
        LCD1602_E = 0;        
        LCD1602_RS = 1;
        LCD1602_RW = 0;        

        LCD1602_DATAPINS = dat;
        Lcd1602_Delay1ms(1);

        LCD1602_E = 1;   
        Lcd1602_Delay1ms(5);  
        LCD1602_E = 0;
}
           
void LcdInit()                                                  
{
         LcdWriteCom(0x38);   
        LcdWriteCom(0x0c);
        LcdWriteCom(0x06);  
        LcdWriteCom(0x01);
        
}







void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s)
{         
         while (*s)
         {     
                 LCD_Write_Char(x,y,*s);     
                 s ++;  x++;   
         }
}

void LCD_Write_Char(unsigned char x,unsigned char y,unsigned char Data)
{     
        if (y == 0)
         {     
         LcdWriteCom(0x80 + x);     
         }   
         else
         {     
                 LcdWriteCom(0xC0 + x);     
         }        
         LcdWriteData( Data);  
}




main.c(32): warning C206: 'Keydown': missing function-prototype


作者: hdfc    時間: 2021-6-21 22:18




unsigned char KeyDown()
{
   char a;
   GPIO_KEY=0x0f;
   if(GPIO_KEY!=0x0f)
   {
      Delay10ms();
      if(GPIO_KEY!=0x0f)
{
       KeyState=1;
       GPIO_KEY=0X0F;
       Delay10ms();
     switch(GPIO_KEY)  
   {
      case(0x07):KeyValue=0;break;
      case(0X0b):KeyValue=1;break;
      case(0X0d):KeyValue=2;break;
            case(0X0e):KeyValue=3;break;
   }

GPIO_KEY=0XF0;  
                        Delay10ms();
                        switch(GPIO_KEY)
                        {
                                case(0X70):        KeyValue=KeyValue;break;
                                case(0Xb0):        KeyValue=KeyValue+4;break;
                                case(0Xd0): KeyValue=KeyValue+8;break;
                                case(0Xe0):        KeyValue=KeyValue+12;break;
                                }
while((a<50)&&(GPIO_KEY!=0xf0))         

{
       Delay10ms();
                                a++;
}
a=0;
}
}
return KeyValue;
}
作者: angmall    時間: 2021-6-22 10:55
你這個程序不完整,沒法給你看是哪里出問題了!

作者: 我是小白怎么滴    時間: 2021-6-22 15:01
extern        unsigned char KeyDown();
是不是有沒顯示出來的字符
作者: hdfc    時間: 2021-6-22 20:05
我是小白怎么滴 發表于 2021-6-22 15:01
extern        unsigned char KeyDown();
是不是有沒顯示出來的字符

沒有都顯示出來了
作者: hdfc    時間: 2021-6-22 20:08
本帖最后由 hdfc 于 2021-6-22 20:32 編輯

不明白我明明引用keydown了還出現警告
作者: hdfc    時間: 2021-6-22 20:09
本帖最后由 hdfc 于 2021-6-22 20:35 編輯

他還是警告缺少函數原型
作者: hdfc    時間: 2021-6-22 20:11
angmall 發表于 2021-6-22 10:55
你這個程序不完整,沒法給你看是哪里出問題了!

我發生于的程序了在回復里
作者: hdfc    時間: 2021-6-22 22:08
解決了,大小寫錯了




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1