請問有關 AD問題
|
||||
---|---|---|---|---|
新會員
|
小弟用 APP026-3 開發板MCU用PIC24FJGA006
run光碟Demo的範例程式 AD轉換值都正常 但是MCU我換上PIC24FJGB106後 register名稱照datasheet修改 AD1CHS改為AD1CHS0 AD的值一直維持在1023..沒有改變 請問是哪裡有問題阿?? int main(void) { int LoopVar1 ; ADC_Initial() ; PMP_Initial(); AD1PCFGbits.PCFG15 = 1 ; LCD_Initial() ; LED0 = 0 ; TRISDbits.TRISD0 = 0; putrsLCD("I am APP026-3") ; LCD_SetCursor(0,1) ; putrsLCD("ADC=") ; while(1) { AD1CHS0 = 0x0002 ; AD_Delay() ; AD1CON1bits.SAMP = 0 ; Nop() ; Nop() ; while ( ! AD1CON1bits.DONE ) ; ADC_TempValue = ADC1BUF0 ; } void ADC_Initial(void) { AD1CON1 = 0b0000000000000110 ; AD1CON2 = 0b0000000000000000 ; AD1CON3 = 0b1000001100001111 ; AD1CHS0 = 0x00 ; AD1PCFG = 0b1111111111111011 ; AD1CON1bits.ADON = 1 ; } Attach file: Link only for registered users
發表於: 2008/11/24 16:46
Edited by yuju on 2008年11月24日 19:04:50
|
|||
|