AnsweredAssumed Answered

Can someone show me how to get PWM output on LPC1115F/303 PIO2_5

Question asked by Steve Cole on Dec 16, 2016
Latest reply on Dec 16, 2016 by soledad

My first try at PWM with an NXP chip  but I am having trouble getting output on the pins as shown below.

Can somebody show me what I am doing wrong. The code is messy with different number formats, I have spent hours fiddling with it.

LPC1115F/303

 

 

#ifdef __USE_CMSIS
#include "LPC11xx.h"
#endif

//#include <cr_section_macros.h>


int main(void)
{
/*32B0MAT0*/
// LPC_IOCON->PIO1_6 |= 1<<1;    //This works
LPC_IOCON->PIO2_5 |= 1<<0;       //This doesn't work. No output on pin

 

 

/*32B0MAT1*/
// LPC_IOCON->PIO1_7 |= 1<<1;    //This works
LPC_IOCON->PIO2_6 |= 1<<1;       //This doesn't work

 

 

 

LPC_SYSCON->SYSAHBCLKCTRL |= 1<<9;
LPC_TMR32B0->PR = 0x0;
LPC_TMR32B0->MCR = 1<<10;
LPC_TMR32B0->EMR |= (1<<5 | 1<<7);
LPC_TMR32B0->CCR = 0x0;
LPC_TMR32B0->PWMC = 0x03;
LPC_TMR32B0->MR3 = 8191;
LPC_TMR32B0->MR0 = 4095;
LPC_TMR32B0->MR1 = 6000;
LPC_TMR32B0->TCR |= 0x03;
LPC_TMR32B0->TCR &= ~(0x02);

 

while(1)
{

}
return 0 ;

Outcomes