• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






Re: dspic30f4012的PWM
#4
新會員
新會員


查看用戶資訊
已經解決了

謝謝版主

發表於: 2008/1/27 22:09
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dspic30f4012的PWM
#3
新會員
新會員


查看用戶資訊
謝謝版主
不好意思 上面的問題有搞錯依個地方 就是我是計畫PWM1L,PWM2L,PWM3L為I/O
PWM1H,PWM2H,PWM3H為PWM的訊號輸出

以下是我PWM部份的程式
void MotPWM_Initial(void)
{
PTCON = 0xa000 ; // PWM Time Base Prescale = 1:1
// PWM Time Base OP in free running Mode
PTPER = 19999; // PWM Time Base Period Register 1msec = 1kHz
PWMCON1 = 0xf7f0 ;
PWMCON2 = 0x0000 ; // PWM 更新使能,
DTCON1 = 0x0000 ; // No dead zone
FLTACON = 0x0000 ;
OVDCON = 0xff00; // H-pin are avariable
}

經過main程式後會得到一個值傳到set_PWM (float a) 裡的a

void set_PWM (float a) // [V]
{
float temp;
unsigned int value,qq;
if (a < 0)
{
LATEbits.LATE2= 1; // PWM3L
a = a * -1;
}
else
LATEbits.LATE2= 0; // PWM3L
temp = a * 0.08333; // voltage transfer to duty cycle[%]
PDC3 = 2.0 * temp * (PTPER + 1); // PDC3
}

int main( void )
{
TRISEbits.TRISE8 = 0; // output
TRISEbits.TRISE4 = 0; //PWM3L I/O output
TRISEbits.TRISE2 = 0; //PWM2L I/O output
TRISEbits.TRISE0 = 0; //PWM1L I/O output
LATEbits.LATE0 = 0;
LATEbits.LATE2 = 0;
LATEbits.LATE4 = 0;
LATEbits.LATE8 = 0;
.
.
.
while(1);
return 0;
}

目前PWM1L和PWM2L皆有訊號改變但是唯有PWM3L看不到訊號出來

是那裡錯了呢?還是有少設定什麼?
(還是需要給全部的程式才知道錯在那嗎?)

發表於: 2008/1/8 0:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dspic30f4012的PWM
#2
版主
版主


查看用戶資訊
1. 自由運行模式 : 有兩種 Free-Running 模式,要設定 PTCON 暫存器 <PTMOD<1:0>。<0.0> 為起始邊緣靠齊的 Free-Running Mode ,<1.0> and <1.1> 為中間靠齊的模式。

2. 三個 PWM輸出(PWM1L,PWM2L,PWM3L) : 分別由三個 Duty Control Register (PDC1, PDC2, PDC3) 來設定的。週期則是由 PTPER Regiter 所設定的。PWM 的計數暫存器 PTMR。 重要的一點是 PDCx 的值定要小於 PTPER 值,由於 PTPER 與 PDCx 的位元並不是對偁的,所以要注意比較的位元為何? PDCx<15:1> 需小於 PTPER<14:0> 其 PWM Duty 最高解析度為16-bit。

3. 有關 MCPWM 的使用要參考 PIC30F Family Reference manual 的第十五章 Motor Control PWM 的說明,上美國網站查詢一下。台灣網頁在右邊的檔案下載裡也有講義及練習可以下載 : dsPIC30F Peripheral Module - Motro Control PWM 講義與教材。
http://www.microchip.com.tw/modules/mydownloads/viewcat.php?cid=4

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


dspic30f4012的PWM
#1
新會員
新會員


查看用戶資訊
請問一下dspic30f4012的PWM功能在 自由運行模式時 要怎樣同時 使用3個PWM(PWM1L,PWM2L,PWM3L)的輸出呢?該設定哪些暫存器呢?或是該使用哪些模式呢?

發表於: 2008/1/6 22:54
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... ]

教育訓練中心

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