16F1828編譯問題

作者 aneric 於 2017年07月17日 16:32:45
利用曾百由老師書裡的範例
練習16F1828
編譯時出現錯誤
但只要將delay_ms(100)指令刪除
就可以順利編譯



#include <xc.h> //微控制器使用XC編譯器定義檔

void delay_ms(unsigned long A)
{
unsigned long i, j;
for(i=0;i<A;i++)
{
for(j=0;j<110;j++) Nop();
}
return;
}

void main (void) {

LATC = 0x00; // 將PORTD設定關閉LED
TRISC = 0; // 將TRISD設為0,PORTD設定為輸出
while (1)
{ // 無窮迴圈
delay_ms(100); // 延遲100ms
LATC++; // 遞加PORTD
}
}
---------------------------------------------
編譯錯誤
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: (499) undefined symbol:
_Nop(dist/default/production\ex6_1_IO.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:141: recipe for target 'dist/default/production/ex6_1_IO.X.production.hex' failed
make[2]: Leaving directory 'D:/ex/EX_for_XC8_16F1828/ex6_1_IO/ex6_1_IO.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/ex/EX_for_XC8_16F1828/ex6_1_IO/ex6_1_IO.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/ex6_1_IO.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=1&topic_id=21248&post_id=76052