• 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: Inverter的脈寬調變(PWM)
#8
新會員
新會員


查看用戶資訊
版主.....
我試過你講的修改後.....
沒有脈寬調變的變化....
請問有其他的修改方法嗎???

發表於: 2007/5/30 15:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#7
新會員
新會員


查看用戶資訊
版主感謝您....
我來去試試看....
若還有問題再請教您囉!!!

發表於: 2007/5/29 17:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#6
版主
版主


查看用戶資訊
把主程式改成:
int main(void)
{
   
int i;
   
Init_MCPWM( );
   while (
1)
   {
        for (
0100i++); // 只是為了產生延遲
        
PDC1 ++;
        
PDC2 ++;
        
PDC3 ++;
   }
}

用示波器量應該就可以看到DUTY產生變化。
您原來的程式,只是設了初始的PDCx值,之後並沒去改它,自然看不到DUTY的變化。


發表於: 2007/5/29 17:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#5
新會員
新會員


查看用戶資訊
程式碼...
// ***********************************************************************
// File : EX15_3_MCPWM.C
// Purpose : 練習如何使用 Microchip C30 提供的 PWM 函式庫
//
// 使用的函式庫:
// pwm
// adc10
//
// ***********************************************************************

#define __dsPIC30F2010__

#include <p30F2010.h>
#include <pwm.h> // 將pwm函式的原型宣告檔案含入


#define FCY 7372800 * 2 // 因為使用頻率為將外部 7.3728 MHz * 8 的模式 , 每一指令週期需 4 個 clock
// 所以 FCY = (7.3728 * 8 / 4 ) MHz = 7372800* 2

_FOSC(CSW_FSCM_OFF & XT_PLL8); //XT with 8xPLL oscillator, Failsafe clock off
_FWDT(WDT_OFF); //Watchdog timer disabled
_FBORPOR(PBOR_OFF & MCLR_EN); //Brown-out reset disabled, MCLR reset enabled
_FGS(CODE_PROT_OFF); //Code protect disabled

void Init_MCPWM(void);


const char My_String1[]="Ex 15 - MCPWM" ; // 宣告字串於 Program Memory (因為 const 宣告)
char My_String2[]="VR1: VR2: " ; // 宣告字串於 Data Memory


int main(void)
{
Init_MCPWM( );
while (1);
}


/******************************************************/
// Subroutine to configure the Motor Control PWM module

void Init_MCPWM(void)
{
/* Holds the PWM interrupt configuration value*/
unsigned int config;
/* Holds the value to be loaded into dutycycle register */
unsigned int period;
/* Holds the value to be loaded into special event compare register */
unsigned int sptime;
/* Holds PWM configuration value */
unsigned int config1;
/* Holds the value be loaded into PWMCON1 register */
unsigned int config2;
/* Holds the value to configure the special event trigger postscale and dutycycle */
unsigned int config3;
/* The value of ‘dutycyclereg’ determines the duty cycle register(PDCx) to be written */
unsigned int dutycyclereg;
unsigned int dutycycle;
unsigned char updatedisable;
/* Configure pwm interrupt enable/disable and set interrupt priorties */
config = (PWM_INT_DIS & PWM_FLTA_DIS_INT & PWM_INT_PR1
& PWM_FLTA_INT_PR0);
ConfigIntMCPWM( config );
/* Configure PWM to generate square wave of 50% duty cycle */
SetMCPWMDeadTimeGeneration(PWM_DTA20 & PWM_DTAPS4 & PWM_DTB40 & PWM_DTBPS4);
dutycyclereg = 1;
dutycycle = 0x1FF;
updatedisable = 0;
// SetDCMCPWM(dutycyclereg,dutycycle,updatedisable);
PDC1=0x1FF;
PDC2=0x1FF;
PDC3=0x1FF;
period = 0x2ff;
sptime = 0x0;
config1 = (PWM_EN & PWM_IDLE_STOP & PWM_OP_SCALE1
& PWM_IPCLK_SCALE1 &
PWM_MOD_FREE);
config2 = (PWM_MOD1_COMP & PWM_MOD2_COMP &
PWM_PDIS3H & PWM_PEN2H & PWM_PEN1H &
PWM_PDIS3L & PWM_PEN2L & PWM_PEN1L);
config3 = (PWM_SEVOPS1 & PWM_OSYNC_PWM & PWM_UEN);
OpenMCPWM(period,sptime,config1,config2,config3);

}



請問還要修改哪邊才能有脈寬調變???
minusone 寫到:
您的程式呢?[/quote]

發表於: 2007/5/29 17:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#4
版主
版主


查看用戶資訊
您的程式呢?

發表於: 2007/5/29 15:15
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#3
新會員
新會員


查看用戶資訊
版主你好....
我是用dspic 30F2010....
想請教一下....
我做出來的PWM信號都是固定輸出...
而沒產生脈寬調變.....
我是想利用脈寬調變送給inverter做切換....
不知道怎麼去修改.....

發表於: 2007/5/29 11:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: Inverter的脈寬調變(PWM)
#2
版主
版主


查看用戶資訊
您用那一顆PIC?有程式碼嗎?
右邊教材及講義中有許多有關於PWM模組的使用可以參考。

發表於: 2007/5/29 11:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Inverter的脈寬調變(PWM)
#1
新會員
新會員


查看用戶資訊
請問版主....
之前有看到同樣的問題...
想請問一下....單純的脈寬調變....
是要怎麼去設計....
你有說參考P13-8
不過還是不太清楚怎麼去設計....
因為我之前用過馬達控制那邊的PWM...
但他無法調變....幾乎都成固定....
是否有什麼方法可以達成脈寬調變???

發表於: 2007/5/26 16:20
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... ]

教育訓練中心

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