SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By naz
#81537
Hello all,
i have witten code for blinking the led.In simulation its working fine,but if i load it on lpc2140,all the leds are glowing instead of blinking.Any can give good idea to solve this issue.

by
naz
By waltr
#81542
Any idea at what speed you are blinking the LED. LEDs that glow, dimmer than when fully on, indicate that they are blinking but faster than you can see. Check the time of your delays.
By naz
#81589
This is the code which i have used

#include <LPC21xx.H>
void wait (void)
{
int d;
for (d = 0; d < 1000000; d++);
}

int main (void)
{
unsigned int i;
IODIR1 = 0x00FF0000;

while (1)
{
for (i = 1<<16; i < 1<<23; i <<= 1)
{ IOSET1 = i;
wait ();
IOCLR1 = i;
}
for (i = 1<<23; i > 1<<16; i >>=1 )
{
IOSET1 = i;
wait ();
IOCLR1 = i;
}//for
}//while
}//main
By cfb
#81596
naz wrote:
Code: Select all
  for (d = 0; d < 1000000; d++);         
As well as checking your startup code, as suggested, try switching off any compiler optimisation settings that may be active. An agressive optimiser will deduce that your loop isn't actually doing any real work and will optimise the 'for' statement away to nothing. Hence there will be no delay.
By naz
#81609
my code and example code is same.(means just i copied it in different file name).but my hex file and example hex file is [b]not same why[/b]?.Example hex file is working fine.i'm confused.any one can tell me where i'm doing mistake.
By cfb
#81650
naz wrote:my code and example code is same.(means just i copied it in different file name).but my hex file and example hex file is not same why?.Example hex file is working fine.i'm confused.any one can tell me where i'm doing mistake.
Make sure you are using

a) Identical header files
b) An identical compiler (identical version)
c) Identical compiler options
d) An identical linker (identical version)
e) Identical startup object files
f) Identical library object files
g) Identical linker options
etc.

That were used to produce the original HEX file.

Then, and only then, there is a possibility that your hex file will be similar. Remember that if you choose to program in C you should get used to "expecting the unexpected" if you do not want any surprises.
By TheDirty
#81656
How big is an 'int' type on that compiler? Isn't it still 16 bits or is it upped to 32?

EDIT: Nevermind. Playing with too many processors.
By naz
#81667
hai all,
my task is working.i did a mistake in starup.s. file.any one can tell me the details about starup file.
By cfb
#81668
naz wrote:any one can tell me the details about starup file.
NXP, the designers of the LPC2140 microcontroller, are a good starting point for information. Read their application notes:

* AN10404 Initialisation Code / Hints for the LPC2000 Family

* AN10331 Philips LPC2xxx family phase lock loop

Also read the first five chapters of:

* UM10139 LPC214x User Manual

Copies of all of these can be downloaded from the NXP website:

http://www.standardics.nxp.com/support/ ... ntrollers/