Browsing this Thread:
2 Anonymous Users
|
Re: 有關30f4011 的 output compare
|
|
中級會員
Joined
: 2005/3/9 12:38 最後登入時間
: 2019/1/24 18:18
Group:
註冊會員
Level : 6 HP : 0 / 128 MP : 17 / 7324 EXP : 12
|
我之前有用過利用PWM1L,1H,2L,2H控制單相INV 再利用OC3控制一個BOOST,當時是沒問題的,應該是你的設定方式有問題才對
請您試試看以下方式
OC2RS = 0; OC2CON = 0x2006; //選擇TIMER2當三角波,PWM模式,Disable OCFA腳位功能
TMR2 = 0; PR2 = 1024; //0~1024記數 T2CON = 0xa000; //啟動TIMER2計時
OVDCON = 0x0100; PWMCON1 = 0x0101; //設定PWM1L為PWM腳 PWMCON2 = 0x0000; FLTACON = 0x0000; Disable FLTA腳位功能 PTPER = 1024; //0~1024記數 SEVTCMP = 0; //特殊事件觸發點為0 PDC1 = 0; PTCON = 0x8000; //這邊選擇比較簡單的直角三角波模式並啟動計數
ADPCFG = 0xfffe; //enable AN0 ADCON2 = 0x0000; ADCSSL = 0x0000; ADCON3 = 0x1f1f; //採樣及轉換時間 ADCHS = 0x0000 ADCON1 = 0x8076; //啟動ADC轉換;
依照這樣的搭配,在啟動相關中斷應該可以執行你要的工作 ps:以上設定並沒有開啟任何中斷,及優先權等級
發表於: 2009/5/27 12:37
|
|
|
有關30f4011 的 output compare
|
|
新會員
Joined
: 2007/9/9 16:13 最後登入時間
: 2009/9/12 12:37
Group:
註冊會員
Level : 2 HP : 0 / 46 MP : 5 / 2321 EXP : 86
|
請問先進:
小弟遇到在設定OC2 使用timer2如下 ConfigIntTimer2( T2_INT_PRIOR_6 & T2_INT_ON ) ; 但是小弟要將ADCBUF0的值可以控制PWM1L以及OC2的輸出 但是設定為T2_INT_ON時OC2有輸出但是PWM1L卻無法輸出 如果設定為T2_INT_OFF時OC2無輸出但是PWM1L卻有輸出 這是有什麼樣的問題呢 謝謝!
發表於: 2009/5/26 22:37
|
|
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.