Embedded System Microcontroller 8051

ShawnIslam20150022 37 views 19 slides Nov 15, 2022
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

This is about microcontroller 8051 and its I/O


Slide Content

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 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:  

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.  

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 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 port has 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.  

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 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 .  

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.  

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.  

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.  

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.  

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 and T1 is for timer 1 .

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.  

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.  

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