SlideShare a Scribd company logo
1 of 19
EMBEDDED SYSTEM
I/O Programming
of
Microcontroller 8051
PRESENTED BY :
SHAWON ISLAM
What is I/O Operation ?
I/O operation defined as a set of collection of end users where
microprocessor or microcontroller read and write data and communicate
each other.
Every microcontroller I/O operation or programming are different. We will
see there 8051 microcontroller I/O programming.
This is actually figure of I/O programming.
There was various I/O commands go to I/O
devices and fetch data from memory either it
Is read operation either write operation.
8051 Microcontroller !
In 8051, I/O operations are done using four ports and 40 pins. The following pin diagram
shows the details of the 40 pins. I/O operation port reserves 32 pins where each port has 8
pins. The other 8 pins are designated as 𝑽𝒄𝒄
There are four port name as 𝑷𝟎, 𝑷𝟏, 𝑷𝟐 and 𝑷𝟑.
Each port has 8-pins so 4 port has 32-pins.
We know microprocessor has two buses.
Address Bus and Data Bus . It can be 8-bit, 16-bit
Or 32-bit. 8051 consisting with 16-bit
Address bus and 8-bit data bus.
𝑷𝟎
𝑷𝟐
𝑷𝟏
𝑷𝟑
Address Bus and Data Bus !
Address bus carries memory addresses from the processor to other
components such as primary storage and input/output devices. Address bus
is unidirectional.
Data bus carries the data between the processor and other components.
The data bus is bidirectional .
There is also control bus. Control bus is
Bi-directional it transmit command signals from
The CPU and response signals from the
Hardware.
I/O Ports !
In 8051 microcontroller the ports are act as data bus. They can send or
receive data between them.
They carry data from one port and transfer to another unit of
microcontroller. The data size must be 8-bit.
Microcontroller can communicate one port to another unit at a time. It can
not communicate parallel to multiple ports at a time, But microcontroller
8051 can communicate 4 units at a time because of it has 4 ports named as
𝑷𝟎, 𝑷𝟏, 𝑷𝟐 and 𝑷𝟑. That’s why this port are say as data bus. Technically they
are not data bus ,they are ports
When we turn on microcontroller 8051 then every ports was configured as
input port. They are ready for take input.
I/O Ports !
Every ports are able to use as input or output port of microcontroller 8051.
But we have to defined as the state by code.
When the first 0 is written to a port. It becomes an output.
When the first 1 is written to a port. It becomes an input.
To use any of these ports as an input or output port it must be
programmed. Because initial state it act as input port.
When all the ports as input port look like (This is initial state after ON):
𝑷𝟎 = 𝟏 𝑷𝟏 = 𝟏 𝑷𝟐 = 𝟏 𝑷𝟑 = 𝟏
When all the ports as output port look like:
𝑷𝟎 = 𝟎 𝑷𝟏 = 𝟎 𝑷𝟐 = 𝟎 𝑷𝟑 = 𝟎
𝑃0 Port of Microcontroller 8051 !
It can be used for input or output port. 𝑷𝟎 has 8-pins.
Each pins must be connected
to a 10K ohm pull-up resistor.
This is due to the fact that 𝑷𝟎 is an
Open drain unlike 𝑷𝟏 ,𝑷𝟐 𝒂𝒏𝒅 𝑷𝟑
Open drain is term used for MOS
chips in the same way that open
collector is used for TTL chips.
𝑃0 Port of Microcontroller 8051 !
Port 𝑷𝟎 also act as a address bus. Sometimes when we wanted to read data
from memory that why the memory address need to know ,by this time port
𝑷𝟎 act as a address bus.
Addresses are 16-bit but 𝑃0 has 8-bit only. How the address will know ?
For this another port also used as a address bus. 𝑷𝟎 and 𝑷𝟐 act as a address
bus those time. AD means there address. It was known as DUAL-Role
𝑷𝟎 port has 𝐴𝐷0 − 𝐴𝐷7
𝑷𝟐 port has 𝐴𝐷8 − 𝐴𝐷15
By combining these two ports it was act as address bus. By using two ports
it can know addresses of memory location and able to read data in memory.
𝑃1 Port of Microcontroller 8051 !
Port 𝑷𝟏 can be used as input or output. In contrast to port 𝑷𝟎 ,this need to
pull-up resistors for connecting with port pins. But port 𝑃1 does not need
any pull-up resistors since it was already has pull-up resistors internally.
𝑷𝟏 has 8-pins.
Upon reset ,port 𝑷𝟏 is configured as an input port. The port 𝑷𝟏 is only used
for exchanging the data between units. It has no more operations. It was only
used for data exchange.
𝑃2 Port of Microcontroller 8051 !
Port 𝑷𝟐 can be used as input and output also. Just like port 𝑷𝟏 ,port 𝑷𝟐
does not need any pull-up resistors since it was already has pull-up resistors
internally. 𝑷𝟐 has 8-pins.
Upon reset, port 𝑷𝟐 is configured as an input port.
By Combining with port 𝑷𝟎 it was act as a address bus.
When the 8051 is connected to an external memory, it provides path for
upper 8-bits of 16-bits address, and it cannot be used as I/O.
𝑃3 Port of Microcontroller 8051 !
Port 𝑷𝟑 can be used as input and output by considering its state.
Port 𝑷𝟑 does not need any pull-up resistors.
Port 𝑷𝟑 is configured as an input port upon reset.
Port 𝑷𝟑 has the additional function of providing some extremely important
signal’s.
Just like 𝑷𝟏 ,port 𝑷𝟑 also exchanging data between units but it has some
additional function’s also.
𝑃3 Port of Microcontroller 8051 !
Without exchanging data ,port
𝑷𝟑 also works with some
additional program’s.
In port 𝑷𝟑 the P3.0 and P3.1
are used for serial communica-
tion’s
P3.0 RxD is used for receiving
data from other units.
P3.1 TxD is used for transmitting
data to other units.
𝑃3 Port of Microcontroller 8051 !
In port 𝑷𝟑 the P3.2 and P3.3
are used for interrupt processes.
Interrupt defined as, when
microcontroller executes any
program and other programs are
interrupt it. Like a Hardware
Failure, Power failure.
To get the interrupts from other
unit microcontroller 8051 used these
two pins.
This two pins are active on low. 𝑰𝑵𝑻𝟎 is used for output
Interrupts on other units and 𝑰𝑵𝑻𝟏 is used for take input
Interrupts from other units.
𝑃3 Port of Microcontroller 8051 !
Microcontroller 8051 has two
timers for maintaining the
processing time.
P3.4 and P3.5 are used count
time of processes. This two are
counters. T0 is for timer 0 and T1
is for timer 1.
𝑃3 Port of Microcontroller 8051 !
P3.6 and P3.7 pins of port
𝑷𝟑 was used for read and write
operations of memory .
If it need to write in memory
then P3.6 𝑾𝑹 signal will be
generated and the particular
location of memory was written.
𝑃3 Port of Microcontroller 8051 !
If it need to read data in
memory then P3.7 𝑹𝑫 signal will
be generated and the particular
location of memory was read.
Both of pins are active on low.
𝑃3 Port of Microcontroller 8051 !
We know microcontroller 8051 has 128-bytes of RAM and 4-Kbytes of
ROM.
It has limited memory. If a greater memory size required for some
program for execute it then microcontroller 8051 must be add an external
memory with it. Like Hard Disk(HD), Solid State Drive (SSD).
How microcontroller 8051 read or write in external memory?
Sol: When it want to write in memory then low signal generates from 𝑾𝑹 , then it will be
active because it will active on low by this time 𝑹𝑫 pin will get the high signal because now it
is write operation that’s why it will standby. Then the memory address generated where the
data will be written. Then the microcontroller write the data using 8-bit data bus on particular
location. The read operation is the reverse of write operation.
Assembly Code For Port 𝑷𝟎
Assembly Code For Port 𝑷𝟏
Port 𝑷𝟏 as input

