Professional Documents
Culture Documents
Simple GPIO Data of LPC 2148
Simple GPIO Data of LPC 2148
Simple GPIO Data of LPC 2148
Year 2020-21
Class TE E&Tc
Semester VI
Unit no III
Real World Interfacing with ARM7
Name of Unit
BasedSepMicrocontroller-1
1, 2021 1
Course Objectives
Sep 1, 2021 2
Course Outcomes
Sep 1, 2021 3
Objectives
LED Interfacing with LPC2148
LCD Interfacing with LPC2148
GLCD
GLCD Interfacing with LPC2148
Sep 1, 2021 4
Registers used for GPIO Programming:
Usually most of the pins of an ARM microcontroller is
multi-functional, every pin can be made to perform one of
the assigned function by setting particular bits of PINSEL
register.
Register Pins
IOxDIR
This register is used to control the direction (input or
output) of a pin, once is it configured as a GPIO pin
(General Purpose Input Output) by using PINSELx
register.
Sep 1, 2021 5
Registers Required to set Input/Output
• IOxDIR
Value Direction
0 Input
1 Output
IOxSET
IOxCLR
IOxCLR is GPIO output clear register. As mentioned above,
this register is used in conjunction with IOxSET. Writing
Sep 1, 2021 6
Input/Output Configuration:
1. E.g.Setting PIN 2 of port 0 i.e. p0.2 as output can be
done in various ways:
Case1: IODIR0=(1<<2);//(binary-direct assign:
other pins set to 0)
Case2:IODIR0|=0x00000004;//or
0x4(hexadecimal –OR and assign: other pins not
effected)
Case3:IODIR0|=(1<<2);//(binary-OR and assign:
others pins not effected
2.E.g.Consider that we want to configure pin 19 of port 0
i.e. p0.19 as output and want to drive it high.
Sol: IODIR0|=(1<<19);//config. P0.19 as output
IOSET0|(1<<19);Make output high for p0.19
Sep 1, 2021 7
Simple program
Sep 1, 2021 10
Thank
you
Sep 1, 2021 11