Introduction to ARM LPC2148

2,170 views 19 slides Apr 29, 2020
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

ARM Training


Slide Content

ARM LPC2148 Training

Class - 1

Topic : Introduction to Pin’s,
PORTS and Configuring ARM

4/23/2020 Electrical Product Development
Lab

eu
Topics

PIN configuration

PORTS

Configuring PIN's

Simple LED blinking program

4/23/2020 Electrical Product Development
Lab

PIN Configuration

po.2siao.aiaour if)

ES LPC2148

Fig : 1 PIN Diagram of LPC2148

4/23/2020 Electrical Product Development
Lab

PIN Configuration (Cont

LPC2148

Po. t0 Pos, Po.161o Poss Py to Pı 15, Pi t6t0P 1.31

Fig : 2 Distribution of PORT’s and PIN’s

4/23/2020 Electrical Product Development
Lab

PORTx

PORT O:
e PO.0 to PO.15 — Lower 16 bit Pins
e PO.17 to PO.31 > Higher 16 bit Pins
PORT 1:
e P1.0to P1.15 — Lower 16 bit Pins
e P1.17 to P1.31 — Higher 16 bit Pins

PORT 0 - Lower 16 bit and higher 16 bit
are used as GPIO pins

PORT 1 - Only higher 16 bit pins are used
as GPIO pins.

4/23/2020 Electrical Product Development
Lab

2

PORTx (Cont..) %

« Pins of P1.0 to P1.15 of lower 16 bit pins
are not available for the user.

+ Also P0.24, P0.26 and P0.27 are not
available for user.

« Out of 64 pins only user can use 45 Pins
of LPC2148.

4/23/2020 Electrical Product Development
Lab

Configuring PIN’s

To use the 45 pins we must configure the pins by
configuring the following registers.

IOxPIN/IOPINx IO pin Status register
IODIRx Direction register
IOSETx State set register
IOCLRx PIN Clear register

All the registers are 32 bit registers each bit
controls the each pin of LPC2148.

4/23/2020 Electrical Product Development
Lab

Configuring PIN’s

IOPINx - IO Pin Status register

A Px.31 Px.27 px.23 Px.19 Px,15 Px,11 Px.7 Px.3, Px.0
0000 0000 0000 0000 0000 0000 0000 0000

This can be written in the Hexa Decimal format
0x00000000
Ox stands for hexa decimal deceleration
e Reading the values of pins can be done by
IOPINx
Ex: IOPINO = 0x0000000F

4/23/2020 Electrical Product Development
Lab

Configuring PIN’s (Cont...)

IODIRx - Direction register
Assigning 0 > will make pin as INPUT
Assigning 1 — will make pin as OUTPUT
By default the pin value will be set as ‘0’

If we want to change the pin PO.O to PO.3
as OUTPUT pins then declaration will be

Ex:0x0000000F

4/23/2020 Electrical Product Development
Lab

o;
Configuring PIN's (Cont...) a

IOSETx - State set register
Ex:0x0000000F/Px.0 to Px.3 as High

IOCLRx - PIN Clear register
Ex:0x0000000F// Px.0 to Px.3 satus will be
cleared

4/23/2020 Electrical Product Development
Lab

Configuring PIN’s (Cont...)

Table : 1 Selector Input and PIN State

= oo) MXN

Ist Alternate Function y-0to31 GPIO

2nd Alternate Function Px.y
st
Reserve 1

and
Si SO
Fig : 3 General Block Diagram of single
S1 and SO values are configured by associated register of PSB

4/23/2020 Electrical Product Development
Lab

a

Configuring PIN’s (Cont...)

PSB - Pin Select Block has the following
registers

PINSELO -Controls the pins from PO.O to PO.15
PINSEL1 -Controls the pins from P0.16 to PO.31
PINSEL2 —Controls the pins from P1.16 to P1.31

Each of the registers are 32 bit wide then how it
controls the 16 bit pins

4/23/2020 Electrical Product Development
Lab

se
Cii0

Configuring PIN’s (Cont...)

