Embedded Systems Design 1 Lecture Set 6 I/O Ports.

Slides:



Advertisements
Similar presentations
The 8051 MicroController In this module, we will be discussing the MCS-51 family of microcontroller, in particular the 8051, which is the generic IC representative.
Advertisements

4/10/2007ESD,USIT,GGSIPU1 I/O Port Programming Port 1 pins 1-8 Port 1 is denoted by P1. –P1.0 ~ P1.7 We use P1 as examples to show the operations on ports.
Chapter 18 The 8051 Microcontroller
8086 [2] Ahad. Internal! External? 8086 vs _bit Data Bus 20_bit Address 8_bit Data Bus 20_bit Address Only external bus of 8088 is.
Parul Polytechnic Institute
Chapter 4 I/O Port Programming
Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Suranaree University Of Technology มทส  2002 Anant Oonsivilai 2002/2/25 Microcomputers and Microprocessors 1 Chapter 4 I/O Port Programming.
Khaled A. Al-Utaibi 8086 Bus Design Khaled A. Al-Utaibi
TK2633 Introduction to Parallel Data Interfacing DR MASRI AYOB.
Chapter 2 HARDWARE SUMMARY
8051 Core Specification.
CHAPTER 4 I/O PORT PROGRAMMING. I/O Port Pins The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8 pins All the ports upon RESET are configured as input,
SYSTEM CLOCK Clock (CLK) : input signal which synchronize the internal and external operations of the microprocessor.
The 8085 Microprocessor Architecture
Microprocessor and Microcontroller
The 8085 Microprocessor Architecture. Contents The 8085 and its Buses. The address and data bus ALU Flag Register Machine cycle Memory Interfacing The.
1 TK2633TK Microprocessor Architecture DR MASRI AYOB.
Chapter Hardware Connection and Intel Hex File
GURSHARAN SINGH TATLA PIN DIAGRAM OF 8085 GURSHARAN SINGH TATLA
The 8051 Microcontroller architecture
Microcomputer & Interfacing Lecture 2
1 LHO 12 Interfacing. 2 A simple bus bus structure ProcessorMemory rd'/wr enable addr[0-11] data[0-7] bus Wires: –Uni-directional or bi-directional –One.
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
MCS-51 Hardware Interfacing
The 8051 Microcontroller and Embedded Systems
MOBILE OPERATING ROBOT ON EMBEDDED SYSTEM
CoE3DJ4 Digital Systems Design Hardware summary. Microprocessors vs. Microcontrollers Microprocessors are single-chip CPU used in microcomputers Microcontrollers.
An Introduction to Microcontroller (Hardware Specification) Lec note 4
CHAPTER HARDWARE CONNECTION. Pin Description 8051 family members ◦ e.g., 8751, 89C51, 89C52, DS89C4x0) ◦ Have 40 pins dedicated for various functions.
8051 Micro controller. Architecture of 8051 Features of 8051.
8085. Microcomputer Major components of the computer - the processor, the control unit, one or more memory ICs, one or more I/O ICs, and the clock Major.
MCS51 - part 2. Lecture 2 2/17 MCS51 functioning Clock generator Machine & instruction cycles Paralell ports Reset.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Microcontroller Intel 8051 [I/O Ports]. Pin out of the 8051 –40 pin package –32 pins are used for the 4 ports. –V CC / V SS –ALE Address Latch Enable.
Engineering 4862 Microprocessors Lecture 21
CIT 673 Created by Suriyong1 Micro controller hardware architechture.
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
EE365 - Microprocessors period 26 10/23/00 D. R. Schertz # Parallel Ports.
Presented by Sadhish Prabhu
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Chapter Microcontroller
8255:Programmable Peripheral Interface
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
HJD Institute of Technical Education & Research- Kera(Kutch) The 8051 Microcontroller architecture PREPARED BY: RAYMA SOHIL( )
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
8051 Pin - out PORT 0 PORT 1 PORT 2 PORT 3.
Everybody.
The 8085 Microprocessor Architecture
The 8085 Microprocessor Architecture
Hardware Source: ttp:// under
8085 Microprocessor Architecture
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Architecture of Microprocessor (Intel 8085) Unit-I
Memory organization On- chip memory Off-chip memory
The 8051 Microcontroller (8 bit )
8085 Microprocessor Architecture
The 8051 Microcontroller and Embedded Systems
8051 Microcontroller.
Hardware Source: ttp:// under
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
The 8085 Microprocessor Architecture
8051 Micro Controller.
The 8051 Microcontroller (8 bit )
CHAPTER HARDWARE CONNECTION.
8085 Microprocessor Architecture
CHAPTER 4 I/O PORT PROGRAMMING.
Presentation transcript:

Embedded Systems Design 1 Lecture Set 6 I/O Ports

Embedded Systems Design 2 Pin out of the pin package –32 pins are used for the 4 ports. –V CC / V SS –ALE Address Latch Enable –EA / V PP External Address Program Voltage for EPROM based versions of the –XTAL1 and XTAL2 Connections for clock crystal. –PSEN “Program Store Enable” –Read signal for external program memory –RST Reset

Embedded Systems Design 3 I/O Ports The 8051 has 4 bidirectional 8-bit I/O ports. –Each port is connected to an 8-bit register in the SFR. P0 = 80H, P1 = 90H, P2 = A0H, P3 = B0H –Each port is also connected to an output driver and an input buffer. –All ports are configured for output at reset. Some of the 4 ports have uses in addition to simple I/O. –Ports P0 and P2 double as the 8051’s Address and Data busses. –Port P3 doubles as the 8051’s external control lines for the timers and counters.

