• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 主程式與指令程式的問題
#2
初級會員
初級會員


查看用戶資訊
從Error Mssage中看來
是'F_Delay'重複定義

你查一下 F_Delay 是否重複定義

發表於: 2005/3/30 11:42
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


主程式與指令程式的問題
#1
新會員
新會員


查看用戶資訊
大家好,我是使用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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







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.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------