• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::

論壇索引


Board index » All Posts




PIC16F18855的ADC computation中的Average功能一直中斷,請求協助。
高級會員
高級會員


Dear 各位先進,
1. 末學使用PIC16F18855的ADC功能;若用不使用中斷的Basic功能,程式都正常;然使用到computation的Average功能時,我於MCC的設定如附件:
2. 即不使用雙取樣,並採用4次平均,且當 AD輸入 ADUTH,則要中斷CPU;
3. 然,執行結果卻是,不管AD輸入為何,都會中斷CPU(因我在interrupt_manager.c設中斷點)?
4. 請問先進們,我的問題出在何處呢?

Best Regard
陳鴻進

Attach file:


Link only for registered users

發表於: 2020/12/7 12:03
頂部


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


有參考範例程式並修改成如下,但是連中斷都進不了

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
頂部


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


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

發表於: 2020/12/7 9:17
頂部


enable clock switch會卡在迴圈中
中級會員
中級會員


各位先進好
我在MCC中設定系統參數時 使用primary clock
若enable PLL 但沒設定clock switch的話 會顯示warning
但若enable clock switch 執行程式時則會卡在while (oscconbits.oswen = 0)
請問是哪裡沒設定到嗎
感謝

發表於: 2020/12/5 22:44
頂部


請問dsp33ck64mp502的ad使用方式
初級會員
初級會員


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

發表於: 2020/12/5 22:23
頂部


Re: 若要加入4個"觸控"按鍵,請問要買APP046 mTouch實驗板 或 APP-ESS18-2 實驗板 或 APP001 mTouch之 實驗板呢?
高級會員
高級會員


Dear 版主,
感謝版主的回應。
看了您之前E-mail (hjchen@mail.hdut.edu.tw)給我的 "mTouch 中文實驗手冊 v1.0.PDF"檔中,APP046 mTouch實驗板有如下3種CPU可資完成:
1. SCVD : 使用 PIC16F15355-I/SP (8KW Flash, 28-pin)
2. HCVD : 使用 PIC16F1513-I/SP (4KW Flash, 28-pin)
3. ADCC : 使用 PIC16F18855-I/SP (8KW Flash, 28-pin)
其中上述的第1項,又分為如下的Polling與Callback方式
mTouch PIC16F15355 Polling.x
mTouch PIC16F15355 Callback.x
故也麻煩 版主將上述的第1項(SCVD)與第2項(HCVD)的專案程式,也E-mail給我。
感恩,謝謝。
陳 鴻 進

發表於: 2020/12/5 16:39
頂部


Re: 若要加入4個"觸控"按鍵,請問要買APP046 mTouch實驗板 或 APP-ESS18-2 實驗板 或 APP001 mTouch之 實驗板呢?
版主
版主


週一再給祥細資料。用mTouch的實驗板及中文使用手冊及範例。

發表於: 2020/12/5 11:36

Edited by Ryang on 2020年12月05日 15:04:54
頂部


若要加入4個"觸控"按鍵,請問要買APP046 mTouch實驗板 或 APP-ESS18-2 實驗板 或 APP001 mTouch之 實驗板呢?
高級會員
高級會員


Dear 各位先進:
因專案擬用mTouch的功能,故:
1. 請問APP046 mTouch實驗板、 APP-ESS18-2 實驗板 與 APP001 mTouch之差異為何?
2. 因貴網站無價目表,故該mTouch實驗板,含稅是多少錢?
3. 因後學是使用PIC16F18855,故上述第1項出貨時,可要求多買1顆PIC16F15355嗎? 若可,要再加多少錢呢?
4. 另,若要加入4個"觸控"按鍵,需要再參考 APP001 mTouch之文件檔嗎?

Best Regard
陳鴻進

發表於: 2020/12/5 1:53
頂部


Re: MGC3130詢問
資深會員
資深會員


感謝版大

發表於: 2020/12/2 15:36
頂部


Re: MGC3130詢問
版主
版主


我同事有依你所留的 e-mail 發信給你要聯絡資訊,麻煩您連絡他一下。

發表於: 2020/12/2 14:27
頂部



« 1 ... 217 218 219 (220) 221 222 223 ... 7525 »



:::

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... ]

教育訓練中心

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