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


Browsing this Thread:   1 Anonymous Users




« 1 (2)


Re: 程式碼一問,為何編譯過不了??
#2
版主
版主


查看用戶資訊
在 Project 裏的 Library 裏加入 libpPIC24Fxxx-coff.a 的資料庫檔案

其路徑在 C:\Program Files\Microchip\MPLAB C30\lib\PIC24F其路徑在

發表於: 2008/11/6 13:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


程式碼一問,為何編譯過不了??
#1
初級會員
初級會員


查看用戶資訊
問一下,以下是我的程式碼。可是一直過不了編譯。
不曉得為什?
錯誤訊息為:
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
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... ]

教育訓練中心

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