SlideShare a Scribd company logo
ARM LPC2148 Training
Class - 1
Topic : Introduction to Pin’s,
PORTS and Configuring ARM
4/23/2020 Electrical Product Development
Lab
1
Topics
• PIN configuration
• PORTS
• Configuring PIN’s
• Simple LED blinking program
4/23/2020 Electrical Product Development
Lab
2
PIN Configuration
4/23/2020 Electrical Product Development
Lab
3
Fig : 1 PIN Diagram of LPC2148
PIN Configuration (Cont..)
4/23/2020 Electrical Product Development
Lab
4
LPC2148
PORT 0 PORT 1
P0.0 to P0.15 , P0.16 to P0.31 P1.0 to P1.15 , P1.16 to P1.31
Fig : 2 Distribution of PORT’s and PIN’s
PORTx
PORT 0:
• P0.0 to P0.15 → Lower 16 bit Pins
• P0.17 to P0.31 → Higher 16 bit Pins
PORT 1:
• P1.0 to P1.15 → Lower 16 bit Pins
• 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
5
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
6
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
7
Configuring PIN’s
IOPINx – IO Pin Status register
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
0 x 0 0 0 0 0 0 0 0
0x stands for hexa decimal deceleration
• Reading the values of pins can be done by
IOPINx
Ex: IOPIN0 = 0x0000000F
4/23/2020 Electrical Product Development
Lab
8
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 P0.0 to P0.3
as OUTPUT pins then declaration will be
Ex: 0 x 0 0 0 0 0 0 0 F
4/23/2020 Electrical Product Development
Lab
9
Configuring PIN’s (Cont…)
IOSETx - State set register
Ex : 0 x 0 0 0 0 0 0 0 F // Px.0 to Px.3 as High
IOCLRx - PIN Clear register
Ex : 0 x 0 0 0 0 0 0 0 F // Px.0 to Px.3 satus will be
cleared
4/23/2020 Electrical Product Development
Lab
10
Configuring PIN’s (Cont…)
S1 S0 O/P
0 0 GPIO
0 1 1st
1 0 2nd
1 1 3rd
4/23/2020 Electrical Product Development
Lab
11
PSB
GPIO
Ist Alternate Function
2nd Alternate Function
Reserve
Px.y
S1 S0
x – 0 or 1
y – 0 to 31
Fig : 3 General Block Diagram of single
Table : 1 Selector Input and PIN State
S1 and S0 values are configured by associated register of PSB
Configuring PIN’s (Cont…)
• PSB – Pin Select Block has the following
registers
• PINSEL0 –Controls the pins from P0.0 to P0.15
• PINSEL1 –Controls the pins from P0.16 to P0.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
12
Configuring PIN’s (Cont…)
• Lets take the example of PINSEL0 32 bit register
which controls the pins from P0.0 to P0.15.
• Similarly the registers of PINSEL1 and PINSEL2
will be distributed to the remaining pins of
corresponding PORTs
4/23/2020 Electrical Product Development
Lab
13
00
P0.12
00
P0.11
00
P0.10
00
P0.9
00
P0.8
00
P0.7
00
P0.6
00
P0.5
00
P0.4
00
P0.3
00
P0.2
00
P0.1
00
P0.0
S1 – S0S1 – S0
Fig : 4 Distribution of 32 bit registers to PINs of PORT 0
Configuring PIN’s (Cont…)
4/23/2020 Electrical Product Development
Lab
14
Fig : 5 Datasheet shows the features of PORTO Pins
Configuring PIN’s (Cont…)
• Example for configuring P0.0 pin as a Tx Pin for
USART communication
• PINSEL0 = 0 x 0 0 0 0 0 0 0 1
P0.0 become as TxD0 by setting LSB values of P0.3
to P0.0 as 0001
4/23/2020 Electrical Product Development
Lab
15
PSB
GPIO
TxDo
PWM
Reserve
P0.0
S1 S0
Fig : 5 Features of P0.0 pin
Simple LED Blinking Program
• Blink the LED connected in PORT1
# include <lpc21xx.h> // Include header file
void delay(void);
int main(void)
{
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
}
}
4/23/2020 Electrical Product Development
Lab
16
Simple LED Blinking Program
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
17
Assignment
• Draw the circuit for the above program
• Write the program for blinking the LED from
P0.16 to P0.23.
4/23/2020 Electrical Product Development
Lab
18
Thank You
4/23/2020 Electrical Product Development
Lab
19

More Related Content

What's hot

Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
Dhaval Kaneria
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
Gaurav Verma
 
Interrupts in pic
Interrupts in picInterrupts in pic
Interrupts in pic
v Kalairajan
 
