We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I am using Uv4 for LPC2148, my LED blinking program works fine in debug mode but does not runs on the board. I am using Flash magic to flash the program. Pls help.
You mean it runs in the Simulator (ie, purely on your PC), but not on your board?
This must mean that:
1. Your code makes an incorrect assumption about the hardware, or
2. Your hardware is faulty, or
3. Both!
As only you have the hardware, and you have not given any details about it or your software, you are the only one who can debug this!
Debugging tips:
www.8052.com/.../120313
www.eetimes.com/.../Developing-a-good-bedside-manner
Yes, it works fine on my PC, but not on the board.
And you have then done what debugging to figure out if you have a hardware issue, or if any of your assumptions in the code are incorrect for the actual hardware?
We haven't seen the hardware.
We haven't' seen the source code.
Exactly how can we then help?
This is the exact code which works fine without any problem. On the hardware LED's are mounted from pin P1.16 to P1.23.
#include "lpc21xx.h" //#include "header_test.h"
int main() { register int i; PINSEL2 = 0x00000000; IODIR1 = 0x00FF0000; IOSET1 = 0x00010000; //IO1CLR = 0x00010000; for(i=0;i<=6;i++) { IOSET1 = IO1SET << 1; IOCLR1 = IO1CLR << 1; }
}
For the hardware details of board please visit www.oasistechsol.com/voyager_board.aspx
This is the exact code which works fine without any problem
I'm missing an infinite loop here.
Hello Andrew,
Below is my code which gives no error.
int main() { register int i; PINSEL2 = 0x00000000; IODIR1 = 0x00FF0000; IOSET1 = 0x00010000; //IO1CLR = 0x00010000; while(1) { for(i=0;i<=6;i++) { IO1SET = IO1SET << 1; IO1CLR = IO1CLR << 1; } } }
Hardware details can be found at, www.oasistechsol.com/voyager_board.aspx
Also please tell me why you wrote, only i can debug it! Did i made some mistake?
I'm missing an infinite loop here. I'm missing an infinite loop here. I'm missing an infinite loop here. I'm missing an infinite loop here. I'm missing an infinite loop here. I'm missing an infinite loop here.
Ho sorry, you actually have one - I missed it thanks to your wonderful formatted posted code!
Hello Michael,
Please guide me what wrong have i done?
You are assuming that you can shift the registers left indefinitely. And you are assuming that your code really consumes time. And you are totally ignoring the rules for how to post source code - was it too hard to read the instructions directly above the message input box?
I missed it thanks to your wonderful formatted posted code!
... and thanks to the fact that he silently smuggled it into the otherwise identical re-post...
Can i expect some valid answers which will really help?
hey sam san.
you dont get good answers from some people here. i asked question once and they all said Please read the manual and your stupid and ask a proper question. idiots.
you code IO1CLR = IO1CLR << 1; but you cant read IO1CLR. sure dont know about IO1SET.
and when your loop is finished and you start it again IO1SET is not restarted.
why not start this?
while(1) { unsigned long bits; bits = 0x00010000; for(i=0;i<=6;i++) { IO1CLR = 0x00FF0000 IO1SET = bits; bits <<= 1; } }
You couldn't, but you did get some anyway. It's not exactly our fault you failed to recognize them.
I'm not sure if the debug has been done in a software simulator or in the actual board but it is the only case to see the result of this code since there is no delay between the different led states.
Unless you uses steps in a debugger to be able to pause and view each step result you will see nothing because the loop is executed with a very high speed.
Alex