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


Browsing this Thread:   1 Anonymous Users






Re: PIC18F2553 AD參數設定的問題
#4
新會員
新會員


查看用戶資訊
至於delay時間,我再試試,謝謝您的意見。

發表於: 2009/8/4 11:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F2553 AD參數設定的問題
#3
資深會員
資深會員


查看用戶資訊
ADCON0=0x01; // AN0
Delay10KTCYx(50); // 這裡delay較好,時間則請再自行調整
ADCON0bits.GO=1;
while(ADCON0bits.GO);
AD[0]=(((unsigned int)ADRESH)<<8)|(ADRESL);

發表於: 2009/8/2 21:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F2553 AD參數設定的問題
#2
資深會員
資深會員


查看用戶資訊
參照:

louis_hsu 寫道:

1. 當AD從AN0轉為AN1 (即設定ADCON0=0x05)
需等候多久的時間? (此處需等候10*50*Tcy的時間)
A: 請看 ADCON2 設定 ( 最少 需 1.4 uS )

2. 如何計算Tcy = 1/Fosc = 1/48MHz (是否正確?)
A: Tcy = 1/Fosc * 4

3. 1Tcy = Nop(); 對嗎?
A: Yes
謝謝

Attach file:



jpg  (0.00 KB)


發表於: 2009/8/2 20:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC18F2553 AD參數設定的問題
#1
新會員
新會員


查看用戶資訊
在讀取AD暫存器的值時,需要預先delay 很長的一段時間,
否則AD讀到的值都是0或4087。
clock設定如下:
OSC1/OSC2的Clock = 16MHz
CPU CLOCK: Fosc = 96MHz/2 = 48MHz
程式如下:
ADCON1=0b00001101; // 2 AD inputs
ADCON2=0b10010110; // 4TAD, FOSC/64,此設定恰當嗎?
while(1)
{
Delay10KTCYx(50); // delay 10k*50*Tcy
ADCON0=0x01; // AN0
ADCON0bits.GO=1;
while(ADCON0bits.GO);
AD[0]=(((unsigned int)ADRESH)<<8)|(ADRESL);

Delay10KTCYx(50); // delay 10k*50*Tcy
ADCON0=0x05; // AN1
ADCON0bits.GO=1;
while(ADCON0bits.GO);
AD[1]=(((unsigned int)ADRESH)<<8)|(ADRESL);
}
1. 當AD從AN0轉為AN1 (即設定ADCON0=0x05)
需等候多久的時間? (此處需等候10*50*Tcy的時間)
2. 如何計算Tcy = 1/Fosc = 1/48MHz (是否正確?)
3. 1Tcy = Nop(); 對嗎?

謝謝

發表於: 2009/8/1 15:57
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... ]

教育訓練中心

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