Introduction to arm processor
Introduction to arm processorIntroduction to arm processor
Introduction to arm processor
RAMPRAKASHT1
 
ARM Processors
ARM ProcessorsARM Processors
ARM Processors
Mathivanan Natarajan
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Ganesh Ram
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
Sudhanshu Janwadkar
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
Siva Kumar
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
hello_priti
 
Introduction to ARM
Introduction to ARMIntroduction to ARM
Introduction to ARM
Puja Pramudya
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil KawareProf. Swapnil V. Kaware
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
Gaurav Verma
 
Arm assembly language programming
Arm assembly language programmingArm assembly language programming
Arm assembly language programming
v Kalairajan
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
Ashish Ranjan
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architecture
Dr.YNM
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller ppt
Rahul Kumar
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
Dr.YNM
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051John Williams
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
THANDAIAH PRABU
 
Arm architecture
Arm architectureArm architecture

What's hot (20)

Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
Interrupts in pic
Interrupts in picInterrupts in pic
Interrupts in pic
 
Introduction to arm processor
Introduction to arm processorIntroduction to arm processor
Introduction to arm processor
 
ARM Processors
ARM ProcessorsARM Processors
ARM Processors
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
 
I2C Protocol
I2C ProtocolI2C Protocol
I2C Protocol
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
Introduction to ARM
Introduction to ARMIntroduction to ARM
Introduction to ARM
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Arm assembly language programming
Arm assembly language programmingArm assembly language programming
Arm assembly language programming
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
 
Lect 2 ARM processor architecture
Lect 2 ARM processor architectureLect 2 ARM processor architecture
Lect 2 ARM processor architecture
 
8051 Microcontroller ppt
8051 Microcontroller ppt8051 Microcontroller ppt
8051 Microcontroller ppt
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
Arm architecture
Arm architectureArm architecture
Arm architecture
 

Similar to Introduction to ARM LPC2148

Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingIkhwan_Fakrudin
 
EMBEDDED SYSTEMS 5
EMBEDDED SYSTEMS 5EMBEDDED SYSTEMS 5
EMBEDDED SYSTEMS 5PRADEEP
 
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLERDIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
Chirag Lakhani
 
digitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdfdigitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdf
satyamsinha37
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148
Omkar Rane
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerCorrado Santoro
 
janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unit
janakiramang6
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
SITI SABARIAH SALIHIN
 
PIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxPIC Presentation_final updated.pptx
PIC Presentation_final updated.pptx
ShabanamTamboli1
 
Tactile sensor working and its types
Tactile sensor working and its typesTactile sensor working and its types
Tactile sensor working and its types
elprocus
 
IC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its ApplicationIC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its Application
elprocus
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unit
janakiramang6
 
14941634.ppt
14941634.ppt14941634.ppt
14941634.ppt
MonirJihad1
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
Sadiq Rahim
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to pic
PRADEEP
 
2. ALU and MIPS Arcitecture introduction.pdf
2. ALU and MIPS Arcitecture introduction.pdf2. ALU and MIPS Arcitecture introduction.pdf
2. ALU and MIPS Arcitecture introduction.pdf
bsse20142018
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Moeez Shem
 

Similar to Introduction to ARM LPC2148 (20)

Embedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programmingEmbedded system (Chapter 3) io_port_programming
Embedded system (Chapter 3) io_port_programming
 
EMBEDDED SYSTEMS 5
EMBEDDED SYSTEMS 5EMBEDDED SYSTEMS 5
EMBEDDED SYSTEMS 5
 
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLERDIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
 
digitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdfdigitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdf
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontroller
 
janakiraman egsp collage I msc 4 unit
janakiraman egsp collage  I msc 4 unitjanakiraman egsp collage  I msc 4 unit
janakiraman egsp collage I msc 4 unit
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
 
PIC Presentation_final updated.pptx
PIC Presentation_final updated.pptxPIC Presentation_final updated.pptx
PIC Presentation_final updated.pptx
 
Tactile sensor working and its types
Tactile sensor working and its typesTactile sensor working and its types
Tactile sensor working and its types
 
IC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its ApplicationIC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its Application
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unit
 
14941634.ppt
14941634.ppt14941634.ppt
14941634.ppt
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to pic
 
2. ALU and MIPS Arcitecture introduction.pdf
2. ALU and MIPS Arcitecture introduction.pdf2. ALU and MIPS Arcitecture introduction.pdf
2. ALU and MIPS Arcitecture introduction.pdf
 
8051 book
8051 book8051 book
8051 book
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 

Recently uploaded

CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
AG2 Design
 

Recently uploaded (20)

CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
 

Introduction to ARM LPC2148

  • 1. ARM LPC2148 Training Class - 1 Topic : Introduction to Pin’s, PORTS and Configuring ARM 4/23/2020 Electrical Product Development Lab 1
  • 2. Topics • PIN configuration • PORTS • Configuring PIN’s • Simple LED blinking program 4/23/2020 Electrical Product Development Lab 2
  • 3. PIN Configuration 4/23/2020 Electrical Product Development Lab 3 Fig : 1 PIN Diagram of LPC2148
  • 4. PIN Configuration (Cont..) 4/23/2020 Electrical Product Development Lab 4 LPC2148 PORT 0 PORT 1 P0.0 to P0.15 , P0.16 to P0.31 P1.0 to P1.15 , P1.16 to P1.31 Fig : 2 Distribution of PORT’s and PIN’s
  • 5. PORTx PORT 0: • P0.0 to P0.15 → Lower 16 bit Pins • P0.17 to P0.31 → Higher 16 bit Pins PORT 1: • P1.0 to P1.15 → Lower 16 bit Pins • 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 5
  • 6. 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 6
  • 7. 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 7
  • 8. Configuring PIN’s IOPINx – IO Pin Status register 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 0 x 0 0 0 0 0 0 0 0 0x stands for hexa decimal deceleration • Reading the values of pins can be done by IOPINx Ex: IOPIN0 = 0x0000000F 4/23/2020 Electrical Product Development Lab 8
  • 9. 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 P0.0 to P0.3 as OUTPUT pins then declaration will be Ex: 0 x 0 0 0 0 0 0 0 F 4/23/2020 Electrical Product Development Lab 9
  • 10. Configuring PIN’s (Cont…) IOSETx - State set register Ex : 0 x 0 0 0 0 0 0 0 F // Px.0 to Px.3 as High IOCLRx - PIN Clear register Ex : 0 x 0 0 0 0 0 0 0 F // Px.0 to Px.3 satus will be cleared 4/23/2020 Electrical Product Development Lab 10
  • 11. Configuring PIN’s (Cont…) S1 S0 O/P 0 0 GPIO 0 1 1st 1 0 2nd 1 1 3rd 4/23/2020 Electrical Product Development Lab 11 PSB GPIO Ist Alternate Function 2nd Alternate Function Reserve Px.y S1 S0 x – 0 or 1 y – 0 to 31 Fig : 3 General Block Diagram of single Table : 1 Selector Input and PIN State S1 and S0 values are configured by associated register of PSB
  • 12. Configuring PIN’s (Cont…) • PSB – Pin Select Block has the following registers • PINSEL0 –Controls the pins from P0.0 to P0.15 • PINSEL1 –Controls the pins from P0.16 to P0.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 12
  • 13. Configuring PIN’s (Cont…) • Lets take the example of PINSEL0 32 bit register which controls the pins from P0.0 to P0.15. • Similarly the registers of PINSEL1 and PINSEL2 will be distributed to the remaining pins of corresponding PORTs 4/23/2020 Electrical Product Development Lab 13 00 P0.12 00 P0.11 00 P0.10 00 P0.9 00 P0.8 00 P0.7 00 P0.6 00 P0.5 00 P0.4 00 P0.3 00 P0.2 00 P0.1 00 P0.0 S1 – S0S1 – S0 Fig : 4 Distribution of 32 bit registers to PINs of PORT 0
  • 14. Configuring PIN’s (Cont…) 4/23/2020 Electrical Product Development Lab 14 Fig : 5 Datasheet shows the features of PORTO Pins
  • 15. Configuring PIN’s (Cont…) • Example for configuring P0.0 pin as a Tx Pin for USART communication • PINSEL0 = 0 x 0 0 0 0 0 0 0 1 P0.0 become as TxD0 by setting LSB values of P0.3 to P0.0 as 0001 4/23/2020 Electrical Product Development Lab 15 PSB GPIO TxDo PWM Reserve P0.0 S1 S0 Fig : 5 Features of P0.0 pin
  • 16. Simple LED Blinking Program • Blink the LED connected in PORT1 # include <lpc21xx.h> // Include header file void delay(void); int main(void) { 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 } } 4/23/2020 Electrical Product Development Lab 16
  • 17. Simple LED Blinking Program 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 17
  • 18. Assignment • Draw the circuit for the above program • Write the program for blinking the LED from P0.16 to P0.23. 4/23/2020 Electrical Product Development Lab 18
  • 19. Thank You 4/23/2020 Electrical Product Development Lab 19