More Related Content

Similar to Embedded System Microcontroller 8051

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
8051 Microcontroller -1.pptx
8051 Microcontroller -1.pptx8051 Microcontroller -1.pptx
8051 Microcontroller -1.pptxveeramaniks
 
8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptxARYAKUMARNIRAV
 
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 By Er. Swapnil Kaware
8051 Microcontroller By Er. Swapnil Kaware8051 Microcontroller By Er. Swapnil Kaware
8051 Microcontroller By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxShanDimantha1
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentseceprinter6
 
8051 Architecture and PIN Configuration.pdf
8051 Architecture and PIN Configuration.pdf8051 Architecture and PIN Configuration.pdf
8051 Architecture and PIN Configuration.pdfSrikrishna Thota
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 MicrocontrollersSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 MicrocontrollersArti Parab Academics
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiramang6
 
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 unitjanakiramang6
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086Waleed Khan
 
8051 architecture
8051 architecture8051 architecture
8051 architecturesb108ec
 
Architecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerArchitecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerSudhanshu Janwadkar
 

Similar to Embedded System Microcontroller 8051 (20)

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Hardware View of Intel 8051
Hardware View of Intel 8051Hardware View of Intel 8051
Hardware View of Intel 8051
 
8051 Microcontroller -1.pptx
8051 Microcontroller -1.pptx8051 Microcontroller -1.pptx
8051 Microcontroller -1.pptx
 
