Docsity

This note help you to know, Lecture notes of Microprocessors

Toggle sidebar
bg1
Mahendra Engineering College
Mahendhirapuri
Department of ECE
AIM
To learn the architecture, programming and interfacing of microprocessors and microcontrollers.
OBJECTIVES
•To introduce the architecture and programming of 8085 microprocessor.
•To introduce the interfacing of peripheral devices with 8085 microprocessor.
•To introduce the architecture and programming of 8086 microprocessor.
•To introduce the architecture, programming and interfacing of 8051 micro controller.
UNIT I 8085 CPU 9
8085 Architecture – Instruction set – Addressing modes – Timing diagrams – Assembly language
programming – Counters – Time Delays – Interrupts – Memory interfacing – Interfacing, I/O devices.
UNIT II PERIPHERALS INTERFACING 9
Interfacing Serial I/O (8251)- parallel I/O (8255) –Keyboard and Display controller (8279) – ADC/DAC
interfacing – Inter Integrated Circuits interfacing (I2C Standard)- Bus: RS232C-RS485-GPIB
UNIT III 8086 CPU 9
Intel 8086 Internal Architecture – 8086 Addressing modes- Instruction set- 8086 Assembly language
Programming–Interrupts.
UNIT IV 8051 MICROCONTROLLER 9
8051 Micro controller hardware- I/O pins, ports and circuits- External memory –Counters and Timers-Serial
Data I/O- Interrupts-Interfacing to external memory and 8255.
UNIT V 8051 PROGRAMMING AND APPLICATIONS 9
8051 instruction set – Addressing modes – Assembly language programming – I/O port programming -Timer
and counter programming – Serial Communication – Interrupt programming –8051 Interfacing: LCD, ADC,
Sensors, Stepper Motors, Keyboard and DAC.
TOTAL : 45
TEXT BOOKS
1. Ramesh S Gaonkar, Microprocessor Architecture, Programming and application with 8085, 4th Edition,
Penram International Publishing, New Delhi, 2000. (Unit I, II)
2. John Uffenbeck, The 80x86 Family, Design, Programming and Interfacing, Third Edition. Pearson
Education, 2002.
3. Mohammed Ali Mazidi and Janice Gillispie Mazidi, The 8051 Microcontroller and Embedded Systems,
Pearson Education Asia, New Delhi, 2003. (Unit IV, V)
EC1303 – Microprocessor and its applications
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download This note help you to know and more Lecture notes Microprocessors in PDF only on Docsity!

Mahendra Engineering College Mahendhirapuri Department of ECE AIM To learn the architecture, programming and interfacing of microprocessors and microcontrollers. OBJECTIVES

  • To introduce the architecture and programming of 8085 microprocessor.
  • To introduce the interfacing of peripheral devices with 8085 microprocessor.
  • To introduce the architecture and programming of 8086 microprocessor.
  • To introduce the architecture, programming and interfacing of 8051 micro controller. UNIT I 8085 CPU 9 8085 Architecture – Instruction set – Addressing modes – Timing diagrams – Assembly language programming – Counters – Time Delays – Interrupts – Memory interfacing – Interfacing, I/O devices. UNIT II PERIPHERALS INTERFACING 9 Interfacing Serial I/O (8251)- parallel I/O (8255) –Keyboard and Display controller (8279) – ADC/DAC interfacing – Inter Integrated Circuits interfacing (I^2 C Standard)- Bus: RS232C-RS485-GPIB UNIT III 8086 CPU 9 Intel 8086 Internal Architecture – 8086 Addressing modes- Instruction set- 8086 Assembly language Programming–Interrupts. UNIT IV 8051 MICROCONTROLLER 9 8051 Micro controller hardware- I/O pins, ports and circuits- External memory –Counters and Timers-Serial Data I/O- Interrupts-Interfacing to external memory and 8255. UNIT V 8051 PROGRAMMING AND APPLICATIONS 9 8051 instruction set – Addressing modes – Assembly language programming – I/O port programming -Timer and counter programming – Serial Communication – Interrupt programming –8051 Interfacing: LCD, ADC, Sensors, Stepper Motors, Keyboard and DAC. TOTAL : 45 TEXT BOOKS
  1. Ramesh S Gaonkar, Microprocessor Architecture, Programming and application with 8085, 4th^ Edition, Penram International Publishing, New Delhi, 2000. (Unit I, II)
  2. John Uffenbeck, The 80x86 Family, Design, Programming and Interfacing, Third Edition. Pearson Education, 2002.
  3. Mohammed Ali Mazidi and Janice Gillispie Mazidi, The 8051 Microcontroller and Embedded Systems, Pearson Education Asia, New Delhi, 2003. (Unit IV, V) EC1303 – Microprocessor and its applications

