Hi,
I am quite new to LPC MCUs. I am using Keil v5 and have a problem to run the following sourcecode.
#include <LPC11xx.h> /* LPC11xx Peripheral Registers */
#include "system_LPC11xx.h"
#define LED (1<<9) /* LED D1 connect to PIO1_9 */
int main(void)
{
LPC_SYSCON ->SYSAHBCLKCTRL |= (1 << 8); // Enable Clock for TMR1
LPC_IOCON ->PIO1_9 |= (1 << 0); // PIN1_9 = CT16B1_MAT0
LPC_TMR16B1 ->MR0 = 3000; // 50% Duty Cycle
LPC_TMR16B1 ->PR = 12000;
LPC_TMR16B1 ->MR3 = 4000; // Cycle Length
LPC_TMR16B1 ->MCR |= (1 << 10); // TC Reset on MR3 Match
LPC_TMR16B1 ->PWMC |= (1 << 0); // PWM Mode
LPC_TMR16B1 ->TCR |= (1 << 0); // GO
while (1);
// unreachable
return 0;
}
I copied this sourcecode from a working project, which I found in the Internet, into my project. I created my project from scratch.
If I build and upload my project the LED is not blinking.
If I build and upload the project which I found in the Internet, the LED is blinking.
I am afraid that I missed a very important thing in my project to configure.
Could somebody help me please?
Br,
Kai