Hi dears ,
I want to write a program to blink an LED each 1 second. I've wrote below code but after loading into the MCU, it does not work at all. Would you let me know how can I do it, please ? < #include "LPC13xx.h" #define PRESCALE 60000 ;
void delayMS(unsigned int milliseconds); void initTimer0();
int main() {
LPC_SYSCON->SYSAHBCLKCTRL = (1<<7); initTimer0(); LPC_GPIO0->DIR |= (1<<3) |(1<<4); LPC_GPIO0->DATA = 0x0;
while(1) { LPC_GPIO0->DATA |= (1<<3);
LPC_GPIO0->DATA |= (1<<3); delayMS(500); LPC_GPIO0->DATA &= ~(1<<3); delayMS(500); LPC_TMR16B0->TCR = 0x0; //disable counter } }
void initTimer0() { //LPC_TMR16B0->CTCR = 0x0; LPC_TMR16B0->PR = PRESCALE-1; LPC_TMR16B0->TCR = 0x02;//reset timer
}
void delayMS(unsigned int milliseconds) { LPC_TMR16B0->TCR = 0x02;//reset timer LPC_TMR16B0->TCR = 0x01;//set timer while(LPC_TMR16B0->TC < milliseconds); LPC_TMR16B0->TCR = 0; //disable counter
}>
The documentation for the processor has a clear description of how to configure the PLL, and the PCLK. It's way better if you ask specific questions based on specific problems you have to understand that text.
Next thing - you have not made any reference to what doesn't work for you. What you think should happen. What actually happens. What you have tried to do to figure out the difference between expectation and reality.
Another thing:
#define PRESCALE 60000 ;
What do you think that ';' will do to your code, when the compiler performs a text replacement of the PRESCALE symbol?
Hey coder people.
i need code for something like raspberry pi camera connected to a 8X51 cpu processor.
can u give a link.
not urgent but i need it very soon ;--)
I want to ask my question again , I would like to write a code to blink an LED every 1 second. Could anybody help me for LPC1343, please ?
Thank you.