Re: PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
|
||||
---|---|---|---|---|
資深會員
|
這張 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 中斷旗號嗎? 請問圖片上傳後要怎麼在畫面上看到,能否指導一下語法,謝謝。
發表於: 2022/10/6 17:18
|
|||
|
Re: PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
|
||||
---|---|---|---|---|
管理員
|
發表於: 2022/10/6 16:25
|
|||
|
PIC32MM 的 CCP 模組跑 timer 模式時中斷旗號產生的問題請教
|
||||
---|---|---|---|---|
資深會員
|
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
發表於: 2022/10/6 14:41
|
|||
|