UNIT I – INTEL 8085

1.1 INTRODUCTION TO MICROPROCESSOR BASED SYSTEM

The microprocessor is a semiconductor device (Integrated Circuit) manufactured by the VLSI (Very Large Scale Integration) technique. It includes the ALU, register arrays and control circuit on a single chip. To perform a function or useful task we have to form a system by using microprocessor as a CPU and interfacing memory, input and output devices to it. A system designed using a microprocessor as its CPU is called a microcomputer. The Microprocessor based system (single board microcomputer) consists of microprocessor as CPU, semiconductor memories like EPROM and RAM, input device, output device and interfacing devices. The memories, input device, output device and interfacing devices are called peripherals. The popular input devices are keyboard and floppy disk and the output devices are printer, LED/LCD displays, CRT monitor, etc. The above block diagram shows the organization of a microprocessor based system. In this system, the microprocessor is the master and all other peripherals are slaves. The master controls all the peripherals and initiates all operations. The work done by the processor can be classified into the following three groups.

  1. Work done internal to the processor
  2. Work done external to the processor
  3. Operations initiated by the slaves or peripherals. The work done internal to the processors are addition, subtraction, logical operations, data transfer operations, etc. The work done external to the processor are reading/writing the memory and reading/writing the J/O devices or the peripherals. If the peripheral requires the attention of the master then it can interrupt the master and initiate an operation.

INTEL 8085 – Pin Diagram & Description

The INTEL 8085 is a 8-bit microprocessor. It operates on 8-bit data and uses 16-bit address to access the memory. With the help of 16-bit address, 8085 can access 2^16 = 65536 = 64K memory locations.

  • It is a 40-pin DIP chip designed using NMOS.
  • It operates with a power supply of +5 volts and GND.
  • 8085 generates the clock signal internally by dividing the external supplied clock signal by two.

After an ALU operation, if the most significant bit of the result is 1, then sign flag is set. The zero flag is set, if the ALU operation results in zero and it is reset if the result is non-zero. In an arithmetic operation, when a carry is generated by the lower nibble, the auxiliary carry flag is set. After an arithmetic or logical operation, if the result has an even number of 1 's the parity flag is set, other wise it is reset. If an arithmetic operation results in a carry, the carry flag is set other wise it is reset. Among the five flags, the AC flag is used internally for BCD arithmetic and other four flags can be used by the programmer to check the conditions of the result of an operation. TIMING & CONTROL UNIT: The timing and control unit synchronizes all the microprocessor operations with the clock and generates the control signals necessary for communication between the microprocessor and peripherals. INSTRUCTION REGISTER & DECODER: When an instruction is fetched from memory it is placed in instruction register. Then it is decoded and encoded into various machine cycles. REGISTER ARRAY:

  • Apart from Accumulator (A-register), there are six general-purpose programmable registers B, C, D, E, H and L.
  • They can be used as 8-bit registers or paired to store l6-bit data. The allowed pairs are B-C, D-E and H-L.
  • The temporary registers W and Z are intended for internal use of the processor and it cannot be used by the programmer.
  • STACK POINTER (SP): The stack pointer SP, holds the address of the stack top. The stack is a sequence of RAM memory locations defined by the programmer. The stack is used to save the content of registers during the execution of a program.
  • PROGRAM COUNTER (PC): The program counter (PC) keeps track of program execution. To execute a program the starting address of the program is loaded in program counter. The PC sends out an address to fetch a byte of instruction from memory and increment its content automatically. Hence, when a byte of instruction is fetched, the PC holds the address of the next byte of the instruction or next instruction.

