Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
新會員
|
版主.....
我試過你講的修改後..... 沒有脈寬調變的變化.... 請問有其他的修改方法嗎???
發表於: 2007/5/30 15:48
|
|||
|
Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
新會員
|
版主感謝您....
我來去試試看.... 若還有問題再請教您囉!!!
發表於: 2007/5/29 17:33
|
|||
|
Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
新會員
|
程式碼...
// *********************************************************************** // 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
|
|||
|
Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
版主
|
您的程式呢?
發表於: 2007/5/29 15:15
|
|||
|
Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
新會員
|
版主你好....
我是用dspic 30F2010.... 想請教一下.... 我做出來的PWM信號都是固定輸出... 而沒產生脈寬調變..... 我是想利用脈寬調變送給inverter做切換.... 不知道怎麼去修改.....
發表於: 2007/5/29 11:24
|
|||
|
Re: Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
版主
|
您用那一顆PIC?有程式碼嗎?
右邊教材及講義中有許多有關於PWM模組的使用可以參考。
發表於: 2007/5/29 11:11
|
|||
|
Inverter的脈寬調變(PWM)
|
||||
---|---|---|---|---|
新會員
|
請問版主....
之前有看到同樣的問題... 想請問一下....單純的脈寬調變.... 是要怎麼去設計.... 你有說參考P13-8 不過還是不太清楚怎麼去設計.... 因為我之前用過馬達控制那邊的PWM... 但他無法調變....幾乎都成固定.... 是否有什麼方法可以達成脈寬調變???
發表於: 2007/5/26 16:20
|
|||
|