EmbeddedRelated.com
Forums

Problem in LED Blinking program for gcc and olimex board LPC2378

Started by sach January 27, 2008
dear all,
Please help me, I am using gcc compiler with eclipse.
My board is of olimex LPC2378, I am writing a program to blink the
LED.

I am blinking the leds which are connected at P0.26 to P0.24.
So for that I am configuring the registers as following...

IODIR = 0x07000000;

IOCLR = 0x0700 0000; to glow LEDs
IOSET = 0x0700 0000; to making LEDs OFF

But there is no any effect on LEDs.

but if I change the code in following way ...

IODIR = 0x00000700;

IOCLR = 0x00000700;; to glow LEDs
IOSET = 0x00000700; to making LEDs OFF

After that it is working...


so I am not getting the reason ?
I am using header file in which declared these registers as following...
#define IOPIN (*((volatile unsigned long *) 0xE0028000))
#define IOSET (*((volatile unsigned long *) 0xE0028004))
#define IODIR (*((volatile unsigned long *) 0xE0028008))
#define IOCLR (*((volatile unsigned long *) 0xE002800C))
My code is below...
#include <lpc2378.h>
delay()
{
int i,j;
for(i = 1;i<= 500;i++)
for(j = 1; j<= 500;j++)
;
}
int main()
{
IODIR = 0x00000700;

while(1)
{
IOCLR = 0x00000700;
delay(); //delay
IOSET = 0x00000700;
delay(); //delay
}
}



Kind Regards

Sachin Dhiman