Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
資深會員
|
犯了一個新手常見的錯誤!
兩個source file 只改了一個 #include <18f4520.h> 就出現 一卡車的錯誤! ================================= w401 有adc的範例 舊的 void InitializeAD(void) { OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF); } 改成 void InitializeAD(void) { OpenADC( ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_12_TAD, ADC_CH0 & ADC_REF_VDD_VSS & ADC_INT_OFF,12 ); } 就沒問題, 可以仔細練習! 謝謝! FAE
發表於: 2009/5/26 12:19
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
版主
|
先解決 Error 的部份,因為找不到該元件的h檔,所以那些有使用的週邊名稱找不到,檢查一下 include H 檔的路徑。請在Project options 下設定一下路徑。
Attach file: (0.00 KB)
發表於: 2009/5/22 14:25
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
資深會員
|
更新 C18 V3.3 就有 periph 目錄
依 ad converter 說明資料 EX3-1,EX3-2 修正 ok! ============================== w401 EX-4 有出現兩個Warning // LCD_ItoA(AD_Temp); // Show 10-bit A/D Decimal Valum on LCD itoa ( AD_Temp , ASCII_Buf ) ; //75 putsLCD(ASCII_Buf) ; //76 // LCD_Update=1000; D:\DN_2009\C\W401 Answer\Ans4\ex4.c:75:Warning [2054] suspicious pointer conversion D:\DN_2009\C\W401 Answer\Ans4\ex4.c:76:Warning [2054] suspicious pointer conversion 還有一卡車 [1109]error C:\mcc18\h\p18f4520.h:51:Error [1109] type mismatch in redeclaration of 'PORTAbits' C:\mcc18\h\p18f4520.h:84:Error [1109] type mismatch in redeclaration of 'PORTBbits' C:\mcc18\h\p18f4520.h:120:Error [1109] type mismatch in redeclaration of 'PORTCbits' C:\mcc18\h\p18f4520.h:179:Error [1109] type mismatch in redeclaration of 'PORTEbits' C:\mcc18\h\p18f4520.h:324:Error [1109] type mismatch in redeclaration of 'DDREbits' C:\mcc18\h\p18f4520.h:400:Error [1109] type mismatch in redeclaration of 'PIE2bits' C:\mcc18\h\p18f4520.h:417:Error [1109] type mismatch in redeclaration of 'PIR2bits' C:\mcc18\h\p18f4520.h:434:Error [1109] type mismatch in redeclaration of 'IPR2bits' C:\mcc18\h\p18f4520.h:465:Error [1109] type mismatch in redeclaration of 'RCSTAbits' C:\mcc18\h\p18f4520.h:476:Error [1109] type mismatch in redeclaration of 'TXSTAbits' C:\mcc18\h\p18f4520.h:597:Error [1109] type mismatch in redeclaration of 'CCP2CONbits' C:\mcc18\h\p18f4520.h:618:Error [1109] type mismatch in redeclaration of 'CCP1CONbits' C:\mcc18\h\p18f4520.h:641:Error [1109] type mismatch in redeclaration of 'ADCON1bits' C:\mcc18\h\p18f4520.h:664:Error [1109] type mismatch in redeclaration of 'ADCON0bits' C:\mcc18\h\p18f4520.h:726:Error [1109] type mismatch in redeclaration of 'SSPSTATbits' C:\mcc18\h\p18f4520.h:738:Error [1109] type mismatch in redeclaration of 'T2CONbits' C:\mcc18\h\p18f4520.h:757:Error [1109] type mismatch in redeclaration of 'T1CONbits' C:\mcc18\h\p18f4520.h:779:Error [1109] type mismatch in redeclaration of 'RCONbits' C:\mcc18\h\p18f4520.h:852:Error [1109] type mismatch in redeclaration of 'LVDCONbits' C:\mcc18\h\p18f4520.h:869:Error [1109] type mismatch in redeclaration of 'OSCCONbits' C:\mcc18\h\p18f4520.h:957:Error [1109] type mismatch in redeclaration of 'INTCON2bits' C:\mcc18\h\p18f4520.h:980:Error [1109] type mismatch in redeclaration of 'INTCONbits' C:\mcc18\h\p18f4520.h:1009:Error [1109] type mismatch in redeclaration of 'STKPTRbits' Halting build on first failure as requested. 要怎麼解決?
發表於: 2009/5/20 20:00
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
版主
|
可能你的 c18 版本太舊了,重先抓一下 C18 v3.0
http://www.microchip.com/stellent/idc ... Id=1406&dDocName=en010014 如果妳是使用正式版就下載 Upgrade Version. 如果是試用版,下載 Evaluation version 需先登記後才可下載。
發表於: 2009/5/19 11:18
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
資深會員
|
引言
到這裡找一下怎樣使用 ADC 的說明: C:\MCC18\doc\periph-lib\AD Converter.htm 注意 ADC 函數有眾多版本,PIC18F8722 式在V5 的版本。請參考V5 的函數使用說明。 2.4.3 OpenADC (ADC_V3, 4, 5, 6) For ADC_V3, ADC_V4, ADC_V5 and ADC_V6 Function: Configure the A/D convertor. Include: adc.h Prototype: void OpenADC(unsigned char config, unsigned char config2 , unsigned char portconfig); ============================================================== 我的 C:\mcc18\doc 之下只有3個html help file 及3個C18 的pdf 所以不知道ADC V1~V9 在哪裡 C18 C complier libraries.pdf p.9~ P15 有一些資料沒看懂? 我正在學C ,請版主修改w401 ex:3-1 範例為pic18f4520 void InitializeAD(void) { OpenADC( ADC_FOSC_32 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF ); } 新手 RUN C, 敬請包涵 !
發表於: 2009/5/18 21:32
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
版主
|
順便也把這篇看完,這樣就知道其中的差異性:
PIC18F452 → PIC18F4520 Migration http://ww1.microchip.com/downloads/en/DeviceDoc/39647a.pdf
發表於: 2009/5/18 14:35
|
|||
|
Re: PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
資深會員
|
發表於: 2009/5/16 12:59
|
|||
|
PIC18F4520 與 PIC18F452 在C18 的差別
|
||||
---|---|---|---|---|
資深會員
|
最進剛購入app001 ver.3 MCU 為18F4520
安裝W401的教材是18F452, MPLAB 8.3 及C18 v3.11 device 18f452設定不變 c18 都未產生錯誤 ex3-1.mcp,ex3-2.mcp 將deive 改為18f4520, lkr 改為18f4520i.lkr 改 #include <p18f4520.h> 就出現錯誤 D:\Tools\Microchip\Answer WAP001\Ans3-2\ex3-2.c:46:Error [1105] symbol 'ADC_1ANA_0REF' has not been defined D:\Tools\Microchip\Answer WAP001\Ans3-2\ex3-2.c:46:Error [1203] too few arguments in function call Halting build on first failure as requested. w401的範例所有含 adc.h 都有問題 請問版主要如何修正 謝謝!
發表於: 2009/5/16 11:59
|
|||
|