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


Browsing this Thread:   1 Anonymous Users




« 1 (2)


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


查看用戶資訊
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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


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


查看用戶資訊
各位先進好

我使用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
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... ]

教育訓練中心

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