Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 66

ARM Processor

Blinking LED Using ARM7 LPC2148


Microcontroller
Blinking LED Using ARM7 LPC2148 Microcontroller
If you have ready made boards, then just connect P1.16(pin) with 1k resistance
+5v.
When P1.16 status is High(+5v), then LED will not glow and when P1.16 is at
Low(0v) status then LED will glow.

[P1.16/TRACEPKT0] — General purpose input/output digital pin (GPIO).


Standard I/O port with internal pull-up.

IOPIN: The current state of the GPIO configured port pins can always be read
from this register, regardless of pin direction. THEY are

IO0PIN(PORT0) &
IO1PIN(PORT1)

IODIR: GPIO Port Direction control register. This register individually controls the
direction of each port pin.
IO0DIR(PORT0) &
IO1DIR(PORT1)
 Coding
/*HERE IS THE CODE FOR LED-BLINKING*/

#include <LPC214X.H> // Define LPC2148 Header File


#define led IO1PIN // Define LED to Port1
#define tled IO1DIR // Define Port1 as output

int main()
{
PINSEL2 = 0x00000000; // Define port lines as GPIO
tled = 0x00FF0000; // Define P1.16 – P1.23 as O/P
led = 0x00000000; // Define P1.16 – P1.23 as zero
while(1) // Loop forever
{
led = 0x00FF0000; // Turn ON P1.16 – P1.23
delay(2000);
led = 0x00000000; // Turn OFF P1.16 – P1.23
delay(2000);
}
return 0;
}

void delay (int x)


{
unsigned int k,l;
for(k = x;k > 0;k--)
for(l = 0;l < x;l++);
}
LCD 16x2 interfacing with
LPC2148 (4-bit mode)
LCD Interfacing
Introduction to LCD:
Vss -Ground RS – Register Select
Vcc -5volt E - Enable

D0- D7 – Digital pins R/W- Read/ Write


VEE – Contrast Pin
BL+- Back light +5V BL- -Backlight Gnd

43
LCD Interfacing (Command Words)
LCD Interfacing (Command Words)

Display
On/off
control
LCD Interfacing
ARM Programming for LCD Interface
https://www.electronicwings.com/arm7/lcd-
16x2-interfacing-with-lpc2148-4-bit-mode

You might also like