INSTRUCTION EXECUTION AND DATA FLOW in 8085 The program instructions are stored in memory, which is an external device. To execute a program in 8085, the starting address of the program should be loaded in program counter. The 8085 output the content of program counter in address bus and asserts read control signal low. Also, the program counter is incremented. The address and the read control signal enable the memory to output the content of memory location on the data bus. Now the content of data bus is the opcode of an instruction. The read control signal is made high by timing and control unit after a specified time. At the rising edge of read control signals, the opcode is latched into microprocessor internal bus and placed in instruction register. The instruction-decoding unit, decodes the instructions and provides information to timing and control unit to take further actions.

INSTRUCTION FORMAT OF 8085

The 8085 have 74 basic instructions and 246 total instructions. The instruction set of 8085 is defined by the manufacturer Intel Corporation. Each instruction of 8085 has 1 byte opcode. With 8 bit binary code, we can generate 256 different binary codes. In this, 246 codes have been used for opcodes. The size of 8085 instructions can be 1 byte, 2 bytes or 3 bytes.

  • The 1-byte instruction has an opcode alone.
  • The 2 bytes instruction has an opcode followed by an eight-bit address or data.
  • The 3 bytes instruction has an opcode followed by 16 bit address or data. While storing the 3 bytes instruction in memory, the sequence of storage is, opcode first followed by low byte of address or data and then high byte of address or data.

INSTRUCTION SET

The 8085 instruction set can be classified into the following five functional headings. Group I - DATA TRANSFER INSTRUCTIONS: Includes the instructions that moves ( copies) data between registers or between memory locations and registers. In all data transfer operations the content of source register is not altered. Hence the data transfer is copying operation. Ex: i) MOV A,B ii) LDA 4600 iii) LHLD 4200 Group II - ARITHMETIC INSTRUCTIONS: Includes the instructions which performs the addition, subtraction, increment or decrement operations. The flag conditions are altered after execution of an instruction in this group. Ex: i) ADD B ii) SUB C iii) INR D iv) INX H Group III - LOGICAL INSTRUCTIONS: The instructions which performs the logical operations like AND, OR, Exclusive-OR, complement, compare and rotate instructions are grouped under this heading. The flag conditions are altered after execution of an instruction in this group. Ex: i) ORA B ii) XRA A iii) RAR Group IV - BRANCHING INSTRUCTIONS: The instructions that are used to transfer the program control from one memory location to another memory location are grouped under this heading. Ex: i) JZ 4200 ii) RST 7 iii) CALL 4300 Group V - MACHINE CONTROL INSTRUCTIONS: Includes the instructions related to interrupts and the instruction used to halt program execution. Ex: i) SIM ii) RIM iii) HLT The 74 basic instructions of8085 are listed inTable-2.1. The opcode of each instruction, size, machine cycles, number of T -state and the total number of instructions in each type are also shown in table in next page. The instructions affecting the status flag are listed in table followed.

