Hello,
I am working on LPC2129 using Keil uVision V4.21. I am not able to run a simple GPIO toggling code for my board (a custom board). I have got one .HEX file along with the board which is for toggling of the GPIO pins and it runs perfectly.I do not have the C code for the same.
My code works fine on the Keil simulator but not on the actual hardware :( . Please let me know where is the mistake or where I need to look for some code change. The code is as follows and Frquency setting is 12MHz.
#include <LPC21xx.H> void Delay(void) { int i,j; for(i=0; i<10; i++) for(j=0;j<1000;j++); } int main(void) { PINSEL1 |= 0x00000000; IO0DIR |= 0x00000080; while(1) { IO0SET = 0x00000080; Delay(); IO0CLR = 0x00000080; Delay(); } return 0; } *Compilation ends with expected warning of unreachable statement (return 0), hope it has nothing to do with the problem above and it should not be :)
Also one more thing, I could not find fast GPIO and Mask registers in the LPC21xx.h file, well that I can define in the header file with the reference of addresses provided in the user manual.
Regards, Kaustubh
Hello Per Westermark, Andy Neil,
Unfortunately it is not good way to implement the delay but it works fine :). Anyways I have tried a simple LED glow program using GPIO also. It has no delay, no blinking. Still there is no output voltage on the pin, led wont glow.
Hello Guys,
It is working fine. It was because of not checking the linker option in target settings. It should have been set to "Use Memory layout from the target dialog".
It is my silly mistake :(.
Sorry for the trouble caused. Hope this thread will help others.
Thank you.