I am interfacing single led with lpc2148.I got simulation result. But i am not getting it on the board.I have written the following program to interface the led.
#include "LPC21xx.h"
void wait(void ) { int j=0;
for(j=0;j<1000000;j++); /*wait for one second*/
}
int main (void) { IODIR0 = 0x10000000; /* P0.28 defined as Output */ PINSEL1= 0x00000000; while (1) { /* Loop forever */
IOSET0 = 0x10000000; /* Turn on LED */
wait(); /* call wait function */
IOCLR0 = 0x10000000; /* Turn off LED */
wait();
................................................... what modifications i have to do to get output..kindly help me..
You forgot the "for (;;) ;" !
You also forgot to pay attention to the clear instructions for posting source code:
www.danlhenry.com/.../keil_code.png
Andy,
It's like asking them to read the manual of the product they are using; a hopeless, fruitless effort :-) These guys are going to write the software that controls the jet that takes you to your sunny vacation destination. Yes? Yes!
No, he replaced it with a while loop - but since he forgot the formatting of the post, we can't be bothered to look at the code.
Another error - not searching this forum for busy loop delays.
A third error - not giving any information about what actually happens, and what error checking that has been done (such as single-stepping the code) before the thread was created.
Indeed it is!
As I have so often said, if someone can miss something as clear and simple as the code posting instructions here, then it is rather likely that their problems are entirely due to similar lack of attention to the rest of their project.
:-(
Gee, I really missed that "while"! Hence - always use code formatting!!!!
Yes, I normally chose to ignore code instead of switching to stream mode to try to dechiffer code where it can't even be seen where one-line comments actually ends. Code posted without tags isn't just messy but it is a lossy conversion that can't be undone.
Sorry for not following the instructions to post a message. I am new to the embedded c. I am using Keil microvision 4 and flash program to transfer program to chip. simulation result i am getting but on board its not happening. i am using ngx lpc2148 blueboard. The voltage on pins same before and after the programming.
#include "LPC21xx.h" void wait(void ) { int j=0; for(j=0;j<1000000;j++); /*wait for one second*/ } int main (void) { IODIR0 = 0x10000000; /* P0.28 defined as Output */ PINSEL1= 0x00000000; while (1) { /* Loop forever */ IOSET0 = 0x10000000; /* Turn on LED */ wait(); /* call wait function */ IOCLR0 = 0x10000000; /* Turn off LED */ wait(); } }
I am not getting your suggestion.please can you elaborate it.
thank you..
And you did not notice that when you cut/pasted the broken source code from the original post into this new post, the lost line breaks are still lost?
And the only thing you have now said about your debugging attempts is that the voltages on some pins (which I have to guess is the LED pins) are not changing.
You didn't tell if they where high or low. You didn't tell if they are in tristate or if they are weakly or strongly held at their current state. You didn't tell if you have tried to single-step the program. You didn't tell if you have tried to read back the program to verify that you really have any program in the chip. You didn't tell if you have tried to download any other example program.
I want to interface led with lpc2148 by using with port and without port. I measured the voltages of all the pins and come to know that all the pins have same voltage before and after the programming.I have downloaded the program into chip through flash program.Kindly advise me how to interface led by using with port and without port.
and, in the whole internet, you haven't been able to find one example that does this?
No. I am not getting the output on the board but simulation is happenning.
Maybe you delay function is not working on target...? Saying "it does not work" will not help yourself or anybody else. Search for delay functions on this forum.