UNIT 1
INTRODUCTION TO INTEL 8085
By:
ATIFA AQUEEL Guest Teacher
Electronics Engg. Section
University Women’s Polytechnic, AMU
FUNDAMENTALS OF MICROPROCESSOR
SyLLabUS
I. INTRODUCTION TO THE INTEL 8085
• Definition of microprocessor, generations and types of microprocessors, most popular microprocessors.
• Architecture of 8085, brief description of ALU, register section, data &
address buses. Bus time sharing 8085 CPU pins and associated signal.
II. PROGRAMMING THE 8085
• Instruction, Group of instruction, Addressing modes of Instruction, 8085 instruction set. Machine Language, Assembly Language comparison, Assembly Language programming (Simple Problems).
III. TIMING INSTRUCTION & EXECUTION
• Machine, Instruction, Fetch, Read, Write(IO/MEM) cycle timing diagram, Interruption: Types of 8085 interrupt system, 8085 SID and SOD lines.
10-09-2020 By: Atifa Aqueel 2
SyLLabUS
IV. PERIPHERAL INTERFACING
• PPLD’S, Brief description of 8255, 8257-DMA Controller, Introduction to Intel’s 8086 microprocessor, Popular applications of Microprocessor in industry.
BOOKS RECOMMENDED:-
1. Microprocessor Architecture, Programming & Applications, by Goankar, 6th Edition 2013
2. Fundamentals of Microprocessor and Microcontrollers, by B.Ram, Dhanpat Rai Publications, 9th edition 2019.
3. Microprocessor and Microcomputers by Rafiquzzaman, Universal Book Stall (UBS Pub.) 1997
4. Introduction to Microprocessor, by Mathur, 3rd Edition 1997, Aditya P Mathur (Tata McGraw Hill, Pub. Co.Ltd)
QUESTIONS
• Why are you learning this subject?
• Where are these microprocessors used?
• Is there a µP in Normal Fan?
• Is there a µP in Tubelight?
• Is there a µP in Remote Control, mobile Phone , Computer?
• Where do we require microprocessors?
• (wherever programming is involved µP is used)
10-09-2020 By: Atifa Aqueel 4
baSICS
PROCESSOR
I/O DEVICES
MEMORY
Instruction Cycle 1.Fetch
2.Decode 3.Execute
Compiler: HLL to ML Assembler: ALL to ML
HLL: a=b+c ALL: ADD B, C Bin : 01101011
MICROCOMPUTER A-Bus
B-Bus
C-Bus
DECODINg
(Understanding the ‘opcode’)
Address Opcode/
Data
00 00 00 11 2 to 4 Decoder
+ - X /
Consider very simplest µp that has only 4 instructions: ADD, SUB, MULT, DIV, so there will be only 4 opcodes.
OP (ML) – INS(AL) 00 – ADD
01 – SUB 10 – MULT
11 – DIV
Microprocessor Memory
10-09-2020 By: Atifa Aqueel 6
baSICS Of bINaRy aND HExaDECImaL
Decimal Binary Hexadecimal Binary 8 4 2 1
0 0 0 0 0 0-9
1 0 0 0 1 A 1 0 1 0
2 0 0 1 0 B 1 0 1 1
3 0 0 1 1 C 1 1 0 0
4 0 1 0 0 D 1 1 0 1
5 0 1 0 1 E 1 1 1 0
6 0 1 1 0 F 1 1 1 1
7 0 1 1 1
8 1 0 0 0
Everything stored inside a computer is in binary form i.e 0s and 1s.
6
combina tion are forbidde n
baSICS Of bINaRy aND HExaDECImaL
• ADD 0001+1001 =1010 (No such no. is present in decimal system)
• Using 4 bits always need 16 combinations (we need to name each of those combinations)
• There came the need for creating a new system which has 16 representations. i.e. Hexadecimal numbers
• In decimal system maximum 4 digit no. is 9999 while in hexadecimal it is FFFF (65536). Both are using the same space.
• Therefore in computers we do not use decimal numbers.
Hexadecimal Binary
00 H 0000 0000
35H 0011 0101
74H 0111 0100
93H 1001 0011
FFH 1111 1111
8 BIT NO.
00H (8 ZEROES)
……. FFH (8 ONES)
16 BIT NO.
0000H (16 ZEROES)
……. FFFFH (16 ONES)
10-09-2020 By: Atifa Aqueel 8
POwERS Of 2
• In this subject everything is in binary so every number is in some power of 2.
20 1 21 2 22 4 23 8 24 16 25 32 26 64 27 128 28 256 29 512
210 1024 or 1K Or 1Kilo
211 21 x 210 = 2K 212
213 216
220 210 x210= 1K x 1K =1M
224 8M
230 210 X210 X210 =1K X1KX1K=1G
240 1T
243 236 239
1GB = 1 gigabytes, whereas 1Gb = 1 gigabits 1 byte = 8 bits
1 nibble = 4 bits 1 word = 16 bits
DEfINITION
• A microprocessor is a controlling unit of a micro-computer wrapped inside a small chip. It performs Arithmetic Logical Unit (ALU) operations and communicates with the other devices connected with it. It is a single Integrated Circuit in which several functions are combined. It is abbreviated as µP.
• Microprocessors are used almost everywhere. Some common household items where you are likely to find a microprocessor are washing machines, microwave ovens, laptops, digital clocks and smartphones.
8085 is the first commercially successful Microprocessor of Intel
10-09-2020 By: Atifa Aqueel 10
HISTORy Of mICROPROCESSOR
•
Fairchild Semiconductors invented the first IC (Integrated Circuit) in 1959.
•
In 1968, Robert Noyce, Gordan Moore, Andrew Grove found their own company Intel.
•
Intel grew from 3 man start-up in 1968 to industrial giant by 1981.
•
In 1971, INTEL created the first generation Microprocessor 4004 that would run at a clock speed of 108 kHz
•
From 1973 to 1978, second-generation 8-bit microprocessors were fabricated like Motorola 6800 and 6801, INTEL-8085, and Zilog's- Z80.
•
In 1978, Intel 8008 third-generation process came into the market.
•
In the early 80s, Intel released fourth-generation 32-bit processors.
•
In 1995, intel released in fifth-generation 64-bit processors .
HISTORy Of mICROPROCESSOR
10-09-2020 By: Atifa Aqueel 12
TyPES Of mICROPROCESSOR
• Important types of Microprocessors are:
1. Complex Instruction Set Microprocessors (CISCs) 2. The Application Specific Integrated Circuit (ASICs) 3. Reduced Instruction Set Microprocessors (RISCs) 4. Digital Signal Multiprocessors (DSPs)
Q1 (H.A1): Write in detail about the generations and different types of microprocessors.
aPPLICaTIONS Of mICROPROCESSOR
• Microprocessors are mainly used in devices like:
• Calculators
• Accounting system
• Games machine
• Complex industrial controllers
• Traffic light
• Control data
• Military applications
• Defense systems
• Computation systems
10-09-2020 By: Atifa Aqueel 14
mICROPROCESSOR VS mICROCONTROLLER
• According to the definition of microprocessor,
• It is an electronic IC which works as a computer processor and is present in single or multiple integrated circuits (IC’s). The function of microprocessor is to perform all the functions of the central processing system.
• Don’t confuse it with Central Processing Unit (CPU), as this resides on single or multiple integrated circuits and doesn’t occupy much space like CPU does.
• As per the definition of Microcontroller,
• It is an electronic Integrated Circuit (IC) which contains processing unit along with the other required peripheral components with fixed sized RAM and ROM. It is also known as the small computer in an Small IC.
aNaLOgy
• Microprocessors are a key element to any electronic component. You will find them in any system that requires logic, no matter how small or simple.
• Much like a microprocessor, a microcontroller is the nervous system of a body.
• Whilst the former “processes” data, the latter “controls” data and peripherals.
• Think of it as both sides of the brain: one is the thinking side, whereas the other one is the motor skills and expressive side.
• On its own, a microprocessor won’t do much; It’s like a brain without a body.
• Slap on a nervous system (busses), some limbs (IO) and a beating heart (crystal clock) and you’ve got yourself a microcontroller.
• The most common example of these is an Arduino Uno.
• Microcontrollers and Microcomputers; both of which are essentially the same but built for different purposes: the microcontroller does basic logic and requires little time and components to do so, whilst the microcomputer does heavier computation and requires a longer time and more power to do so.
10-09-2020 By: Atifa Aqueel 17
mICROPROCESSOR VS mICROCONTROLLER
• Microprocessor consists of only a Central Processing Unit, whereas Micro Controller contains a CPU, Memory, I/O all integrated into one chip.
• Microprocessor is used in Personal Computers whereas Micro Controller is used in an embedded system.
• Microprocessor uses an external bus to interface to RAM, ROM, and other peripherals, on the other hand, Microcontroller uses an internal controlling bus.
• Microprocessors are based on Von Neumann model Micro controllers are based on Harvard architecture
• Microprocessor is complicated and expensive, with a large number of instructions to process but Microcontroller is inexpensive and straightforward with fewer instructions to process.
Microprocessor
Microcomputer
10-09-2020 By: Atifa Aqueel 19
ORgaNIzaTION Of µP baSED SySTEm
Microprocessor based system with Bus architechture Microcomputer
Microprocessor
CONTD…
• Figure shows a simplified but formal structure of a microprocessor-based system.
• It includes four components: microprocessor. input, output; and memory (Read/Write Memory and Read-Only Memory).
• These components are organized around .a common communication path called a bus.
• The entire group of components is also referred to as a system or a microcomputer system, and the components themselves are referred to as sub-systems.
Microprocessor Vs Microcomputer
The microprocessor is one component of the microcomputer. On the other hand, the microcomputer is a complete computer similar to any other computer, except that the CPU functions of the microcomputer are performed by the microprocessor.
10-09-2020 By: Atifa Aqueel 21
1. MICROPROCESSOR:
• The microprocessor is the brain of the microcomputer.
• It is a semiconductor device consisting of electronic logic circuits manufactured by using either a large-scale (LSI) or very-large-scale integration (VLSI) technique.
• The microprocessor is capable of performing various computing functions and making decisions to change the sequence of program execution.
• It fetches stored instructions and data word from the memory sequentially, decode it, execute it and then store the result in memory.
• The major components of a microprocessor are ALU, register array and control unit.
a. ALU (Arithmetic and Logic Unit): This section performs computing functions (ADD, SUB, AND, OR, XOR etc.) on data.
b. Register Array: This section consists of various registers. These registers are primarily used to store data temporarily during the execution of a program.
c. Control Unit: The control unit provides the necessary timing and control signals to all the operations in the microcomputer, it controls the flow of data between the microprocessor and memory and peripherals .
2. MEMORY:
• Memory stores such binary information as instructions and data, and provides that information to the microprocessor.
• To execute programs, the microprocessor reads instructions and data from memory and performs the computing operations in its ALU section.
• Results are either transferred to the output section for display or stored in memory for later use.
• The memory block has two sections: Read-Only Memory (ROM) and Read/
Write Memory (R/WM), popularly known as Random-Access Memory (RAM).
a) Read-Only Memory (ROM): The ROM is used to store programs that do not need alterations. The monitor program of a single-board microcomputer is generally stored in the ROM.
b) Read/ Write Memory (R/WM): The Read/Write Memory (R/WM) is also known as user memory . It is used to store user programs and data. The information stored in this memory can be easily read and altered.
10-09-2020 By: Atifa Aqueel 23
3. INPUT AND OUTPUT DEVICES:
• The third component of microprocessor based system is I/O devices. The microprocessor communicates with the outside world through these devices.
• The I/O devices are also called peripherals.
• The input devices such as keyboard, mouse, switches and A/D converters are used to transfer binary information from outside world to the microprocessor.
• The output devices such as LEDs, Cathode Ray Tubes (CRTs), printers, X- Y plotters, D/A converters transfer data from the microprocessor to the outside world.
bUS ORgaNIzaTION Of 8085 mICROPROCESSOR
• Bus is a group of conducting wires which carries information, all the peripherals are connected to microprocessor through Bus.
• It is a communication path between microprocessor and memory/peripherals.
10-09-2020 By: Atifa Aqueel 25
BLOCK DIAGRAM
ADDRESS OP/Data
1000H 45H
4000H 4001H
PROCESSOR
I/O DEVICES A-Bus D-Bus C-Bus
Memory Mem.Read
Input Read
Mem. Write Output write
• There are three different types of buses used in microprocessor 1. Address Bus
2. Data Bus 3. Control Bus
• ADDRESS BUS (A-Bus): It is a group of conducting wires which are used to carry the address of memory and I/o devices
• Address bus is unidirectional because data flow in one direction, from microprocessor to memory or from microprocessor to Input/output devices.
• The address bus of INTEL 8085 is of 16bits ranging from 0000 H to FFFF H, (H denotes Hexadecimal).
• The microprocessor 8085 can transfer maximum 16 bit address which means it can address up to 216 or 65, 536 (64K) different memory location.
• The Length of the address bus determines the amount of memory a system can address. Such as a system with a 32-bit address bus can address 2^32 memory locations.
10-09-2020 By: Atifa Aqueel 27
• DATA BUS (D-Bus):
• It is a group of conducting wires which carries Data only.
• Data bus is bidirectional because data flow in both directions, from microprocessor to memory or Input/Output devices and from memory or Input/Output devices to microprocessor.
• Length of Data Bus of 8085 microprocessor is 8 Bit (That is, two Hexadecimal Digits), ranging from 00 H to FF H. (H denotes Hexadecimal).
• When it is write operation, the processor will put the data (to be written) on the data bus.
• When it is read operation, the memory controller will get the data from specific memory block and put it into the data bus.
• The width of the data bus is directly related to the largest number that the bus can carry, such as an 8 bit bus can represent 2 to the power of 8 unique values, this equates to the number 0 to 255.
• The word length of a processor depends on the width of data bus that’s why Intel 8085 is called as 8-bit processor.
• Similarly a 16-bit processor has 16 bit data bus.
• CONTROL BUS (C-Bus):
• It is a group of conducting wires, which is used to carry necessary control signals between the microprocessor and memory and I/O devices.
• Microprocessor uses control bus to process data, that is what to do with selected memory location.
• Examples of control signals are 𝑅𝑅𝑅𝑅,𝑊𝑊𝑅𝑅,IO/𝑀𝑀� 𝑒𝑒𝑒𝑒𝑒𝑒:
• The µP issues IO/ M� signal to indicate whether it will communicate with IO device or memory.
• If IO/ M� signal is high, µP wants to communicate with an IO device.
• If IO/ M� signal is low, µP wants to communicate with an memory.
• When the µP sends a low 𝑅𝑅𝑅𝑅 signal, it means µP wants to read information.
• When the µP sends a low 𝑊𝑊𝑅𝑅 signal, it means µP will perform write operation i.e it will send data to the device.
10-09-2020 By: Atifa Aqueel 29
CONTD…
Control Signals IO/ M� 𝑅𝑅𝑅𝑅 𝑊𝑊𝑅𝑅
Memory Read 0 0 1
Memory Write 0 1 0
I/O Read 1 0 1
I/O Write 1 1 0
mEmORy aDDRESSINg CaPabILITy Of a mICROPROCESSOR
• The memory addressing capability of a microprocessor depends on the width of its address bus.
• If a microprocessor has N address lines, it can directly address 2N memory locations.
• If a microprocessor has 16 address lines, it can directly address 216 or 65536 or 64K memory locations. (216 = 26 × 210 = 64 × 1𝐾𝐾 = 64𝐾𝐾)
• One memory location stores 1 byte information. Hence a microprocessor having 16 address lines can directly address 64K bytes of memory.
• Therefore, the addressing capability of a microprocessor is 2N bytes where N= No.of address lines
1 byte = 8 bits 1 nibble = 4 bits 1 word = 16 bits
10-09-2020 By: Atifa Aqueel 31
8085 µP aRCHITECTURE
Program Execution
ADDRESS OP/Data
2000H 1st 2001H 2nd 2002H 3rd 2003H 4th . .
.
2009H 10th Address Bus
Control Bus Data Bus
Memory
Program Counter Instruction
Register Instruction
Decoder
10-09-2020 By: Atifa Aqueel 33
KEy fEaTURES
• Some key features of 8085 Microprocessor.
1. The Intel 8085 is an 8-bit general-purpose microprocessor.
2. It has an 8-bit data bus. This means that 8 bits of data can flow around in the innards of the microprocessor.
3. Apart from the data bus, it also has a 16-bit address bus, which addresses up to 64KB.
4. It also has a 16-bit program counter & a 16-bit stack pointer.
5. There are six 8-bit registers which are arranged in pairs: BC, DE, HL.
6. It requires a voltage supply of +5V to operate at 3.2MHZ single-phase clock frequency
7. The Intel 8085 comes as a 40-pin IC package.
8. It has 74 basic instructions and 246 opcodes.
The 8085 is based on Von-Neumann architecture, where the data and instructions are in the same memory space without any distinction between them.
THE aRCHITECTURE Of THE 8085
• Clearly, we can see the different functional units in the architecture:
1. Accumulator
2. Arithmetic and Logic Unit 3. General-purpose register 4. Program counter
5. Stack pointer
6. Temporary register 7. Flag register
8. Instruction register and decoder 9. Timing and control unit
10. Serial Input/output control 11. Interrupt Control
12. Address buffer and address-data buffer 13. Address bus and data bus
10-09-2020 By: Atifa Aqueel 35
8085 µP aRCHITECTURE
• Fig. shows the block diagram of INTEL 8085 microprocessor.
It consists of three main sections:
1. Arithmetic and Logic Unit (ALU) 2. Timing and control unit
3. Register Array
Arithmetic and Logic Unit (ALU)
• The primary functioning of the ALU is arithmetic & logical operations – these include
• Addition
• Subtraction
• Incrementing (Add 1)
• Decrementing (Subtract 1)
• Logical tasks like OR, AND, XOR
• Complement (Logical NOT)
• Left shift or the right shift, etc.
• It uses the data from memory and always stores the result of all operations in the Accumulator.
10-09-2020 By: Atifa Aqueel 37
Timing and control unit
• The timing and control unit acts as the brain of microprocessor system.
• This component produces all the timing & control signal for all the microprocessor operation.
• This unit synchronizes all the microprocessor operations with the internal clock and generates the necessary control signals for communication
between the 8085 and the peripherals.
• Given below are the timing & control signals which control the external and internal circuits −
– Control Signals: READY, RD’, WR’, ALE – Status Signals: S0, S1, IO/M’
– DMA Signals: HOLD, HLDA
– RESET Signals: RESET IN, RESET OUT
Register Array
• Fig. shows the various registers of INTEL 8085.
• Registers are used by the microprocessor for temporary storage and manipulation of data and instructions.
• Data remain in the register till they are sent to the memory or I/O devices.
• In large computers the no. of registers are more and hence the program requires less transfer of data to/from the memory.
• In small computers the no. of registers are small due to limited size of the chip.
• Intel 8085 has the following registers:
1. One 8-bit Accumulator i.e. Register A
2. Six 8-bit general purpose registers. These are B, C, D, E, H & L.
3. One 16-bit Program Counter, PC 4. One 16-bit Stack Pointer, SP 5. Instruction Register (IR) 6. Temporary Register (TR)
10-09-2020 By: Atifa Aqueel 39
1. ACCUMULATOR (A, 8 bits)
• The accumulator sometimes referred to as ‘Acc’, is an 8-bit register which is connected to the internal data bus and the ALU.
• It is used to hold one of the operands of an arithmetic and logic operations.
• It serves as one of the inputs to the ALU.
• The other operand for an arithmetic and logic operation may be stored either in the memory or in one of the general purpose registers.
• The outcome (final result) of the operations carried out by the ALU (the Arithmetic and Logical Operations) are stored in the accumulator.
• There are some exceptions where only one operand is required for an instruction.
• This operand is held in the accumulator and the result is also stored in the accumulator.
• The accumulator is also referred to as register A.
2. General Purpose Registers
• The Intel 8085 has six 8-bit general-purpose registers, namely B, C, D, E, H and L.
• Each register can hold data of 8-bits.
• We can also use these registers in pairs – BC, DE and HL. When in pairs, these registers can contain 16-bit data. They are called Register-pair.
• These three are valid register pairs. The programmer can not form a register-pair by selecting any two register of his choice.
• The H-L pair is also used to act as a memory pointer and for this purpose it holds the 16-bit address of a memory location.
• The general purpose registers and the accumulator are accessible to programmer.
• For eg. LXI H 3000H
• MOV M, A : Move the content of acc. To memory location 3000H
: Load HL pair with 3000H
(HL can be used to store data as well as address)
10-09-2020 By: Atifa Aqueel 41
3. Program Counter (PC, 16-bits)
• Let us consider that an instruction is being executed by the microprocessor.
When the ALU finishes executing one instruction, it begins searching for the next instruction to be performed. Thus, there is a requirement of keeping the next instruction’s address ready to be executed, in order to save time. This is taken care of by the program counter.
• Program counter is a 16-bit special purpose register which is used to hold the address of the next instruction to be fetched or executed.
• It keeps the track of the memory address of the instructions in a program while they are being executed.
• The µP increments the content of the PC during the execution of previous instruction, so that it points the address of the next instruction in a program.
Instruction Register and Decoder
INSTRUCTION REGISTER:
• The 8085 places the contents of the PC onto the Address bus and fetches the instruction.
• This fetched instruction is stored into the Instruction register.
• The instruction register holds the opcode (operation code or instruction code) of the instruction which is being decoded and executed.
INSTRUCTION DECODER:
• The fetched instruction from the Instruction register enters the Instruction Decoder.
• Here the instruction is decoded and the decode information is given to the Timing and Control Circuit to issue the necessary timing and control signals for the execution of the particular instruction.
10-09-2020 By: Atifa Aqueel 43
Temporary and Internal Registers
TEMPORARY REGISTER (8-BITS):
• This is an 8-bit register associated with ALU.
• It is used by μP for storing one of the operands during an operation.
• The programmer has NO ACCESS to this register.
• It is used by the microprocessor only.
INTERNAL REGISTER (WZ, 16-bits):
• This is a 16-bit register pair (two 8-bit temporary registers).
• It is used by μP to hold temporary values in some instructions like CALL/JMP etc.
• This is used to hold the 16-bit operand temporarily during the execution of intermediate stages of instruction.
• DE HL
WZ
• The programmer has no access to this register pair.
Status Flags (Flag Registers)
• Flag register contents. D1, D3 and D5 slots are empty. A lot of processors have these ’empty’ register slots in their designs to accommodate future design updates.
10-09-2020 By: Atifa Aqueel 45
Status Flags (Flag Registers)
• The 8085 has an 8-bit flag register, but there are only five active flag bits.
• They are – S, Z, AC, P and CY.
• Flags are basically flip-flops which are used to show the status of some units of the 8085 after the completion of their respective operations.
• These flip-flops are either set or reset as per the condition of the result in the registers.
1. Sign Flag (S)
• It occupies the 7th bit of the flag register also known as the most significant bit (MSB).
• The sign flag indicates whether the result of an arithmetic / logical operation is positive or negative.
• If the flag is set, i.e. S = 1, the result of the recently carried out operation is negative; whereas if the result turns out to be positive, the flag is reset, i.e.
S=0.
Status Flags (Flag Registers)
2. Zero Flag (Z)
• It occupies the 6th bit of the flag register.
• The zero flag indicates whether the output of an arithmetic / logical operation turns out to be zero or not.
• If the result of the most recent operation is zero, the flag will be set (i.e. Z=1).
Else, the flag will be simply reset (Z=0).
• This flag’s value is changed after the ALU operation by the result stored in the accumulator and other registers.
• It helps in determining if two numbers are equal or not.
3. Auxiliary Carry Flag (AC):
• It occupies the 4th bit of the flag register.
• It is set when an Auxiliary Carry / Borrow is generated.
• It is reset when an Auxiliary Carry / Borrow is not generated.
• Auxiliary Carry is the Carry generated between the lower nibble and the higher nibble for an 8-bit operation. It is not affected after a 16- bit operation.
It is used only in DAA operation.
10-09-2020 By: Atifa Aqueel 47
Status Flags (Flag Registers)
4. Parity Flag (P):
• It occupies the 2nd bit of the flag register.
• Parity is used to indicate whether a number is of even parity (has even number of 1’s in the binary number) or of odd parity (has an odd number of 1’s in the binary number).
• Thus, the parity flag in the flag register indicates if the most recent result of the ALU operation is of even parity or odd parity.
• If it follows even parity, the P flag will be set to 1; else it remains zero.
5. Carry flag (CY):
• It occupies the 0th bit of the flag register.
• After the execution of arithmetic instruction, if a carry is produced(if result is more than 8 bits), then the carry flag is set to 1 otherwise it is zero.
• The carry flag is set or reset in case of addition as well as subtraction (CY=1, if borrow is produced)
Examples
• Add CB AND F9
• 1100 1011
• 1110 1001 1 1011 0100 S Z AC P CY 1 0 1 1 1
• Add 42 and 24
10-09-2020 By: Atifa Aqueel 49
40+40=80 1000 0000 overflow
In case of signed magnitude representatiom
With the help of 8 bit, the max no. is7F and min -7F
Stack & Stack Pointer
• A stack is stated as the container of elements where insertion and removal of the elements follow with the last-in-first-out (LIFO) theory.
• Here, the insertion of elements is done through push operation and removal of elements is done through a pop operation.
• Also, the other definition in the technical aspect is, a stack is a LIFO data structure which is employed in the RAM area where one can store temporary data and addresses when the microprocessor jumps to a subroutine from its current task.
• Then the retrieved address would be used by the processor to jump back to the previous routine/job/task. A stack is also called a recursive data structure where pushing and popping happens continuously.
STACK
10-09-2020 By: Atifa Aqueel 51
Stack & Stack Pointer
Stack & Stack Pointer
10-09-2020 By: Atifa Aqueel 53
Stack Pointer
Address and Data Bus
10-09-2020 By: Atifa Aqueel 55
Question
Q: What do you understand by High Level
Language, Assembly Language as well as
Machine Language. Explain the function of
compiler and interpreter. (Date: 31-Aug-2020)
8085 PIN DIAGRAM
10-09-2020 By: Atifa Aqueel 57
8085 PIN DIAGRAM
Classification of 8085 pins
10-09-2020 By: Atifa Aqueel 59
8085 PIN Configuration
• Fig. 1.3 (a) and (b) shows 8085 Pin Diagram and functional pin diagram of 8085 microprocessor respectively.
• This classification is done on the basis of the signal types into 6 groups as follows:
1. Address Bus (A15-A8)
2. Multiplexed Address Data Bus (AD7-AD0) 3. Control and Status Signals
4. Power Supply and frequency signals 5. Serial I/O ports
6. Interrupts and Externally Initiated signals
Address Bus (A15-A8 )
• The address bus is a group of sixteen lines i.e A0-A15.
• However these lines are split into two segments: A15-A8 and AD7-AD0.
• Line A15-A8 are used to carry most significant 8 bits of the memory or peripheral address.
• The address bus is unidirectional, i.e., bits flow in one direction from the microprocessor unit to the peripheral devices and uses the high order address bus.
10-09-2020 By: Atifa Aqueel 61
Multiplexed Address Data Bus (AD7-AD0)
• The 8 bit data bus (D
0– D
7) is multiplexed with the lower half (A
0– A
7) of the 16 bit address bus.
• These are time multiplexed Address/Data bus i.e. they serve dual purpose.
• During first part of the machine cycle (T
1), lower 8 bits of memory address or I/O address appear on the bus.
• During remaining part of the machine cycle (T
2and T
3) these lines are used as a bi-directional data bus.
• However lower order address can be separated from the data
bus by using external latch.
Control and Status Signals
• This group of signal includes two control signals (𝑅𝑅𝑅𝑅,𝑊𝑊𝑅𝑅), three status signals (IO/𝑀𝑀�, S0 & S1) to identify the nature of operation and one special signal (ALE) to indicate the beginning of operation.
• These signals are as follows:
• S1 and S0 (Status signals) – These are basic status signals that indicate the operation that the microprocessor is performing at any given stage.
10-09-2020 By: Atifa Aqueel 63
Control Signals
• 𝑅𝑅𝑅𝑅 (Read) – This is an active low input. When it goes low, the microprocessor reads data from either the IO device or from memory. In simple terms, the microprocessor takes data input by placing the data from a source (IO/Memory) on the data bus.
• 𝑊𝑊𝑅𝑅 (Write) – Another active low pin that does the opposite work as the previous pin. When it goes low, the data on the data bus is written to a memory location or an I/O device.
• IO/𝑀𝑀� : It is a status signal which determines whether the address is for input-output or memory. When it is high(1) the address on the address bus is for input-output devices. When it is low(0) the address on the address bus is for the memory. This signal is combined with RD’ and WR’ to generate IO and memory control signals.
10-09-2020 By: Atifa Aqueel 65
ALE (Address Latch Enable)
• ALE (Address Latch Enable) : We, know that AD0 to AD7 lines are multiplexed and the lower half of address (A0 – A7) is available only during T1 of the machine cycle.
• This lower half of address is also necessary during T2 and T3 of machine cycle to access specific location in memory or I/O port.
• This means that the lower half of an address must be latched in T1 of the machine cycle, so that it is available throughout the machine cycle.
• The latching of lower half of an address bus is done by using external latch and ALE signal from 8085 Pin Diagram
ALE (Address Latch Enable)
• ALE is a positive going pulse generated when a new operation is started by the microprocessor.
• A high signal on ALE indicates that the bits on AD7-AD0 are address bits, whereas a low signal on ALE indicates that the bits on AD7-AD0 are data bits.
• ALE signal is used primarily to latch a low order address from the multiplexed bus and generate a separate set of 8 address lines A7-A0.
10-09-2020 By: Atifa Aqueel 67
Power Supply and Frequency signals
• The power supply and frequency signals of Intel 8085 are:
• Vcc : It requires a single +5 V power supply.
• Vss or Gnd: Ground reference.
• X1 and X2 : A tuned circuit like LC, RC or crystal is connected at these two The internal clock generator divides oscillator frequency by 2, therefore, to operate a system at 3 MHz, the crystal of tuned circuit must have a
frequency of 6 MHz.
• CLK OUT : This signal is used as a system clock for other devices (Peripherals).
• Its frequency is half the oscillator frequency.
• This pin is used to synchronize all the peripherals with the microprocessor.
• The frequency available here is the same as the frequency that the microprocessor clock generator generates.
Serial IO Ports
• 8085 has two signals to implement the serial transmission. These are SID and SOD lines. In serial transmission data are sent over a single line one bit at a time, such as transmission over telephone lines.
• SID (Serial Input Data) – This pins accepts serial input data.
• The microprocessor receives data bit by bit through this pin.
• The data transfers from the pin to the 7th bit of the accumulator when a RIM instruction executes.
• SOD (Serial Output Data) – It is a data line for serial output transmission.
• This pin outputs serial data onto the 7th bit of the accumulator when a SIM instruction is executed.
• The microprocessor sends out data bit by bit through this pin.
• RIM and SIM are two instructions used for serial transmission.
10-09-2020 By: Atifa Aqueel 69
Question (09-09-2020)
• Ques: What is IC 74LS373? How can it be used in
demultiplexing of AD7-AD0. (Multiplexed address
data bus).
Interrupts and Externally Initiated Signals
• The 8085 Pin Diagram has five hardware interrupt signals that can be used to interrupt a program execution:
• (i) INTR (ii) RST 7.5 (iii) RST 6.5 (iv) RST 5.5 (v) TRAP
• The microprocessor acknowledges Interrupt Request by 𝐼𝐼𝐼𝐼𝐼𝐼𝐼𝐼 signal. In addition to Interrupts, there are three externally initiated signals namely
RESET, HOLD and READY. To respond to HOLD request, it has one signal called HLDA.
10-09-2020 By: Atifa Aqueel 71
INTR and INTA’
• INTR (Interrupt Request) – Other interrupts, the ones above, actually interrupt the normal functioning of the microprocessor. However, INTR, which has the lowest priority, executes on the completion of the current program. Once the interrupt signal from INTR is acknowledged, the INTA signal is issued.
TRAP, RST 7.5, RST 6.5, RST 5.5
10-09-2020 By: Atifa Aqueel 73
vectored
• TRAP, RST 7.5, RST 6.5, RST 5.5 –The interrupt is used to transfer data from peripherals.
• A different program stored in a different location starts executing once a signal is given to any of these pins.
• However, these can be masked using code.
• Check out the table below for the priority of these interrupts.
• If two simultaneous interrupts are received, the microprocessor executes them according to this priority level.
RESET Signals
• 𝑹𝑹𝑹𝑹𝑹𝑹𝑹𝑹𝑹𝑹 𝑰𝑰𝑰𝑰 – The bar on top of the pin indicates that this is an active low pin. Which means that it is active when it is given a low (zero) input. When a high (one) input is given, it’s off. The function of this pin is to reset the microprocessor. The program counter (which increases as programs execute) sets to 0. A fresh start. Once the low input is removed, the microprocessor begins executing instructions from 0000H address. The state of the flags and internal registers is unpredictable on the application of this signal.
• RESET OUT – This signal is used to
• a) indicate that the microprocessor is being reset.
• b) Reset external peripherals connected to the microprocessor.
10-09-2020 By: Atifa Aqueel 75
HOLD, HLDA and READY
DMA (Direct Memory Access) Signals (Pins HOLD and HLDA)
10-09-2020 By: Atifa Aqueel 77
DMA (Direct Memory Access) Signals (Pins HOLD and HLDA)
• HOLD – The HOLD pin can be used to communicate to the microprocessor control mechanism that an external device is requesting the use of the address and data bus. Suppose a shift register IC is using the address and the data bus at a particular instant. Suddenly, a wild Counter appears and sends a signal to the HOLD pin. The microprocessor says hang on! Let me finish my current machine cycle.
Once the microprocessor does that, it gives up control of the buses to the counter. And send out an acknowledge signal via the HLDA pin.
• HLDA (HOLD Acknowledge) – The HOLD Acknowledge pin goes high when the microprocessor surrenders its control of the buses in response to the HOLD call. Once the HOLD request is attended to, the HLDA pin goes low, and the processor takes over the buses.
Demultiplexing of AD0-AD7 using IC 74LS373
• The dual-purpose of the AD0-AD7 pins is achieved through multiplexing.
• In simple words, multiplexing allows us to use the pins of a microprocessor for more than one function.
• Pros of multiplexing of pins in a microprocessor: Since each pin can serve multiple purposes, the total number of pins can be reduced.
• Cons of multiplexing of pins in a microprocessor: We need additional circuitry to demultiplex these pins to allow them to serve their multiple purposes individually.
• But for extracting the data and the lower 8 bits of the address, we demultiplex AD0-AD7 using IC 74LS373.
10-09-2020 By: Atifa Aqueel 79
IC 74LS373
IC 74LS373
• IC 74LS373 is an IC with 20 pins.
• It consists of 8 latches. (A latch is a digital component that can hold on to a bit of data. At the risk of oversimplification, it is a memory unit to hold one bit of data. You can read more about latches and flip-flops here.)
• Each latch is controlled by two signals: Latch Enable (LE) and Output Enable (OE).
• So, there are eight pairs of inputs and outputs, one for each latch. And the two pins to give LE and OE signal.
• This accounts for 18 pins.
• The remaining two pins VCC and GND are used to power up the IC.
• Inputs are provided at the eight input pins D0-D7.
• If the LE is high, inputs at D0-D7 are reflected exactly at the corresponding outputs O0-O7.
• When the LE signal goes low, values of inputs at that instant are latched (or trapped) inside and are available at the output.
• All this time, we assume Output Enable signal to be active.
The timing diagram of demultiplexing AD0-AD7 in 8085
10-09-2020 By: Atifa Aqueel 81
Demultiplexing of AD0-AD7
Demultiplexing of AD0-AD7
• Let us assume that instruction MOV C, A is to be executed.
• For executing the instruction, the microprocessor first has to read the opcode (hex code for the instruction) stored at 2005H. The hex code here is 4FH.
• Step 1
• The whole process consists of 4 T states or 4 clock cycles (refer to the timing diagram above).
• In the first clock cycle, the higher 8 bits of the address (20H) are loaded in A8-A15.
At the same time, the lower 8 bits of the address (05H) are issued at pins AD0- AD7.
• Also, the ALE signal issued by the microprocessor is high, telling that AD0-AD7 contains the lower 8 bits of the address. (i.e., the pins are currently functioning as address pins.)
• Notice that in the circuit diagram, the ALE signal is connected to the LE (latch enable) pin of the IC. This ensures that the address received at the input of the 74LS373 IC (05H) is reflected at its output (i.e., the output of the 74LS373 IC is 05H).
10-09-2020 By: Atifa Aqueel 83
Demultiplexing of AD0-AD7
• Step 2
• Near the end of the first clock cycle, the ALE signal goes low.
• Whatever bits were there on AD0-AD7 (in this case, 05H) at that instant are latched (frozen) in the IC.
• That means, those bits are present at the output of the IC and are not affected by the values on AD0-AD7 anymore.
• The entire reason behind this exercise is to help the pins (AD0-AD7) carry two different types of values on the same path.
• We do this by carrying one of the values first (the address), handing it over to the IC with the latches (memory units) to hold on to, and then getting the other set of values.
Demultiplexing of AD0-AD7
• Step 3
• Now, all the 16 bits of the address are available.
• Higher 16 bits at A8-A15 and lower 8 bits at the outputs of the IC.
• This means that AD0-AD7 is free now. It can now be used as the data bus.
• Now, during the second and third clock cycles, 8-bit data to be fetched (4FH) is loaded on AD0-AD7 from memory and is retrieved by the microprocessor.
• Note that in this step, AD0-AD7 is being used as the data bus.
• This is how the demultiplexing of AD0-AD7 works.
10-09-2020 By: Atifa Aqueel 85