Browsing this Thread:
2 Anonymous Users
|
Re: 讀取兩個channel 的AD , 其中一個發生錯誤
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 111145 EXP : 45
|
ADCON0=0b00000101; //設AD2 (AN1) 在PIC18F4520是選擇了 AN1 為輸入。程式看起來沒有錯,請用電錶量一下 AN1 實際電壓值為何?
發表於: 2008/6/16 17:42
|
|
|
讀取兩個channel 的AD , 其中一個發生錯誤
|
|
初級會員
Joined
: 2007/5/15 17:55 最後登入時間
: 2022/11/15 14:46
Group:
註冊會員
Level : 3 HP : 0 / 68 MP : 8 / 3471 EXP : 73
|
請問各位大大 我的程式這樣寫 為什麼18F的AN0的資料可正確讀取 但AN1的資料讀回來都是錯的
ADCON1=0b00001101; // use AN0 and AN1 ADCON2=0b10001101; // Right justified
ADCON0=0b00000001; //設AD1 (AN0) Delay100TCYx(10); ADCON0bits.GO = 1; // Start AD conversion while(ADCON0bits.NOT_DONE); // Wait for conversion BATT[k]=ADRESH&0x03; //high byte BATT[k+1]=ADRESL; //low byte
ADCON0=0b00000101; //設AD2 (AN1) Delay100TCYx(10); ADCON0bits.GO = 1; // Start AD conversion while(ADCON0bits.NOT_DONE); // Wait for conversion BATT[k+3]=ADRESH&0x03; //high byte BATT[k+4]=ADRESL; //low byte
發表於: 2008/6/16 16:59
|
|
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.