• 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: PIC18F4520 與 PIC18F452 在C18 的差別
#9
版主
版主


查看用戶資訊
因為PIC18Fxxxx 的種類眾多,單是ADC就分成很多種,所以使用ADC前要先知道PIC編號及相對應的函數庫 Version,以 PIC18F4520 為例使用的是 ADC_V5 的版本。其實查一下 C:\MCC18\doc\periph-lib 底下的 AD Converter.html 即可了解。

TABLEVERSION vsDEVICES 

Version name
 Device number
 
ADC_V1
18C242
18C25218C44218C45218F24218F252,
18F44218F45218F248 18F25818F44818F458,
18F243918F253918F443918F4539
 
ADC_V2
18C601
18C80118C65818C85818F662018F6720,
18F862018F872018F652018F8520
 
ADC_V3
18F1220
18F1320
 
ADC_V4
18F1230
18F1330
 
ADC_V5
18F2220
18F232018F422018F432018F2420,
18F252018F442018F452018F242318F2523,
18F442318F452318F245518F255018F4455,
18F455018F241018F251018F251518F2610,
18F441018F451018F451518F461018F2525,
18F262018F452518F462018F631018F6410
18F8310
18F841018F639018F649018F8390,
18F849018F652718F662218F662718F6722,
18F852718F862218F862718F872218F6585,
18F668018F858518F868018F652518F6621,
18F852518F862118F245018F445018F2480,
18F258018F448018F458018F258518F2680,
18F458518F468018F268218F268518F4682,
18F468518F222118F232118F422118F4321
 
ADC_V6
18F24J10
18F25J1018F44J1018F45J1018F63J11,
18F64J1118F65J1118F83J1118F84J1118F85J11,
18F63J9018F64J9018F65J9018F83J9018F84J90,
18F85J9018F65J1018F65J1518F66J1018F66J15,
18F67J1018F85J1018F85J1518F86J1018F86J15,
18F87J1018F66J6018F66J6518F67J6018F86J60,
18F86J6518F87J6018F96J6018F96J6518F97J60
 
ADC_V7
18F4331
18F4431
 
ADC_V7_1
18F2331
18F2431
 
ADC_V8
18F23K20
18F24K2018F25K2018F43K2018F44K20,
18F45K20
 
ADC_V9
18F66J11
18F66J1618F67J1118F86J1118F86J16
18F87J11
18F65J5018F66J5018F66J5518F67J50
18F85J50
18F86J5018F86J5518F87J50
 
ADC_V10
18F13K50
18LF13K5018F14K5018LF14K5018F13K22
18F14K2218LF13K2218LF14K22
 
ADC_V11
18F24J50
18F25J5018F26J5018F44J5018F45J50,
18F46J5018F24J1118F25J1118F26J1118F44J11,
18F45J1118F46J1118F24J5018F25J5018F26J50
18F44J5018F45J5018LF46J5018LF24J1118LF25J11
18LF26J1118LF44J11,18LF45J1118LF46J11
 
ADC_V12
18F66J90
18F67J9018F86J9018F87J90

發表於: 2009/5/26 13:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#8
資深會員
資深會員


查看用戶資訊
犯了一個新手常見的錯誤!

兩個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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#7
版主
版主


查看用戶資訊
先解決 Error 的部份,因為找不到該元件的h檔,所以那些有使用的週邊名稱找不到,檢查一下 include H 檔的路徑。請在Project options 下設定一下路徑。

Attach file:



jpg  (0.00 KB)


發表於: 2009/5/22 14:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#6
資深會員
資深會員


查看用戶資訊
更新 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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#5
版主
版主


查看用戶資訊
可能你的 c18 版本太舊了,重先抓一下 C18 v3.0 
http://www.microchip.com/stellent/idc ... Id=1406&dDocName=en010014

如果妳是使用正式版就下載 Upgrade Version.
如果是試用版,下載 Evaluation version

需先登記後才可下載。

發表於: 2009/5/19 11:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#4
資深會員
資深會員


查看用戶資訊
引言

到這裡找一下怎樣使用 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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#3
版主
版主


查看用戶資訊
順便也把這篇看完,這樣就知道其中的差異性:
PIC18F452 → PIC18F4520 Migration
http://ww1.microchip.com/downloads/en/DeviceDoc/39647a.pdf

發表於: 2009/5/18 14:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4520 與 PIC18F452 在C18 的差別
#2
資深會員
資深會員


查看用戶資訊

發表於: 2009/5/16 12:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC18F4520 與 PIC18F452 在C18 的差別
#1
資深會員
資深會員


查看用戶資訊
最進剛購入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
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... ]

教育訓練中心

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