int main(void)
{
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
IO1DIR = (1<<19) | (1<<18) | (1<<17) | (1<<16); // Set P1.16, P1.17,
P1.18, P1.19 as Output
while(1)
{
LED1_ON();
Delay(25);
LED1_OFF();
LED2_ON();
Delay(25);
LED2_OFF();
LED3_ON();
Delay(25);
LED3_OFF();
LED4_ON();
Delay(25);
LED4_OFF();
}
return(0);
}
It is the main function of the code. The first and second line will initialize GPIO function on
all PORT0 pins.
IO1DIR = (1<<19) | (1<<18) | (1<<17) | (1<<16);
The above statement will make port1 pins P1.16, P1.17, P1.18, P1.19 as output.
statement will continuously execute the code inside its loop.
while(1)
The first line
LED1_ON();
executed. The third line will turn OFF LED1 and turn ON LED2 and it will remain ON
till delay function is executed. Similarly as the code progresses the LEDs will turn ON &
OFF and it will appear as if LEDs are chasing each other.
The next step is to load the hex file in to the microcontroller using Flash magic utility.
1. Click Start>Programs>Flash Magic>Flash Magic to start Flash Magic utility.
2 . Click Select Device to select LPC2148 microcontroller.
NEX Robotics Pvt. Ltd.
www.nex-robotics.com
// Enable GPIO on all pins
will turn on LED1 and it will remain ON till delay function is
LPC2148 DEVELOPMENT BOARD
30
Need help?
Do you have a question about the LPC2148 Pro and is the answer not in the manual?
Questions and answers