• 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: A/D converter 問題
#2
管理員
管理員


查看用戶資訊

若使用 MPLAB ICD 2 為 Debugger 時 , 它是預設的 PGD 接腳. 除非您的設定為以下的幾種 :

1. 只使用 MPLAB ICD 2 為 Programmer , 且程式燒錄完成後就將 ICD 2 與 dsPICDEM1.1 離線.

2. 再燒錄的選項 Configure -> Configuration Bits 中 , 選擇其他組接腳為 Debugger !! 當然在燒錄時使用 RB0/RB1 ( PGD/PGC ) , 然後 debug 時切換到 EMUDx/EMUCx.

希望你的問題能順利解決 :)

發表於: 2005/3/1 22:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


A/D converter 問題
#1
新會員
新會員


查看用戶資訊
我是使用dsPICDWM 1.1 Development Board
當我要從AN0(RB0) 及Gnd輸入sin wave作A/D converter
但用以下程式卻無法執行
可是當使用RB6當輸入(即從內建的AVDD分壓所得到的值)
即可順利的執行A/D converter
不知是哪些地方沒注意到


#define __dsPIC30F6014__

#include <adc12.h>
#include <p30F6014.h>

//---------------------------------------------------------------------
// Configuration bits

_FOSC(CSW_FSCM_OFF & XT_PLL4); //XT with 4xPLL oscillator, Failsafe clock off
_FWDT(WDT_OFF); //Watchdog timer disabled
_FBORPOR(PBOR_OFF & MCLR_EN); //Brown-out reset disabled, MCLR reset enabled
_FGS(CODE_PROT_OFF); //Code protect disabled
//---------------------------------------------------------------------
#define Fcy 7370000
unsigned int i;
int ADCValue[80];


void IO_Init(void)
{
PORTB=0xFFFF;
PORTD=0xFFFF;
TRISB=0xFFFF; //all pins is input
TRISD=0xFFF0; //LED1~LED4 is output
TRISA=0xFFFF; //sw1~sw4 is input
LATD=0x000F; //all LED turn off
}
//---------------------------------------------------------------------------
void ADC_Init(void)
{
ADPCFG=0xFFFE; //RB0 is analong mode, others is digital mode
ADCON1=0x01E4;
ADCON2=0x0400;
ADCON3=0x1D3F; //sample time=125us
//Tad=32Tcy
ADCSSL=0x0001; //AN0 is input scan

ADCON1bits.ADON=1; //turn ADC on
}
//----------------------------------------------------------------
int main(void)
{
IO_Init();
ADC_Init();
for (i=0;i<=80;i++)
{
while(!IFS0bits.ADIF);
IFS0bits.ADIF=0;

ADCValue[i]=ADCBUF0;
}
}

發表於: 2005/2/23 21:24
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... ]

教育訓練中心

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