22. You can observe the build process in the output window. If any errors, rectify it by
double clicking on it and you will be pointed to the erroneous line.
2.3.2 CODE WALKTHROUGH
#include <lpc214x.h>
The first line of code includes the header file for LPC2148 microcontroller. These file
contains the definitions of special function registers related to this device. This file can
be found in Keil uVision 4 install directory.
#define LED1_ON() IO1SET=(1<<16)
#define LED2_ON() IO1SET=(1<<17)
#define LED3_ON() IO1SET=(1<<18)
#define LED4_ON() IO1SET=(1<<19)
The above 4 lines define the macro functions for turning ON LEDs.
For e.g. when
LED1_ON(); is called,
This will set 16 th bit on PORT1
#define LED1_OFF() IO1CLR=(1<<16)
#define LED2_OFF() IO1CLR=(1<<17)
#define LED3_OFF() IO1CLR=(1<<18)
#define LED4_OFF() IO1CLR=(1<<19)
The above 4 macro functions are used to turn OFF respective LED. Please refer
LPC2148 user manual for more information on GPIO.
void Delay(unsigned char j)
{
unsigned int i;
for(;j>0;j--)
{
for(i=0; i<60000; i++);
}
}
The
Delay(unsigned char j)
ON and OFF events.
NEX Robotics Pvt. Ltd.
www.nex-robotics.com
it will execute
function is used to provide some finite delay between Led
LPC2148 DEVELOPMENT BOARD
IO1SET=(1<<16).
29
Need help?
Do you have a question about the LPC2148 Pro and is the answer not in the manual?
Questions and answers