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
已解决! 转到解答。
Hi Kai,
Which demo package do you work with? Did you test LPCOpen from this site?
Please make sure you build chip lib and board lib before the blinky demo.
Have a nice day,
Jun Zhang
Hi Kai,
Which demo package do you work with? Did you test LPCOpen from this site?
Please make sure you build chip lib and board lib before the blinky demo.
Have a nice day,
Jun Zhang
Hi Jun,
thanks for your reply.
I will dig into the demo packages but the problem is that I setup up the chip on a bread board. So I do not have a LPCXpresso board with that chip.
I was not aware to build CHIp and board Library. Is the a documentation available to do that?
Regards,
Kai
Hi Kawi
There is LPCOpen document on the LPCOpen download site. You can check by yourself if the related information is included.
Anyway, build chip and board file is necessary because the application project need it during build.
Have a nice day,
Jun Zhang