Re: 請教 dsPIC33FJ256GP710 的 ADC 問題...
|
||||
---|---|---|---|---|
版主
|
剛跟同事討論一下,要多CH輸入就必須使用 DMA 的方式,而此範例只有美國有提供在網站上。
發表於: 2008/2/21 15:30
|
|||
|
Re: 請教 dsPIC33FJ256GP710 的 ADC 問題...
|
||||
---|---|---|---|---|
版主
|
看下 dsPIC30F ADC module 的說明,我忘記 dsPIC33F 的掃描是否要配合 DMA 一起工作。
http://www.microchip.com.tw/modules/mydownloads/viewcat.php?cid=4 的第六項就是了。
發表於: 2008/2/21 14:40
|
|||
|
Re: 請教 dsPIC33FJ256GP710 的 ADC 問題...
|
||||
---|---|---|---|---|
新會員
|
板主你好:
單 Port 的輸入我有實作完成,目前在多 Port 的輸入踢到大鐵板,請問你所說的自動掃描轉換輸入的方式該如何做呢? 有什麼文件或範例可以參考的嗎?
發表於: 2008/2/21 14:33
|
|||
|
Re: 請教 dsPIC33FJ256GP710 的 ADC 問題...
|
||||
---|---|---|---|---|
版主
|
底下是一個使用 dsPIC33FJ128MC506 使用 AN5 輸入的程式,僅供參考:[code]void __attribute__((interrupt, no_auto_psv)) _ADC1Interrupt(void)
{ IFS0bits.AD1IF = 0 ; MyADC = ADC1BUF0 ; } void ADC_Initial(void) { AD1PCFGL = 0xFFDF; // AN5 is Analog , others are Digital; AD1CON1 = 0x0446; // 0b0000 0000 0100 0110 // Auto convert using TMR3 as trigger source // A/D Sample Auto-Start AD1CON2 = 0x0000; // ADCON2 = 0000 0000 0000 0000 // Don't scan inputs , SMPi = 00 ( Interrupt for each sample/convert ) AD1CSSL = 0x0000; // no scan input selected ....... AD1CON3 = 0x1F3F; // TAD = 8 Tcy , SAMC = 15 TAD AD1CHS0 = 0x0005; // ADCHS = 0b 00000000 00000101 AD1CON4 = 0x0000; IFS0bits.AD1IF = 0 ; IEC0bits.AD1IE = 1 ; // Enable AD interrupt IPC3bits.AD1IP = 5 ; // Set Priority to 7 >> highest !! AD1CON1bits.ADON = 1; // turn ADC ON }[/code] 要使用多CH輸入可以使用自動掃描方式做轉換輸入。
發表於: 2008/2/21 14:27
|
|||
|
請教 dsPIC33FJ256GP710 的 ADC 問題...
|
||||
---|---|---|---|---|
新會員
|
最近正在學習 dsPIC 的東西,是個很菜的新手,如果問的問題太笨,還請大家多包涵...:)
手上有片 explorer 16 的開發板,上面目前裝的是 dsPIC33FJ256GP710 的 mcu,在嘗試多 port 輸入的取樣轉換時遇到很大的問題,看了 data sheet 及 dsPIC33F Family Reference Manual 的 adc 部分,只有在 ref manual 找到 dma 存取的多 port 輸入範例,請問有哪位高人大德能提供其他不同的範例呢? 原先有參考曾百由先生 C30 的書,只是書中用的是 30 系列的 mcu,在 ad 的部分似乎跟 33 系列的有點出入,33 系列的 adc buffer 好像只有一個?那該如何讀取多 port 取樣轉換後的值呢? 目前我用的做法是在中斷發生後改變 AD1CHS0 的值來達成多 port 個別取樣轉換,該不會 33 系列只能這麼作吧? 請各位先進不吝指教在下,感激不盡...:)
發表於: 2008/2/21 14:13
|
|||
|