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


Browsing this Thread:   1 Anonymous Users






Re: PIC18F4431 PWM Module範例程式疑問
#4
資深會員
資深會員


查看用戶資訊
各位先進,不知我的算法是否對錯...

因為我很想知道,自己有沒有算錯...

謝謝

發表於: 2006/4/24 19:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4431 PWM Module範例程式疑問
#3
資深會員
資深會員


查看用戶資訊
如果要產生20KHZ

外部振盪16MHZ

一各指令週期是

Fosc/4=4MHZ

Tosc=1/4MHZ=0.25us

那要產生週期20KHZ

==>(199+1)*0.25us=50us

PTPER=200/4=50-1=49

不知道是否是這樣計算?

發表於: 2006/4/21 14:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4431 PWM Module範例程式疑問
#2
版主
版主


查看用戶資訊
請看 18F4431 data sheet (DS39616A) page 195 FIGURE 17-11:

PTPER (Period Register) 為 12-bit 的暫存器,分為兩個來存放 Period (PTPERH 存 4MSB,PTPERL 存 8個 LSB 位元)
所以 PTPER 能夠修改到的 Period 為12-bit 的範圍。

PTMR 週期計數器的範圍為 14-bit 的長度,PTMR 只會用較高的 12-bit 跟PTPER的 設定 Period 值 (12-bit) 來比較。 但對 Duty 的比較就會使用全部的 14-bit 與 PDCn Register 來比較。

所以對 Period Register 的設定 (PTPER) 只有12-bit 的解析度,但對 Duty Register 的設定就是使用14-bit ,這也就是最難了解的地方。

PTPER = 99 再成四倍為期值為 400 (考慮2-bit 的 Q-Clock)
這樣Duty Cycle 就對了吧!

發表於: 2005/8/3 10:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC18F4431 PWM Module範例程式疑問
#1
資深會員
資深會員


查看用戶資訊
F4431_PWM_Demo的C語言範例中為什麼PTPER=99,則PWM的Period = 100 us?而PDC0=200則Duty Cycle =50%,PDC1=300,則Duty Cycle =75%

發表於: 2005/8/2 19:10
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... ]

教育訓練中心

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