8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx
 
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 By Er. Swapnil Kaware
8051 Microcontroller By Er. Swapnil Kaware8051 Microcontroller By Er. Swapnil Kaware
8051 Microcontroller By Er. Swapnil Kaware
 
Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptx
 
8051 dev board guide
8051 dev board guide8051 dev board guide
8051 dev board guide
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
 
Unit 4.pptx
Unit 4.pptxUnit 4.pptx
Unit 4.pptx
 
Unit 5
Unit 5Unit 5
Unit 5
 
8051 Architecture and PIN Configuration.pdf
8051 Architecture and PIN Configuration.pdf8051 Architecture and PIN Configuration.pdf
8051 Architecture and PIN Configuration.pdf
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 MicrocontrollersSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
 
janakiraman I msc 4 unit
janakiraman I msc 4 unitjanakiraman I msc 4 unit
janakiraman I msc 4 unit
 
8051 book
8051 book8051 book
8051 book
 
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
 
8051.ppt
8051.ppt8051.ppt
8051.ppt
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
8051 architecture
8051 architecture8051 architecture
8051 architecture
 
Architecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerArchitecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 Microcontroller
 

Recently uploaded

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 

Recently uploaded (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 

Embedded System Microcontroller 8051

  • 1. EMBEDDED SYSTEM I/O Programming of Microcontroller 8051 PRESENTED BY : SHAWON ISLAM
  • 2. What is I/O Operation ? I/O operation defined as a set of collection of end users where microprocessor or microcontroller read and write data and communicate each other. Every microcontroller I/O operation or programming are different. We will see there 8051 microcontroller I/O programming. This is actually figure of I/O programming. There was various I/O commands go to I/O devices and fetch data from memory either it Is read operation either write operation.
  • 3. 8051 Microcontroller ! In 8051, I/O operations are done using four ports and 40 pins. The following pin diagram shows the details of the 40 pins. I/O operation port reserves 32 pins where each port has 8 pins. The other 8 pins are designated as 𝑽𝒄𝒄 There are four port name as 𝑷𝟎, 𝑷𝟏, 𝑷𝟐 and 𝑷𝟑. Each port has 8-pins so 4 port has 32-pins. We know microprocessor has two buses. Address Bus and Data Bus . It can be 8-bit, 16-bit Or 32-bit. 8051 consisting with 16-bit Address bus and 8-bit data bus. 𝑷𝟎 𝑷𝟐 𝑷𝟏 𝑷𝟑
  • 4. Address Bus and Data Bus ! Address bus carries memory addresses from the processor to other components such as primary storage and input/output devices. Address bus is unidirectional. Data bus carries the data between the processor and other components. The data bus is bidirectional . There is also control bus. Control bus is Bi-directional it transmit command signals from The CPU and response signals from the Hardware.
  • 5. I/O Ports ! In 8051 microcontroller the ports are act as data bus. They can send or receive data between them. They carry data from one port and transfer to another unit of microcontroller. The data size must be 8-bit. Microcontroller can communicate one port to another unit at a time. It can not communicate parallel to multiple ports at a time, But microcontroller 8051 can communicate 4 units at a time because of it has 4 ports named as 𝑷𝟎, 𝑷𝟏, 𝑷𝟐 and 𝑷𝟑. That’s why this port are say as data bus. Technically they are not data bus ,they are ports When we turn on microcontroller 8051 then every ports was configured as input port. They are ready for take input.
  • 6. I/O Ports ! Every ports are able to use as input or output port of microcontroller 8051. But we have to defined as the state by code. When the first 0 is written to a port. It becomes an output. When the first 1 is written to a port. It becomes an input. To use any of these ports as an input or output port it must be programmed. Because initial state it act as input port. When all the ports as input port look like (This is initial state after ON): 𝑷𝟎 = 𝟏 𝑷𝟏 = 𝟏 𝑷𝟐 = 𝟏 𝑷𝟑 = 𝟏 When all the ports as output port look like: 𝑷𝟎 = 𝟎 𝑷𝟏 = 𝟎 𝑷𝟐 = 𝟎 𝑷𝟑 = 𝟎
  • 7. 𝑃0 Port of Microcontroller 8051 ! It can be used for input or output port. 𝑷𝟎 has 8-pins. Each pins must be connected to a 10K ohm pull-up resistor. This is due to the fact that 𝑷𝟎 is an Open drain unlike 𝑷𝟏 ,𝑷𝟐 𝒂𝒏𝒅 𝑷𝟑 Open drain is term used for MOS chips in the same way that open collector is used for TTL chips.
  • 8. 𝑃0 Port of Microcontroller 8051 ! Port 𝑷𝟎 also act as a address bus. Sometimes when we wanted to read data from memory that why the memory address need to know ,by this time port 𝑷𝟎 act as a address bus. Addresses are 16-bit but 𝑃0 has 8-bit only. How the address will know ? For this another port also used as a address bus. 𝑷𝟎 and 𝑷𝟐 act as a address bus those time. AD means there address. It was known as DUAL-Role 𝑷𝟎 port has 𝐴𝐷0 − 𝐴𝐷7 𝑷𝟐 port has 𝐴𝐷8 − 𝐴𝐷15 By combining these two ports it was act as address bus. By using two ports it can know addresses of memory location and able to read data in memory.
  • 9. 𝑃1 Port of Microcontroller 8051 ! Port 𝑷𝟏 can be used as input or output. In contrast to port 𝑷𝟎 ,this need to pull-up resistors for connecting with port pins. But port 𝑃1 does not need any pull-up resistors since it was already has pull-up resistors internally. 𝑷𝟏 has 8-pins. Upon reset ,port 𝑷𝟏 is configured as an input port. The port 𝑷𝟏 is only used for exchanging the data between units. It has no more operations. It was only used for data exchange.
  • 10. 𝑃2 Port of Microcontroller 8051 ! Port 𝑷𝟐 can be used as input and output also. Just like port 𝑷𝟏 ,port 𝑷𝟐 does not need any pull-up resistors since it was already has pull-up resistors internally. 𝑷𝟐 has 8-pins. Upon reset, port 𝑷𝟐 is configured as an input port. By Combining with port 𝑷𝟎 it was act as a address bus. When the 8051 is connected to an external memory, it provides path for upper 8-bits of 16-bits address, and it cannot be used as I/O.
  • 11. 𝑃3 Port of Microcontroller 8051 ! Port 𝑷𝟑 can be used as input and output by considering its state. Port 𝑷𝟑 does not need any pull-up resistors. Port 𝑷𝟑 is configured as an input port upon reset. Port 𝑷𝟑 has the additional function of providing some extremely important signal’s. Just like 𝑷𝟏 ,port 𝑷𝟑 also exchanging data between units but it has some additional function’s also.
  • 12. 𝑃3 Port of Microcontroller 8051 ! Without exchanging data ,port 𝑷𝟑 also works with some additional program’s. In port 𝑷𝟑 the P3.0 and P3.1 are used for serial communica- tion’s P3.0 RxD is used for receiving data from other units. P3.1 TxD is used for transmitting data to other units.
  • 13. 𝑃3 Port of Microcontroller 8051 ! In port 𝑷𝟑 the P3.2 and P3.3 are used for interrupt processes. Interrupt defined as, when microcontroller executes any program and other programs are interrupt it. Like a Hardware Failure, Power failure. To get the interrupts from other unit microcontroller 8051 used these two pins. This two pins are active on low. 𝑰𝑵𝑻𝟎 is used for output Interrupts on other units and 𝑰𝑵𝑻𝟏 is used for take input Interrupts from other units.
  • 14. 𝑃3 Port of Microcontroller 8051 ! Microcontroller 8051 has two timers for maintaining the processing time. P3.4 and P3.5 are used count time of processes. This two are counters. T0 is for timer 0 and T1 is for timer 1.
  • 15. 𝑃3 Port of Microcontroller 8051 ! P3.6 and P3.7 pins of port 𝑷𝟑 was used for read and write operations of memory . If it need to write in memory then P3.6 𝑾𝑹 signal will be generated and the particular location of memory was written.
  • 16. 𝑃3 Port of Microcontroller 8051 ! If it need to read data in memory then P3.7 𝑹𝑫 signal will be generated and the particular location of memory was read. Both of pins are active on low.
  • 17. 𝑃3 Port of Microcontroller 8051 ! We know microcontroller 8051 has 128-bytes of RAM and 4-Kbytes of ROM. It has limited memory. If a greater memory size required for some program for execute it then microcontroller 8051 must be add an external memory with it. Like Hard Disk(HD), Solid State Drive (SSD). How microcontroller 8051 read or write in external memory? Sol: When it want to write in memory then low signal generates from 𝑾𝑹 , then it will be active because it will active on low by this time 𝑹𝑫 pin will get the high signal because now it is write operation that’s why it will standby. Then the memory address generated where the data will be written. Then the microcontroller write the data using 8-bit data bus on particular location. The read operation is the reverse of write operation.
  • 18. Assembly Code For Port 𝑷𝟎
  • 19. Assembly Code For Port 𝑷𝟏 Port 𝑷𝟏 as input