Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Please Help Dspic30F2010

Status
Not open for further replies.

rmrps

New Member
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.

Code:
#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);      
}
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top