• 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: PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
#4
管理員
管理員


查看用戶資訊
Hi PSIR

透過MCC產生的程式,從程式中去尋找中斷旗標
MCCP 32位元Timer,可以切割成兩個16位元Timer去使用
判斷得旗標也有所不同,這部分Datasheet 也將兩個旗標給標示反了
如果將32位元Timer拆成2個16位元Timer,使用旗標分別如下:
Timer_L:
縮圖

Timer_H:
縮圖


謝謝

PS.照片需上傳.jpg格式
縮圖

可將上傳完成的照片,按右鍵 > 複製連結網址

Attach file:



jpg  Timer_L.jpg (46.66 KB)
77092_633fb909eeb89.jpg 631X337 px

jpg  Timer_H.jpg (40.83 KB)
77092_633fb9105d4fd.jpg 462X338 px

jpg  擷取.JPG (17.59 KB)
77092_633fba26d9352.jpg 697X40 px

發表於: 2022/10/7 13:28
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
#3
資深會員
資深會員


查看用戶資訊
這張 Figure 30-10 的方塊圖是 32 位元 timer 模式,中斷旗號就是從 CCTxIF 產生:
縮圖


而我用的是 Figure 30-9: 16-Bit Dual Timer Mode,不理解中斷旗號為也是從 CCTxIF 產生,而不是我以為的 CCPxIF 旗號?

不過我有試過令 CCP1CON1bits.T32=1,變更為 32 位元 timer 模式,中斷旗號也是從 CCTxIF 產生沒錯,難道 16 位元 和 32 位元 timer 模式都是共用這個 CCPxIF 中斷旗號嗎?

請問圖片上傳後要怎麼在畫面上看到,能否指導一下語法,謝謝。

Attach file:



jpg  Screenshot_1.jpg (115.91 KB)
2310_633e9aeee5817.jpg 948X583 px

發表於: 2022/10/6 17:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
#2
管理員
管理員


查看用戶資訊
Hi PSIR

參考文件:https://ww1.microchip.com/downloads/en/DeviceDoc/60001381a.pdf

Timer:
縮圖

Output Compare:
縮圖


謝謝

Attach file:



jpg  Timer.jpg (59.67 KB)
77092_633e91129a8fc.jpg 988X373 px

jpg  PWM.jpg (146.29 KB)
77092_633e911a75105.jpg 987X765 px

發表於: 2022/10/6 16:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
#1
資深會員
資深會員


查看用戶資訊
MCU:PIC32MM0016GPL020

我使用 CCP1 模組規劃成雙 16 位元 timer 模式,依照資料手冊 Figure 30-9 的方塊圖所示,本來我以為計時溢位中斷時,應該是上面的低 16 位元的中斷旗號 CCP1IF 產生,但一直沒有進入 CCP1 中斷函數,在 WATCH 視窗中卻看到 CCT1IF 中斷旗號被舉起,又宣告一個 CCT1 中斷函數並致能 CCT1 中斷後,果然進入 CCT1 中斷,中斷時間也正確。

因此我的疑問是,CCP1 模組規劃成 PWM 模式時,是由 CCP1IF 產生中斷,而規劃成 16/32 位元 timer 模式時,則是由 CCT1IF 來產生中斷,是這樣嗎?

附上我的 CCP1 模組設定程式請參考:
//---Config CCP1 as timer mode(規劃成Timer模式)
CCP1CON1bits.TRIGEN=0; //Triggered operation disable
CCP1CON1bits.SYNC=00000; //No external synchronization
//rolls over at FFFFh or match with period register (self sync)
CCP1CON1bits.TMRSYNC=0; //not synchronized to internal system clock
CCP1CON1bits.CLKSEL=000; //Set the clock source:System Clock(TCY)
CCP1CON1bits.TMRPS=0; //Set the clock prescaler(1:1)
CCP1CON1bits.T32=0; //16-bit dual timer mode
CCP1CON1bits.CCSEL=0; //PWM or Timer mode
CCP1CON1bits.MOD=0000; //16-Bit/32-Bit Timer mode:Output functions are disabled
CCP1CON2=0; //B29-24_OCxEN=0(OCAEN disabled)
CCP1CON1bits.ON=1; //開啟CCP1模組,Start timer

Attach file:



jpg  Screenshot_1.jpg (115.91 KB)
2310_633e7895b8d9b.jpg 948X583 px

發表於: 2022/10/6 14:41
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... ]

教育訓練中心

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