Browsing this Thread:
1 Anonymous Users
|
Re: 主程式與指令程式的問題
|
|
初級會員
Joined
: 2004/5/17 9:20 最後登入時間
: 2008/11/9 0:33
From 家裡
Group:
註冊會員
Level : 4 HP : 0 / 94 MP : 12 / 5500 EXP : 76
|
從Error Mssage中看來 是'F_Delay'重複定義
你查一下 F_Delay 是否重複定義
發表於: 2005/3/30 11:42
|
|
|
主程式與指令程式的問題
|
|
新會員
Joined
: 2005/3/7 15:09 最後登入時間
: 2005/10/20 9:25
Group:
註冊會員
Level : 2 HP : 0 / 25 MP : 3 / 1400 EXP : 0
|
大家好,我是使用C18來進行Build All,在source files加入主程式與指令程式,但卻顯示:
Error - symbol 'F_Delay' has multiple definitions.
請各位前輩,告訴我,是哪裡出錯阿! 謝謝~~~
主程式: #include <p18cxxx.h> #include "delay.c" #define LEFT 0 #define RIGHT 1 void F_Initial ( void ); void main (void) { int I_Direction=LEFT; F_Initial(); while ( 1 ) { F_Delay ( 5000 ); switch ( I_Direction ) { case LEFT: PORTD <<= 1; if ( PORTD == 128 ) I_Direction = RIGHT; break; case RIGHT: PORTD >>= 1; if ( PORTD == 1 ) I_Direction = LEFT; break; default: break; } } }
void F_Initial () { TRISD = 0; PORTD = 1; }
指令程式: #include <p18cxxx.h> #include <delays.h> #define LCD_CMD PORTE #define LCD_DATA PORTB void F_LCD_Clear(void); void F_LCD_Home(void); void F_LCD_Entry(unsigned char); void F_LCD_Display(unsigned char); void F_LCD_Cursor(unsigned char); void F_LCD_Function(unsigned char); void F_LCD_Set_CGA(unsigned char); void F_LCD_Set_DDA(unsigned char); unsigned char F_Check_LCD_Busy(void); void F_LCD_Put_Cmd(unsigned char); void F_LCD_Put_Data(unsigned char); void F_LCD_Initial(void); void F_LCD_Clear(void) { F_LCD_Put_Cmd(0x01); Delay10TCYx(200); }
void F_LCD_Home(void) { F_LCD_Put_Cmd(0x02); }
void F_LCD_Entry(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x04 | (0x03 & UC_LCD_CMD)); }
void F_LCD_Display(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x08 | (0x07 & UC_LCD_CMD)); }
void F_LCD_Cursor(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x10 | (0x0c & UC_LCD_CMD)); }
void F_LCD_Function(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x20 | (0x1c & UC_LCD_CMD)); }
void F_LCD_Set_CGA(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x40 | (0x3F & UC_LCD_CMD)); }
void F_LCD_Set_DDA(unsigned char UC_LCD_CMD) { F_LCD_Put_Cmd(0x80 | (0x7F & UC_LCD_CMD)); }
unsigned char F_Check_LCD_Busy(void) { unsigned char UC_LCD_Temp; TRISB = 0xFF; LCD_CMD = 0x06; UC_LCD_Temp = (0x80 & LCD_DATA); TRISB = 0; if ( UC_LCD_Temp == 1 ) return (1); else return (0); }
void F_LCD_Put_Cmd(unsigned char UC_LCD_CMD) { while ( F_Check_LCD_Busy() ); LCD_CMD = 0x04; LCD_DATA = UC_LCD_CMD; LCD_CMD = 0x00; Delay10TCYx(50); }
void F_LCD_Put_Data(unsigned char UC_LCD_Data) { while ( F_Check_LCD_Busy() ); LCD_CMD = 0x05; LCD_DATA = UC_LCD_Data; LCD_CMD = 0x01; Delay10TCYx(50); }
void F_LCD_Initial(void) { F_LCD_Put_Cmd(0x30); F_LCD_Put_Cmd(0x30); F_LCD_Put_Cmd(0x30); F_LCD_Function(0x38); F_LCD_Display(0x0e); F_LCD_Clear(); F_LCD_Entry(0x06); }
發表於: 2005/3/30 10:01
|
|
You can view topic.
你 不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.