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

論壇索引


Board index » All Posts (sean0414)




Re: dsPIC33EP64GS502 ADC抓取疑問
#21
中級會員
中級會員


trigger source我是選擇timer1
因為我試過選擇none 和 osc1 則連一筆都抓不到
請問是要選擇哪一個trigge source才能讓ADC會自己重複轉換

發表於: 2020/12/17 16:51
頂部


Re: dsPIC33EP64GS502 ADC抓取疑問
#22
中級會員
中級會員


Ryan好
我有在getadc之前讓某個io輸出high
Gateadc之後讓io輸出low
看起來每抓一次adc大約會花5us
抓100次大概也會花500us

另外程式跑一陣子按暫停後去看adbuf1的值
和x[i]內的值是一樣的
感覺像是只有轉換ㄧ次Ad值
就沒有再繼續轉換
所以adbuf1也沒有繼續更新

發表於: 2020/12/17 14:29
頂部


Re: dsPIC33EP64GS502 ADC抓取疑問
#23
中級會員
中級會員


ADC1_Initialize的內容如下

ADCON1L=(0x8000&0x7FFF);
ADCON1H=0x60;
ADCON2L=0x00;
ADCON2H=0x16;
ADCON3L=0x00;
ADCON3H=(0x02&0xFF00)
ADCON4L=0x00;
ADCON4H=0x00;
ADMOD0L=0x00;
ADMOD1L=0x00;
ADIEL=0x02;
ADIEH=0x00;
ADCMP0ENL=0x00;
ADCMP1ENL=0x00;
ADCMP0ENH=0x00;
ADCMP1ENH=0x00;
ADCMP0LO=0x00;
ADCMP1LO=0x00;
ADCMP0HI=0x00;
ADCMP1HI=0x00;
ADFL0CON=0x400;
ADFL1CON=0x400;
ADCMP0CON=0x00;
ADCMP1CON=0x00;
ADLVLTRGH=0x00;
ADCORE0L=0x00;
ADCORE1L=0x00;
ADCORE2L=0x00;
ADCORE3L=0x00;
ADCORE0H=0x300;
ADCORE1H=0x300;
ADCORE2H=0x300;
ADCORE3H=0x300;
ADEIEL=0x00;
ADEIEH=0x00;
ADCON5H=(0x1500&F0FF)
IFS6bits.ADCANIF=0;
IEC6bits.ADCAN1IE=1
ADCON5Hbits.WARMTIME=0xF;
ADCON1Lbits.ADON=0x1;
ADC1_Core1PowerEnable();
ADC1_CoreCalibration();
ADTRIG0L=0xC00;
ADTRIG0H=0x00;
ADTRIG1L=0x00;
ADTRIG1H=0x00;
ADTRIG4H=0x00;
ADTRIG5L=0x00;

發表於: 2020/12/16 19:44
頂部


dsPIC33EP64GS502 ADC抓取疑問
#24
中級會員
中級會員


各位先進好

我使用dspic33ep64GS502搭配XIDE 與MCC 來讀取ADC
先將DC訊號輸入至AN1腳位
調整電壓 確認ADC數值會跟著電壓高低變化
再將10khz 1Vpp的sin波輸入至AN1腳位
觀察x[100]內數值卻都是同一個值
感覺ADC 只抓了一次就不會再繼續抓
請問是我程式哪裡沒設定好嗎 感謝

MCC的選擇如下
Enable ADC , conversion clock source=FOSC/2 (3.8us) ,
shared core sampleing time=3us
core1 enable, AN1 ,custom name=channel_AN1,
trigger source = TMR1 , Compare=none, Interrupt enable,
THX




#include "mcc_generated_files/system.h"
#include "mcc_generated_files/mcc.h"
#include "mcc_generated_files/adc1.h"
#include "mcc_generated_files/pin_manager.h"
#include "mcc_generated_files/interrupt_mamager.h"
#include "xc.h"
#include "p33EP64GS502.h"
#include "libpic30.h"

int X[100];
int i=0;

int main(void)
{
SYSTEM_Initialize();
ADC1_core1ChannelSelect(channel_AN1);

while(1)

{
// while(!ADC1_IsCore1ConversionComplete())
// {
// }
// 若此迴圈沒有mark掉 會卡在這

if (i<99)
{
x[i]=ADC1_Core1ConversionResultGet();
i=i+1;
}
}

return 1;

}

發表於: 2020/12/16 19:28
頂部


Re: enable clock switch會卡在迴圈中
#25
中級會員
中級會員


Ryang大好

我是用dspic33EP64GS502
是用ICD3 搭配硬體跑debug mode
振盪器是8MHz 所以想用PLL提高到40MHz
若沒開PLL 觀察IO腳的output訊號是正常的(代表程式正常作動)
若開PLL 和clock switch 觀察output沒輸出訊號
停止時顯示卡在while (oscconbits.oswen = 0) 迴圈中

發表於: 2020/12/8 13:39
頂部


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


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

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


Re: 程式執行一段時間會當掉
中級會員
中級會員



發表於: 2016/8/1 13:43
頂部



« 1 2 (3) 4 5 »



:::

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

教育訓練中心

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