PWM dutyCyle

Started by Ravi May 4, 2008
 Hi all,I'm working on LPC2148 for PWM generation.below is part of code used for configuration/setting of PWM modulePWMPCR = 0x00001000; //Enable single edge controlled PWM4PWMMCR = 0x00000003; //Reset timer on MR0 match & generate interruptPWMPR = 0x00000004; //prescaler valuePWMMR0 = 0x00000064; //30Khz cycle ratePWMMR4 = 0x00000032; //Dutycycle = 50%PWMTCR = 0x00000002; //Reset timer counter and prescaler counter on next Pclk cyclePWMTCR= 0x00000009;//enable PWM modeI'm getting correct cycle rate(Freq) butwith above code (PWMMR4=0x32) I'm getting 54.3% duty cyle,with PWMMR4=0x19 I'm getting 63% duty cyle which I feel is not correct, it should come 25%.I tried different PWMMR4 values, I'm not getting lenear relation between PWMMR4 value and dutycycle.Where I'm wrong?Please help.thanx in advancewaitingRavi

An Engineer's Guide to the LPC2100 Series