The software interrupt instructions are included at the appropriate (or required) place in the main program. When the processor encounters the software instruction, it pushes the content of PC (Program Counter) to stack. Then loads the Vector address in PC and starts executing the Interrupt Service Routine (ISR) stored in this vector address. At the end of ISR, a return instruction - RET will be placed. When the RET instruction is executed, the processor POP the content of stack to PC. Hence the processor control returns to the main program after servicing the interrupt. Execution of ISR is referred to as servicing of interrupt. All software interrupts of 8085 are vectored interrupts. The software interrupts cannot be masked and they cannot be disabled. The software interrupts are RST0, RST1, … RST7 (8 Nos). HARDWARE INTERRUPTS OF 8085 An external device, initiates the hardware interrupts of 8O85 by placing an appropriate signal at the interrupt pin of the processor. The processor keeps on checking the interrupt pins at the second T -state of last machine cycle of every instruction. If the processor finds a valid interrupt signal and if the interrupt is unmasked and enabled, then the processor accepts the interrupt. The acceptance of the interrupt is acknowledged by sending an INTA signal to the interrupted device. The processor saves the content of PC (program Counter) in stack and then loads the vector address of the interrupt in PC. (If the interrupt is non-vectored, then the interrupting device has to supply the address of ISR when it receives INTA signal). It starts executing ISR in this address. At the end of ISR, a return instruction, RET will be placed. When the processor executes the RET instruction, it POP the content of top of stack to PC. Thus the processor control returns to main program after servicing interrupt. The hardware interrupts of 8085 are TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR. Further the interrupts may be classified into VECTORED and NON-VECTORED INTERRUPTS. VECTORED INTERRUPT In vectored interrupts, the processor automatically branches to the specific address in response to an interrupt. NON-VECTORED INTERRUPT But in non-vectored interrupts the interrupted device should give the address of the interrupt service routine (ISR). In vectored interrupts, the manufacturer fixes the address of the ISR to which the program control is to be transferred. The vector addresses of hardware interrupts are given in table above in previous page.

The TRAP, RST 7.5, RST 6.5 and RST 5.5 are vectored interrupts. The INTR is a non-vectored interrupt. Hence when a device interrupts through INTR, it has to supply the address of ISR after receiving interrupt acknowledge signal. The type of signal that has to be placed on the interrupt pin of hardware interrupts of 8085 are defined by INTEL. The TRAP interrupt is edge and level sensitive. Hence, to initiate TRAP, the interrupt signal has to make a low to high transition and then it has to remain high until the interrupt is recognized. The RST 7.5 interrupt is edge sensitive (positive edge). To initiate the RST 7.5, the interrupt signal has to make a low to high transition an it need not remain high until it is recognized. The RST 6.5, RST 5.5 and INTR are level sensitive interrupts. Hence for these interrupts the interrupting signal should remain high, until it is recognized. MASKABLE & NON-MASKABLE INETRRUPTS: The hardware vectored interrupts are classified into maskable and non-maskable interrupts.

  • TRAP is non-maskable interrupt
  • RST 7.5, RST 6.5 and RST 5.5 are maskable interrupt. Masking is preventing the interrupt from disturbing the main program. When an interrupt is masked the processor will not accept the interrupt signal. The interrupts can be masked by moving an appropriate data (or code) to accumulator and then executing SIM instruction. (SIM - Set Interrupt Mask). The status of maskable interrupts can be read into accumulator by executing RIM instruction (RIM - Read Interrupt Mask). All the hardware interrupts, except TRAP are disabled, when the processor is resetted. They can also be disabled by executing Dl instruction. (Dl-Disable Interrupt).
  • When an interrupt is disabled, it will not be accepted by the processor. (i.e., INTR, RST 5.5, RST 6.5 and RST 7.5 are disabled by DI instruction and upon hardware reset).
  • To enable (to allow) the disabled interrupt, the processor has to execute El instruction (El- Enable Interrupt).

TIMING DIAGRAM for various machine cycles

The machine cycles are the basic operations performed by the processor, while instructions are executed. The time taken for performing each machine cycle is expressed in terms of T- states. One T-state is the time period of one clock cycle of the microprocessor. The various machine cycles are

  1. Opcode fetch …………….. - 4 / 6 T
  2. Memory Read ……………. - 3 T
  3. Memory Write ……………. - 3 T
  4. I/O Read ………………….. - 3 T
  5. I/O Write …………………. - 3 T
  6. Interrupt Acknowledge …… - 6 / 12 T
  7. Bus Idle …………………… - 2 / 3 T