• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 請教各位前輩們有關ADC轉出來的值不正確(APP026-3)
#4
新會員
新會員


查看用戶資訊
謝謝版主和前輩的指導~我再試看看

發表於: 2009/5/13 17:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教各位前輩們有關ADC轉出來的值不正確(APP026-3)
#3
版主
版主


查看用戶資訊
APP026-3 有一出廠測試程式,程式使用 AN2 來讀取 VR1 or VR2 的 Analog input 然後顯示於 LCD. LCD 則是使用 PMP 的方式控制. 請下載參考一下:

http://www.microchip.com.tw/modules/w ... nglefile.php?cid=7&lid=80

發表於: 2009/5/13 9:42
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教各位前輩們有關ADC轉出來的值不正確(APP026-3)
#2
新會員
新會員


查看用戶資訊
AD1CON3bits.ADCS = 0 會否太少了?

我不太清楚dsPIC24F的結構,

但正常Tad = Tcy*(ADCS+1) ;

Tconv = 14*Tad;

你現在ADCS = 0, Tad 變成0, 我用的dsPIC33F最少Tad也要117ns, 你這個行嗎?

發表於: 2009/5/13 2:09
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請教各位前輩們有關ADC轉出來的值不正確(APP026-3)
#1
新會員
新會員


查看用戶資訊
各位前輩大家好!有個ADC問題想請問大家,我使用的是PIC24FJ128GB106。
我在轉出來的值好像不是一個正確的值(它存在ADC1BUF0),
我轉出來的格式是整數,然後在類比輸入腳接GND時,轉出的值卻不是十進制的0而是會亂跳,大概在1022上下。

並且我在好像也不能直接在MAIN裡面直接轉換,而一定要用ADC中斷來做,是否有哪些東西我沒有設定到呢?

各位前輩是否有最簡單最簡單的範例讓晚輩參考的,

以下為我的程式,可否有前輩願意幫我解惑呢(><)

#include <p24fxxxx.h>
#include <adc.h>

_CONFIG1(JTAGEN_OFF & ICS_PGx1 & FWDTEN_OFF )
_CONFIG2(FNOSC_PRIPLL & POSCMOD_HS)



void initAdc1(void)
{


AD1CON1bits.FORM = 0;


AD1CON1bits.SSRC = 7;


AD1CON1bits.ASAM = 1;


AD1CON2bits.SMPI = 0;


AD1CON3bits.ADRC = 0;


AD1CON3bits.SAMC = 4;


AD1CON3bits.ADCS = 0;


AD1CHS = 5;


AD1PCFG = 0xFFFF;
AD1PCFGbits.PCFG5 = 0;

IFS0bits.AD1IF = 0;
IEC0bits.AD1IE = 1;
AD1CON1bits.ADON = 1;


}



unsigned int adcBuff;


void __attribute__((interrupt, no_auto_psv)) _ADC1Interrupt(void)
{

adcBuff = ADC1BUF0;


IFS0bits.AD1IF = 0;
}


int main (void)
{


initAdc1();



while (1);

return 0;
}

發表於: 2009/5/12 17:16
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







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.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------