Browsing this Thread:
1 Anonymous Users
|
Re: PIC18 A/D convert 的請教
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 111025 EXP : 45
|
你有用 ICD2 去 debugging 嗎? 看程式用猜的很辛苦。
AD 轉換的範例 在W401 的教材裡就有。
發表於: 2005/4/11 10:09
|
|
|
PIC18 A/D convert 的請教
|
|
新會員
Joined
: 2005/3/7 15:09 最後登入時間
: 2005/10/20 9:25
Group:
註冊會員
Level : 2 HP : 0 / 25 MP : 3 / 1429 EXP : 0
|
大家好,我是使用PIC18F452,目前利用RA0/AN0當作類比輸入,並將2次之轉換結果,進行比較,最後把比較結果顯示於LCD. 燒錄成功後,卻沒有任何顯示,請問是A/D程式有問題嗎?多謝賜教! Thanx~ 或是誰有更多有關A/D的參考程式,可否提供一下!
... char e1, e2;
void main (void) { ...
InitializeAD( ); ConvertADC(); while(BusyADC( )); e1=ADRESH; ...
InitializeAD( ); ConvertADC(); while(BusyADC( )); e2=ADRESH;
if(e1<e2) { OpenLCD( ); LCD_Set_Cursor(0,0); LCD_L_Delay() ; putsLCD('1'); LCD_L_Delay(); Delay10KTCYx(CPU_SPEED / 200000) ; }
else { OpenLCD( ); LCD_Set_Cursor(0,0); LCD_L_Delay() ; putsLCD('0'); LCD_L_Delay(); Delay10KTCYx(CPU_SPEED / 200000) ; } }
void InitializeAD(void) { OpenADC ( ADC_FOSC_8 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF ); }
發表於: 2005/4/11 3:22
|
|
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.