e Lets take the example of PINSELO 32 bit register
which controls the pins from PO.0 to PO.15.
si - SO S1 - SO

00! |00! 100! (00) |00! 100! 100! 100! |00! |00! 100! 100/ | 00
t | 1 y 1 y | yo, y | 1 y

PO.11 | P0.10 | PO.9 | PO.8 | PO.7 | P0.6 | POS | P0.4 | P0.3 | PO.2 | PO.1

Fig : 4 Distribution of 32 bit registers to PINs of PORT O

e Similarly the registers of PINSEL1 and PINSEL2
will be distributed to the remaining pins of
corresponding PORTs

4/23/2020 Electrical Product Development
Lab

Configuring PIN’s (Cont...)

PINSELO | Pin Name | Function when 00 | Function when 01 | Function when 10 | Funetion when 11

10 P00 GPIO Port 00 | TXD(UARTO) PWMI Reserved
32 POL GPIO Por 01 | RXD(UARTO) PWM3 EINTO
54 P02 GPIO Port 0.2 SCLO (FCO) | Capture 0.0 (Timer 0)] Reserved
76 P03 GPIO Port 0.3 SDAO (CO) | Match 0.0 (Timer 0) EINTI
98 PO4 GPIO Port 0.4 SCKO(SPIO) | Capture 0.1 (Timer 0) ADOG
11:10 POS GPIO Port0.5 | MISOO(SPIO) | Match 0.1 (Timer 0) ADO7
13:12 P0.6 GPIO Port 0.6 | MOSIO(SPIO) | Capture 0.2 (Timer 0) ADLO
15:14 P07 GPIO Por 07 | SSELO(SPIO) PWM2 EINT2
17:16 POS GPIO Port 0.8 TXD (UARTI) PWM4 ADI.
19:18 P0.9 GPIO Port 0.9 | RXD (UARTI) PWMS EINT3
2120 | Polo | GPIOPot010 | RIS(UARTI) | Capture 1.0 (Timer 1) ADI2
2322 | Pol | GPIOPoro11 | CIS(UARTI) | Capture 1.1 Timer | SCL1 (FCI)
2524 | Po12 | GPIOPon0.12 | DSR(UARTI) | Match 1.0 (Timer 1) AD13
2726 | 20.13 | GPIOPot013 | DIRÇUARTI) | Match 1.1 (Timer 1) ADI4
2928 | P014 | GPIOPon0.14 | DCD (ARTI) EINTI SDAI (PCD)
3130 | pois | GPIOPor015 | RI(UARTI ADIS

4/23/2020 Electrical Product Development
Lab

a

Configuring PIN’s (Cont...)

e Example for configuring PO.O pin as a Tx Pin for
USART communication
GPIO
TxDo
PWM
Reserve

S1 so
: 5 Features of PO.0 pin
. PINSELO =0x 00000001
PO.0 become as TxDO by setting LSB values of PO.3
to PO.0 as 0001

4/23/2020 Electrical Product Development
Lab

15

Simple LED Blinking Prograr

+ Blink the LED connected in PORT1

# include <Ipc21xx.h> // Include header file
void delay(void);

int main(void)

{

}

4/23/2020

PINSEL2 = 0x00000000; // Configure P1.16 as GPIO pin
IODIR1 = 0x00000000; // Configure P1.16 as OUTPT pin
while(1) £
IOSET1 = 0x00010000; // Turn ON LED at P1.16
delay(); // Wait for a while
IOCLR1 = 0x00010000; // Turn OFF LED at P1.16
delay(); // Wait for a while

Electrical Product Development
Lab

Simple LED Blinking Prograr &

void delay(void){
unsigned int j; // assign the variable j
for(j=0;j<1000000;j++) // Increment j till
} 1000000

4/23/2020 Electrical Product Development
Lab

Assignment

e Draw the circuit for the above program

e Write the program for blinking the LED from
PO.16 to PO.23.

4/23/2020 Electrical Product Development
Lab

Thank You

ak you )

4/23/2020 Electrical Product Development
Lab
Tags