报错的一段程序在这,检查了好多次函数声明,没有发现问题。
void Key_Set_Clock( uchar * clock_time )
{
uchar *i;
i = clock_time ;
clock_time ++ ; //????
Lcd_Set_Clock( 2, i ); //?????????????
Key_Idle();
while(1)
{
uchar minute;
minute = ( ( * clock_time >>4 ) * 10 ) + ( ( * clock_time ) & 0x0f ); //BCD ? HEX
switch( Key_Scan() ) //??????
{
case KEY_UP:
{
minute ++;
if(minute==60)
minute=0;
(*clock_time)=minute/10<<4;
(*clock_time)=(*clock_time)|( minute%10); //HEX ? BCD
Lcd_Set_Clock( 2, i ); //?????????????
Key_Idle();
break;
}
case KEY_DOWN:
{
if(minute==0)
minute=60;
minute --;
(*clock_time)=minute/10<<4;
(*clock_time)=(*clock_time)|(minute%10); //HEX ? BCD
Lcd_Set_Clock( 2, i ); //?????????????
Key_Idle();
break;
}
case KEY_FUNC: //?????
{
clock_time ++; //????
Lcd_Set_Clock(3,i); //?????????????
Key_Idle();
while(1)
{
uchar hour;
hour=((*clock_time>>4)*10)+((*clock_time)&0x0f); //BCD ? HEX
switch( Key_Scan())
{
case KEY_UP:
{
hour ++;
if(hour==24)
hour = 0;
(*clock_time)=hour/10 <<4 ;
(*clock_time)=(*clock_time)|(hour%10); //HEX ? BCD
Lcd_Set_Clock( 3, i ); //?????????????
Key_Idle();
break;
}
case KEY_DOWN:
{
if(hour == 0)
hour = 24;
hour --;
if( hour == 0)
hour =23;
(*clock_time)=hour/10 <<4 ;
(*clock_time)=(*clock_time)|(hour%10); //HEX ? BCD
Lcd_Set_Clock( 3, i ); //?????????????
Key_Idle();
break;
}
case KEY_FUNC: //??????
{
clock_time ++; //?????
Lcd_Set_Clock( 4, i ); //?????????????
Key_Idle();
while(1)
{
uchar day;
day = ( (*clock_time >>4)*10 ) + ( (*clock_time)&0x0f ); //BCD ? HEX
switch(Key_Scan())
{
case KEY_UP:
{
day ++;
if(day==32)
day=1;
(*clock_time)=day/10 <<4 ;
(*clock_time)=(*clock_time)|(day%10); //HEX ? BCD
Lcd_Set_Clock( 4, i ); //?????????????
Key_Idle();
break;
}
case KEY_DOWN:
{
if(day == 0)
day= 31;
day --;
if(day == 0)
day=31;
(*clock_time) = day/10 <<4 ;
(*clock_time) = (*clock_time) | (day%10); //HEX ? BCD ;
Lcd_Set_Clock( 4, i ); //?????????????
Key_Idle();
break;
}
case KEY_FUNC: //??????
{
clock_time ++; //?????
Lcd_Set_Clock( 5, i ); //?????????????
Key_Idle();
while(1)
{
uchar month;
month = ( ( * clock_time >>4)*10 ) + ( ( * clock_time ) & 0x0f ); //BCD ? HEX
switch(Key_Scan())
{
case KEY_UP:
{
month ++;
if(month == 13)
month= 1;
(*clock_time)=month/10<<4;
(*clock_time)=(*clock_time)|(month%10); //HEX ? BCD
Lcd_Set_Clock( 5, i ); //?????????????
Key_Idle();
break;
}
case KEY_DOWN:
{
if(month==0)
month = 12;
month --;
if(month==0)
month = 12;
(*clock_time)=month/10 <<4;
(*clock_time)=(*clock_time)|(month%10); //HEX ? BCD
Lcd_Set_Clock( 5, i ); //?????????????
Key_Idle();
break;
}
case KEY_FUNC: //??????
{
clock_time ++; //?????
Lcd_Set_Clock( 6, i ); //?????????????
Key_Idle();
while(1)
{
uchar year;
year=((*clock_time>>4)*10)+((*clock_time)&0x0f); //BCD ? HEX
switch( Key_Scan() )
{
case KEY_UP:
{
year ++;
if(year == 100)
year= 0;
(*clock_time)=year/10<<4;
(*clock_time)=(*clock_time)|(year%10); //HEX ? BCD
Lcd_Set_Clock( 6, i ); //?????????????
Key_Idle();
break;
}
case KEY_DOWN:
{
if(year==0)
year=100;
year--;
if(year==0)
year=100;
(*clock_time)=year/10<<4;
(*clock_time)=(*clock_time)|(year%10); //HEX ? BCD
Lcd_Set_Clock( 6, i ); //?????????????
Key_Idle();
break;
}
case KEY_FUNC:
{
goto loop;
break;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
loop: Key_Idle();
}
这是头文件,不知道哪里有问题,头文件无法包含在.c文件中。.c文件显示的错误如下:
..\CODE\KEY.C(97): warning C206: 'Lcd_Set_Clock': missing function-prototype
..\CODE\KEY.C(97): error C267: 'Lcd_Set_Clock': requires ANSI-style prototype
#ifndef KEY_H
#define KEY_H
#include "Include.h"
#ifndef KEY_GLOBAL
#define KEY_EXT extern
#else
#define KEY_EXT
#endif
#define READ_KEY(x,name,b) ((x)?(b|=name):(b&=~name) )
//---------------------?????????-------------------------------------
#define IN_PRESS_UP P0_0 //???????????????
#define IN_PRESS_DOWN P0_1 //??????????????
#define IN_PRESS_CLEAR P0_2 //??????????
#define IN_PRESS_FUNC P0_3 //???????????
//----------------------??????-----------------------------------------
#define KEY_FORCE_VALUE 0 //??????Ч???
enum KEY_VALUE{KEY_UP=0x01,KEY_DOWN=0x02,KEY_CLEAR=0x04,KEY_FUNC=0x08,KEY_NULL=0x00};
KEY_EXT void key_delay_us(uint us);
KEY_EXT void key_init(void);
KEY_EXT void Key_Idle(void);
KEY_EXT uchar Key_Scan(void);
KEY_EXT void Key_Set_Clock( uchar * clock_time );
KEY_EXT void Key_Set_Alarm(uchar * alarm_time);
KEY_EXT void Key_Function(uchar * clock_time,uchar* alarm_time);
#endif
|