Browsing this Thread:
1 Anonymous Users
Topic options
View mode
舊的在前
Re: 程式碼一問,為何編譯過不了??
版主
Joined
: 2004/4/30 10:53最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75
HP : 744 / 1861
MP : 5367 / 109492
EXP : 45
在 Project 裏的 Library 裏加入 libpPIC24Fxxx-coff.a 的資料庫檔案 其路徑在 C:\Program Files\Microchip\MPLAB C30\lib\PIC24F其路徑在
發表於: 2008/11/6 13:14
程式碼一問,為何編譯過不了??
初級會員
Joined
: 2004/7/17 9:51最後登入時間
: 2009/7/20 20:15
Group:
註冊會員
Level : 4
HP : 0 / 75
MP : 9 / 4409
EXP : 3
問一下,以下是我的程式碼。可是一直過不了編譯。 不曉得為什? 錯誤訊息為: main.o(.text+0x3e): In function `main': C:\TEST_TEMP\PIC24FJ256GB106_V0.5\main.c:44: undefined reference to `OpenOC1' Link step failed. 我在Project裡已經加入OpenOC1.C檔案了 不曉得為合還是無法過編譯 ------------------------------------------------------ #define USE_AND_OR #define __PIC24F__ #include <P24FXXXX.h> #include <pic24f_periph_features.h> #include <outcompare.h> /* This is ISR corresponding to OC1 interrupt */ void __attribute__((__interrupt__)) _OC1Interrupt(void) { IFS0bits.OC1IF = 0; } int main(void) { /* Holds the value at which OCx Pin to be driven high */ unsigned int pulse_start; /* Holds the value at which OCx Pin to be driven low */ unsigned int pulse_stop; /* Turn off OC1 module */ CloseOC1(); /* Configure output compare1 interrupt */ ConfigIntOC1(OC_INT_OFF | OC_INT_PRIOR_5); /* Configure OC1 module for required pulse width */ pulse_start = 0x40; pulse_stop = 0x60; PR3 = 0x80 ; PR1 = 0xffff; TMR1 = 0x0000; T3CON = 0x8000; T1CON = 0X8000; /* Configure Output Compare module to 'initialise OCx pin low and generate continuous pulse'mode */ OpenOC1(OC_IDLE_CON & OC_TIMER3_SRC & OC_CONTINUE_PULSE, pulse_stop, pulse_start); /* Generate continuous pulse till TMR1 reaches 0xff00 */ while(TMR1<= 0xff00); asm("nop"); CloseOC1(); return 0; }
發表於: 2008/11/6 12:55
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.