• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問dsp33ck64mp502這個ad的使用設定
#4
初級會員
初級會員


查看用戶資訊
修正觸發源就可以了,已經處理好了謝謝

發表於: 2020/12/7 16:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問dsp33ck64mp502這個ad的使用設定
#3
管理員
管理員


查看用戶資訊
在Datasheet ADC章節P.299內部提到ADC的Trigger 方式有很多種
• Multiple Conversion Trigger Options for each Core, including:
- PWM triggers from CPU cores
- MCCP/SCCP modules triggers
- CLC modules triggers
- External pin trigger event (ADTRG31)
- Software trigger

上述的程式是使用,Timer當觸發源進行觸發,ADC相對不會動作。

發表於: 2020/12/7 14:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問dsp33ck64mp502這個ad的使用設定
#2
初級會員
初級會員


查看用戶資訊
有參考範例程式並修改成如下,但是連中斷都進不了

int main(void)
{
// ADC INITIALIZATION
// Configure the I/O pins to be used as analog inputs.
TRISAbits.TRISA0 1;
ANSELAbits.ANSELA0 1;
TRISBbits.TRISB2 1;
ANSELBbits.ANSELB2 1;
// Configure the common ADC clock.
ADCON3Hbits.CLKSEL 2// clock from FRC oscillator
ADCON3Hbits.CLKDIV 0// no clock divider (1:1)
// Configure the cores’ ADC clock.
ADCORE0Hbits.ADCS 0// clock divider (1:2)
ADCORE1Hbits.ADCS 0// clock divider (1:2)
// Configure the ADC reference sources.
ADCON3Lbits.REFSEL 0// AVdd as voltage reference
// Configure the integer of fractional output format.
ADCON1Hbits.FORM 0// integer format
// Select single-ended input configuration and unsigned output format.
ADMOD0Lbits.SIGN0 0// AN0/RA0
ADMOD0Lbits.DIFF0 0// AN0/RA0
ADMOD0Lbits.SIGN1 0// AN1/RA1
ADMOD0Lbits.DIFF1 0// AN1/RA1
// Enable and calibrate the module.
EnableAndCalibrate(); // See Example 5-1
// Configure and enable ADC interrupts.
ADIELbits.IE0 1// enable interrupt for AN0
ADIELbits.IE1 1// enable interrupt for AN1
_ADCAN0IF 0// clear interrupt flag for AN0
_ADCAN0IE 1// enable interrupt for AN0
_ADCAN1IF 0// clear interrupt flag for AN1
_ADCAN1IE 1// enable interrupt for AN1
// Set same trigger source for all inputs to sample signals simultaneously.
ADTRIG0Lbits.TRGSRC0 13// timer 2 for AN0
ADTRIG0Lbits.TRGSRC1 13// timer 2 for AN1
// TIMER 2 INITIALIZATION (TIMER IS USED AS A TRIGGER SOURCE FOR ALL CHANNELS).
T1CONbits.TCS 0// clock from peripheral clock
T1CONbits.TCKPS 0// 1:1 prescale
PR1 0x8000// rollover every 0x8000 clocks
T1CONbits.TON 1// start timer to generate ADC triggers
while(1);
return 
1;
}

// ADC AN0 ISR
void __attribute__((interruptno_auto_psv)) _ADCAN0Interrupt(void)
{
dataAN0 ADCBUF0// read conversion result
_ADCAN0IF 0// clear interrupt flag
}
// ADC AN1 ISR
void __attribute__((interruptno_auto_psv)) _ADCAN1Interrupt(void)
{
dataAN1 ADCBUF1// read conversion result
_ADCAN1IF 0// clear interrupt flag
}

void EnableAndCalibrate()
{
// Set initialization time to maximum
ADCON5Hbits.WARMTIME 15;
// Turn on ADC module
ADCON1Lbits.ADON 1;
// Turn on analog power for dedicated core 0
ADCON5Lbits.C0PWR 1;
// Wait when the core 0 is ready for operation
while(ADCON5Lbits.C0RDY == 0);
// Turn on digital power to enable triggers to the core 0
ADCON3Hbits.C0EN 1;
// Turn on analog power for dedicated core 1
ADCON5Lbits.C1PWR 1;
// Wait when the core 1 is ready for operation
while(ADCON5Lbits.C1RDY == 0);
// Turn on digital power to enable triggers to the core 1
ADCON3Hbits.C1EN 1;
// Turn on analog power for shared core
ADCON5Lbits.SHRPWR 1;
// Wait when the shared core is ready for operation
while(ADCON5Lbits.SHRRDY == 0);
// Turn on digital power to enable triggers to the shared core
ADCON3Hbits.SHREN 1;
}


請問是哪個環節有問題,謝謝

發表於: 2020/12/7 11:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問dsp33ck64mp502這個ad的使用設定
#1
初級會員
初級會員


查看用戶資訊
之前使用33ep64mc50x系列的cpu在ad的使用cho去輪讀ad數值,但最近換了33ck64mp502去輪讀ad數值,ad的暫存器都一直開啟不好讀不到數值,請問個位大神請有相關的設定暫存器設定或是範例可以看一下嗎?

發表於: 2020/12/7 9:17
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... ]

教育訓練中心

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