Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
新會員
|
不過我還是覺得我的可變電阻沒啥作用耶
AD1PCFGLbits.PCFG5=0; 設定成這樣不就是來源是類比的AN5輸入嗎? 這樣的話電壓應該是會跟著可變電阻的改變而改變呀? 可是我怎麼覺得我的可變電阻怎麼調都沒效果 我看不出來程式哪裡有出問題? 是有少設定什麼嗎?還是?
發表於: 2008/7/15 17:06
|
|||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
資深會員
|
如果ADC的操作範圍是0~3.3V的話,3.3/1024=3.2mv,一般透過可變電阻進ADC的跳動本來就燒大。10的跳動幅度也不過30mv,這樣算正常的吧?
一般操作範圍在0~3.3V的話,典型會有約1.5LSB的跳動。0~5V約1LSB跳動。不過這是指輸入信號良好的狀況。
發表於: 2008/7/15 16:33
|
|||
不要問我哪裡來,我只是個流浪天涯的工程師
|
||||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
新會員
|
喔喔~
不過我跳動的範圍很大~~ 而且ADCBUF0這裡的數值會跑到10多.. 不過版子上的電壓不是只有3.3V嗎? 怎麼會跑到10多?..
發表於: 2008/7/15 16:08
|
|||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
版主
|
AD 值會跳動是很正常的,因為 Digital 的環境下有太多的干擾,不過這種因雜訊所引起的跳動僅限於 Bit0 & Bit1 兩個LSB的跳動,如果是很多位元同時跳動時程式就有問題了。
發表於: 2008/7/15 16:04
|
|||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
版主
|
ADC 轉換沒有說一定要使用中斷方式處理,但考慮系統的架構最好將 AD 的轉換交由中斷去處理。這樣主程式比較單純。
VCFG<2:0>: Converter Voltage Reference Configuration bits AD1PCFGH: ADC1 Port Configuration Register High VCFG 是選擇參考電壓源,與選擇哪幾找要做 AD 輸入無關。 AD1PCFGH & AD1PCFGL 則是選擇哪幾支 I/O 腳位要當作 AD 的輸入。
發表於: 2008/7/14 15:56
|
|||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
新會員
|
請問一下我的程式需要用到中斷嗎~?
還有輸入是要用 這個AD1CON2bits.VCFG=0; 還是AD1PCFGL = 0xFFDF; ? 我手邊是已經有書本了~~ 不過看了很久還是好難了解... 快昏了...
發表於: 2008/7/14 14:54
|
|||
|
Re: ADC轉換基本的問題
|
||||
---|---|---|---|---|
版主
|
看了你的程式個人認為你對 ADC 的 Module 的工作原理與使用方式還不是很清楚。建議先讀一下 dsPIC30F Peripheral Module 裡的 10-bit ADC 講義與練習。在左邊下載中心可以找到。
另外,Microchip 也也ㄧ些範例在這裡參考看看: http://www.microchip.com/stellent/idc ... e=SS_GET_PAGE&nodeId=2622 底下是我寫的 dsPIC33F128MC506 for 10-bit ADC 的程式,使用中斷方式讀取AD
AD1PCFGL = 0xFFDF; // AN5 is ADC input
發表於: 2008/7/14 11:40
|
|||
|
ADC轉換基本的問題
|
||||
---|---|---|---|---|
新會員
|
#define _dsPIC33FJ256GP710_
#include <p33FJ256GP710.h>
這是我打的程式 主要的功能就是用版子上的電源,在調整可調電阻VR調整電壓輸出 用LED的亮燈來表示電壓大小 不過好像怎麼打都打不出來 想請問大大我的設定方面有錯誤嗎 還有PORTA要等於什麼才能表是轉換完的數值? 是AD1CSSH這個數值嗎? 拜託大大給我點方向了~~謝謝
發表於: 2008/7/13 21:59
Edited by Ryang on 2008年07月14日 11:33:28
|
|||
|