MCB2140

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

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.

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

what about setting all the PLL stuf ???

Take a look at http://www.siwawi.arubi.uni-kl.de/avr_p … index.html, tons of examples with init codes and so on.

Angelo

naz:

  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.

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.

naz:
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.

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.

hai all,

my task is working.i did a mistake in starup.s. file.any one can tell me the details about starup file.

naz:
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/