Please Help Dspic30F2010

Thread Starter

rmrps

Joined Feb 24, 2012
21
Hi friends i am using dspic30f2010 with 12.288MHz for invertor application for that i am generating 8.9khz pwm frequncy. i am using PWM1L pin for postive half cycle of the sinewave and PWM2L pin for Negative half cycle of the sinewave and it is connected to individual mosfet and PWM1H pin and PWM2H is connected to battery vcc and mosfet in my program if i am increasing PDC1 and PDC2 value the frequency of the pwm pulse get decreasing from 8.9Khz to 50Hz it is finally decreasing to 50hz that is output ac voltage frequency. this is my code it is giving output 12v ac but the problem is pwm frequncy decreasing while increasing PDC1 and PDC2 value in that Delay(11700) function for 10ms delay in #define function i am putting Fpwm 17800 because 8.9khz pwm frequncy. please help me where to change my code to rectify the problem please give me your guidance thanks in advance if PDC1=100 and PDC2=100 the pwm frequency is 8.9Khz it is ok but if PDC1=1000 and PDC2=1000; the pwm frequency is 50hz.

#include<P30F2010.h>
#define Fcy 12288000
#define Fpwm 17800
_FOSC(CSW_FSCM_OFF & XT_PLL8);
_FWDT(WDT_OFF);
FBORPOR(PBOR_ON & MCLR_EN & PWRT_OFF);
_FGS(CODE_PROT_ON);

int main()
{
TRISE=0x00,PORTE=0
PTMR=0x00; PTPER=(Fcy/Fpwm)-1; SEVTCMP=0x8FFF; PWMCON2=0x204,OVDCON=0xF00; FLTACON=0x0;
PDC1=1000,PDC2=1000,PTCON=0x8000;
while(1)
{
PWMCON1=0x121;
Delay(11700);
PWMCON1=0x112;
Delay(11700);
}
return (0);
}
 
Top