Embedded Systems Design 4 Port P0 P0 can be used for input or output. The pins of P0 are connected internally to an “open drain” circuit (similar to open collector but using MOS transistors). –Therefore, it must be connected to an external pull-up resistor (10 K  ) to operate properly as an output port. To operate P0 as an input port, it must be programmed by writing 1’s to all of its bits

Embedded Systems Design 5 Dual Role of P0 P0 is also designated as AD0 – AD7 which means that it also doubles as the multiplexed lower 8 bits of the address bus and the 8 bits of the data bus. P0 will be used in this manner when accessing external memory. Program or data. –ALE is used to differentiate when the pins are carrying an address vs. data. ALE = 1 when the pins carry an address and 0 otherwise. ALE can be used to enable an external address latch that will hold the address value after it has been removed from the pins.

Embedded Systems Design 6 Programming P0 Using it as an output port: MOVA, #55H BACK:MOVP0, A ACALLDELAY CPLA SJMPBACK –This will continuously output followed by on P0 separated by a certain delay. –Port P0 is initialized as output by default, so no need to configure it. Using it as an input port: MOVA, #0FFH MOVP0, A BACK:MOVA, P0 MOVP1, A SJMPBACK –This will continuously read from port P0 and write the same value to port P1. –Port P0 is initialized as output by default, so it needs to be configured for input by writing 1’s to all of its bits.

Embedded Systems Design 7 Port P1 Can be used both for input and output. Its pins are connected to internal pull-up resistors so no external pull-up is needed. –Therefore, if the external pin is left un-connected, the matching bit will be read as a logic high. Configured for output by default. –To configure it for input a 1 must be written into each bit.

Embedded Systems Design 8 All Input or All Output? Do these ports operate only as 8-bit input or 8-bit output ports? NO. –The individual bits of each port can be operated as either input or output. A pin is output by default. It can be made an input by writing 1 in its corresponding bit in the SFR register.

Embedded Systems Design 9 Dual Role of P1 Pins In the 8052, pins P1.0 and P1.1 serve a second function. –They are the external controls for timer T2. –Since there is no T2 in 8051 and 8031, these pins don’t have any special function in these chips.

Embedded Systems Design 10 Port P2 and its Dual Role P2 is very similar to P1 in its basic operation and in the fact that it does not need external pull-up. As it was shown for P0, P2 also serves as pins A8 – A15 (the upper 8 bits of he address bus) when accessing external memory. –The upper 8 bits of the address will be kept on the P2 pins for the duration of the memory cycle. No need for external latching.

Embedded Systems Design 11 Port P3 P3 is similar to P1 and P2 in its basic operation and in the fact that it does not need external pull- up.

Embedded Systems Design 12 Alternate Functions of the P3 Pins All port P3 pins are multifunctional, they are not only I/O port pins but they also serve special functions. MSBLSB P3.7P3.6P3.5P3.4P3.3P3.2P3.1P3.0 RDWRT1T0INT1INT0TXDRCD P3.7Read SignalP3.3External Interrupt P3.6Write SignalP3.2External Interrupt P3.5Timer 1 external inputP3.1Serial Output P3.4Timer 0 external inputP3.0Serial Input

Embedded Systems Design 13 Are we Reading From the Latch or the Pin? All pins on all ports are controlled by two signals (Read_Latch and Read_Pin). –Depending on which signal is active we either read the last value stored in the latch or the present value on the pin. Which signal will be activated? –Depends on the instruction. All instructions that perform a Read-Modify-Write cycle read from the latch. All others read from the pin.

Embedded Systems Design 14 Read-Modify-Write Instructions All of the following instructions read the last value stored in the latch. ANL ORL XRL JBC CPL INC DEC DJNZ MOV PX.Y, C CLR PX.Y SETB PX.Y –All other instructions will read the value from the pin.

Embedded Systems Design 15 Driving Ability The pins of ports P1, P2, and P3 have a fanout of 4 LS TTL inputs only. The fanout of the pins of port P0 depends on the size of the external resistor used for the pull-up. –You should not expect a fanout for P0 pins of more than 8 inputs.

Embedded Systems Design 16 Accessing External Memory As it has been noted before, the 8051 does not have an address or data bus. Instead, the pins of ports P0 and P2 are used for that purpose. –The pins of port P0 double as AD0 – AD7 (multiplexed). –The pins of port P2 double as A8 – A15. During a memory access (read from/write to external data memory or instruction fetch from external program memory): –The pins of port P0 first carry the lower 8-bits of the address, then switch operation to become the data bus. –The ALE signal is set to 1 during the period when the address is on the bus. –The pins of port P2 carry the upper 8-bits of the address through out the memory access cycle.

Embedded Systems Design 17 Accessing External Memory What about the values that were on the ports previously? –The values are stored in the latches in the SFR and are restored after the memory access operation. –The one exception is P0 where the value stored in the register is always over-written. This is due to the use of the P0 pins for the bidirectional data bus.

Embedded Systems Design 18 Accessing External Memory Access to external program memory always requires a 16- bit address. –Therefore, ports P0 and P2 are always used during external instruction fetch operations. Access to external data memory may use an 8-bit or 16- bit address depending on the instruction. –Uses a 16-bit address. –Uses an 8-bit address. –However, using a value placed on P2 before the second MOVX instruction allows us to provide a 16-bit address if necessary.

Embedded Systems Design 19 The Read and Write Signals It has also been noted before that the 8051 has separate program and data memory spaces. –It therefore also has separate external signals for accessing the two different memories. The PSEN signal is used during read cycles from program memory. The RD and WR signals are used during read cycles from external data memory.