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


Browsing this Thread:   1 Anonymous Users






版主您好,在PIC18f85j10中使用AD0遇到的一些問題
#1
新會員
新會員


查看用戶資訊
在PIC18F85J10中使用AD0做AD變換,我的程序這樣:
void PortInit(void)
{
TRISA = 0x1d;
TRISB=0xfe;
TRISC=0x91;
TRISD=0x00;
TRISE=0x00;
TRISF=0x02;
TRISH=0x00;
TRISG=0x00;
TRISJ=0xf0;

}
void CVPinit(void)
{
INTCON=0x20;
PIR1=0x13;
PIE1=0x23;
CMCON=0x07;
CVRCON=0x00;
ADCON0 = 0x01;
ADCON1 = 0x0c;
ADCON2 = 0xBE; //40MHZ晶振
}
unsigned int FADCDone(void)
{
unsigned int FADCtemp;
FADCdat = 0;
ADCON0 = 0x01;
ADCON0bits.GO_DONE = 1;
while(!PIR1bits.ADIF);
PIR1bits.ADIF = 0;
ADCON0bits.GO_DONE = 0;
FADCtemp = ADRESH;
FADCtemp <<= 8;
FADCtemp += ADRESL;
return FADCtemp;
}
void main(void)
{
unsigned int tdata;
PortInit();
CVPinit():
tdata= FADCDone();
}
AD變換得到的AD值總是一部分值是實際轉換出來的AD值,時不時的冒出一個AD值是0x200,我就不清楚0x200是怎麽得出來的,也不知我這軟件編寫的有什么錯誤?硬件上是采用3.3V基準,多謝大家能够幫幫我啊

發表於: 2007/12/15 8:28
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... ]

教育訓練中心

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