PWM pin selection from p26 to p21

13 Mar 2012

Hi everyone.

PWM OUTPUT PIN SELECTION PINSEL4

I am trying to output PWM from the microcontroller. Since i needed to change the hardware registers, i am now stuck to the point that i cannot change the output pin of the PWM. Code below tells you how to change the pin. if i put the pinseld4 |= 1; only then it works and the output appears on p26. when i use any other value such as 40(hex) that should change bit 6 hence outputting the pwm to p23, it doesnt work.

also what i am getting on oscilloscope is a very sinusoidal signal of the pwm output. please help

 LPC_PINCON->PINSEL4  |= 40; // pin selection (turning on PWM as output): DIP26 = pin P2.0, set to PWM1.1
                                //e.g table 83: PINSEL4 = 32 bit register! bit 1:0 if set as 01,                                  PWM1.1 will be output on pin 2.0/PWM1.1 = p26 (mbed)