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


Browsing this Thread:   1 Anonymous Users






Re: 請教關於dsPIC33FJ16GS502的PWM輸出
#3
初級會員
初級會員


查看用戶資訊
看了您提供的資料,裡面提到用PLLPRE來選擇N1,用PLLPOST來選擇N2,請問那範例中的N1、N2是不是相反了
PLLFBD=41; /* M = PLLFBD + 2 */
CLKDIVbits.PLLPOST=0; /* N1 = 2 */
CLKDIVbits.PLLPRE=0; /* N2 = 2 */

發表於: 2009/5/14 14:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教關於dsPIC33FJ16GS502的PWM輸出
#2
版主
版主


查看用戶資訊
是設定 dsPIC33F 的震盪工作頻率 Fosc ; 詳細的說明要參考底下有關 OSC 詳細的使用說明:
http://ww1.microchip.com/downloads/en/DeviceDoc/70307B.pdf

章節裡的 42.7 PHASE-LOCKED LOOP (PLL) 有震盪器頻率示意圖及其計算公式,你沒有這一頻率的設定當然程式不會動。
基本上你一定要遵照附件的頻率要求,並按照此公式 Fosc= Fin*M/(N1*N2), 才能正確的算出你所要的 Fosc,Fosc 必須<=80MHz.

Attach file:



jpg  (0.00 KB)


發表於: 2009/5/14 12:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請教關於dsPIC33FJ16GS502的PWM輸出
#1
初級會員
初級會員


查看用戶資訊
請問很多範例程式中都有以下的程式碼
/* Configure Oscillator to operate the device at 40Mhz
Fosc= Fin*M/(N1*N2), Fcy=Fosc/2
Fosc= 7.37*(43)/(2*2)=80Mhz for Fosc, Fcy = 40Mhz */

/* Configure PLL prescaler, PLL postscaler, PLL divisor */
PLLFBD=41; /* M = PLLFBD + 2 */
CLKDIVbits.PLLPOST=0; /* N1 = 2 */
CLKDIVbits.PLLPRE=0; /* N2 = 2 */

__builtin_write_OSCCONH(0x01); /* New Oscillator FRC w/ PLL */
__builtin_write_OSCCONL(0x01); /* Enable Switch */

while(OSCCONbits.COSC != 0b001); /* Wait for new Oscillator to become FRC w/ PLL */
while(OSCCONbits.LOCK != 1); /* Wait for Pll to Lock */

/* Now setup the ADC and PWM clock for 120MHz
((FRC * 16) / APSTSCLR ) = (7.37 * 16) / 1 = ~ 120MHz*/

ACLKCONbits.FRCSEL = 1; /* FRC provides input for Auxiliary PLL (x16) */
ACLKCONbits.SELACLK = 1; /* Auxiliary Oscillator provides clock source for PWM & ADC */
ACLKCONbits.APSTSCLR = 7; /* Divide Auxiliary clock by 1 */
ACLKCONbits.ENAPLL = 1; /* Enable Auxiliary PLL */

while(ACLKCONbits.APLLCK != 1); /* Wait for Auxiliary PLL to Lock */
請問設定這些的用意如何?
因為之前自己寫的程式沒加上這些就無法執行

發表於: 2009/5/14 11:11
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... ]

教育訓練中心

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