PWM Frequncy Problem

Status
Not open for further replies.

rmrps

New Member
_FOSC(CSW_FSCM_OFF & XT_PLL8);
_FWDT(WDT_OFF);
_FBORPOR(PBOR_ON & MCLR_EN & PWRT_OFF);
_FGS(CODE_PROT_ON);

void Delay(unsigned int del);

int main(void)
{

Delay(50000);
Delay(50000);
Delay(50000);
Delay(50000);
Delay(50000);
TRISE=0x00;
PORTE=0x00;
PTCON=0x8004;
PTMR=100;
PTPER=199;
IPC9bits.PWMIP=1;
IFS2bits.PWMIF=0;
IEC2bits.PWMIE=1;
SEVTCMP=0x00;
PWMCON1=0xFFF;
PWMCON2=0x207;
DTCON1=0x4C4C;
DTCON2=0xFF;

FLTACON=0xFF80;
FLTBCON=0xFF80;
OVDCON=0xFF00;
PDC1=0x0A;
PDC2=6553.6;


while(1)
{
Delay(50000);
Delay(50000);
Delay(50000);
}
return (0);
}

void Delay(unsigned int del)
{
while(--del);
}

Hi friends this is my code for generating pwm pulses it is generating 275hz pulses but i want 20khz pulses there is no changes while changing PTPER value Same frequency only coming how to change frequency of pulses i am using 16Mhz PIC30F6010A controller please give me guidelines where to change the code for generating 20khz pulses thanks in advance
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…