Introduction
- The most important technological invention of modern times is the “microprocessor”. This device (lntel-4004) consists of about 2300 transistors on a chip, which was fabricated using silicon gate P-channel MOS-technology. It was later named as “microprocessor”.
- A microprocessor is a multiple purpose programmable clock driven, register based electronic device that reads binary instructions from memory, accepts binary data as input and processing this data according to the instructions written in the memory.
- The microprocessor is capable of performing computing functions and making decisions to change the sequence of program execution
- The microprocessor is one component of the microcomputers and this is divided into three segments as shown in figure-below.
Microcomputer basically contains four parts
- Central processing unit (CPU):
i.e. main heart of computers system
i.e. RAM, ROM, R/WM
- Input (l/P) devices: 9899913245
i.e. keyboard, scanner, mouse etc.
i.e. printer, speaker, monitor, plotter etc.
NOTE:
CPU ® Microprocessor ® ALU + Register + Control
Flowchart of Microprocessor
Computer Languages m
- Instruction: a command in binary that is recognised and executed by the computer in order to-accomplish a task. Some instructions are designed with one word, and some require multiple words.
- Mnemonic: a combination of letters to suggest the operation of an instruction.
- Program:a set of instructions written in a specific sequence for the computer to accomplish a given task.
- Machine Language: the binary medium of communication with a computer through a designed set of instructions specific to each computer.
- Assembly Language: a medium of communication with a computer in which programs are written in mnemonics. An assembly language is specific to a given computer.
- Low-Level Language: a medium of communication that is machine-dependent or specific to a given computer. The machine and “ the assembly languages of a computer are considered low-level languages. Programs written in these languages are not transferrable to different types of machines.
- High-Level Language: a medium of communication that is independent of a given computer. Programs are written in English-like words, any they can be executed on a machine using a written translator (a compiler or an interpreter).
- Compiler: a program that translates English-like words of a high-level language into the machine language of a computer. A compiler reads a given program, called a source code, in its entirety, and then translates the program into the machine language which is called ah object code. (Ex. C, C++)
- Intepreter: a program that translates the English-like statements of a high-level language into the . machine language of a computer. An interpreter translates one statement at a time from a source code to an object code. (Ex. BASIC)
- Assembler: a computer program that translates an assembly language program from mnemonics to the binary machine code of a computer.
- Difference between compiler and intepreter: Intepreter reads one line at a time, converts it into object code, executes and then reads next line. Whereas compiler reads whole program at a and convert it into the object code and then execute.
- Bit: a binary digit, 0 or 1.
- Byte: a group of eight bits.
- Nibble: a group of four bits.
- Word: a group of byte the computer recognizes and processes at a time.
The 8085 Microprocessor
- It is an 8-bit microprocessor.
- It is a 40-PIN IC.
- N-MOS technology is used.
- Its data bus has 8-bits.
- Its address bus has 16-bits
- It is capable of addressing 64 K of memory.
- It requires +5 V power supply.
- It has operating frequency of 3 MHz. -
internal Architecture of 8085 Microprocessor
- ALU
- Timing and control units
- Instruction register and decoder
- Register array
- Interrupt control
- Serial I/O control
- System bus
ALU : Arithmetic and Logic Unit
- In 8085-microprocessor, ALU performs arithmetical and logical operations.
- The ‘arithmetic logic unit performs the comparing functions it includes the accumulator, the temporary register, the arithmetic and logic circuits and five flags.
- The temporary register is used to hold data during an arithmetic and logic operation. The result is stored in the accumulator, and the flags (flip-flops) are set or reset according to the result of the operation.
- The flags are affected by the arithmetic and logic operations in the ALU. In most of these operations, the result is stored in accumulator. Therefore, the flags generally reflect data conditions in the accumulator. The descriptions and conditions of the flags are as follows:
- Sign Flag (S): After the execution of an arithmetic or logic operation, if bit D7 of the result (usually in the accumulator) is 1, the ‘sign flag is set. This flag is used with signed numbers. In a given byte, if D7 is 1, the number will be viewed as a negative number; if it is 0, the number will be considered positive. In arithmetic operations with signed numbers, bit D7 is reserved for indicating the sign, and the remaining seven bits are used to represent the magnitude of a number.
- Zero Flag (Z): The Zero flag is set if the ALU operation results in 0, and the flag is reset if the result is not 0. This flag is modified by the results in the accumulator as well as in the other registers.
- Auxiliary Carry Flag (AC): In an arithmetic operation, when a cany is generated by digitD3 and passed on to digit D4, the AG flag is set. The flag is used only internally for BCD (Binary Coded Decimal) operations; and is not available for the programmer to change the sequence of a program with a jump instruction.
- Parity Flag (P): After an arithmetic or logical operation, if the result has an eyen number of 1 s, the flag is set. If it has an odd number of 1s, the flag is reset. {For example, the data byte 0 0 00 00 1 1 has even parity even if the magnitude of the number is odd).
- Carry Flag (CY): If an arithmetic operation results in a carry, the carry flag is set;- otherwise it is reset. The carry flag also serves as a borrow flag for substraction. The bit positions reserved for these flags in the flag register are as follows:
Note:
Among the five flags, the AC flag is used internally for BCD arithmetic; the instruction set does not include any conditional jump instruction based on the AC flag.
Timing and Control Unit
- The control unit is the nerve centre of ar. M
- It synchronizes all the uP operations with re and generates the control signals necessar communication between the microprocessors peripherals.
- In this unit X, and X2 pins are used to cot external crystals or LC-CKT to generate inte clock.
Instruction Register (IR) and Decoder
- The instruction register and the decoder are of the ALU.
- When an instruction is fetched from memory loaded in the instruction register.
- The decoder decodes the-instruction r establishes of events to follow.
- The instruction register is not programmable a cannot be accessed through any instruction
- IR will holds opcodes of present instruction be e executed
Register Array
- Possible register pairs are:
(i) B-C (16 bits)
(ii) D-E(16bits)
(iii) H-L(16 bits)
Accumulator (A)
- It is a 8-bit special purpose register arc accessible.
- It acts as one source of operand to the AL J destination to the result.
- During I/O data transfer, data is the between accumulator (A) and I/O device
Status Register (SR):
- It is also called “FLAG REGISTERS”.
- It is used to store the status of ALU result.
- “FLAGS” are used for testing of data conditions.
- PSW (Programme Status Word) = Accumulator+ Flag register Also PSW is a 16 bit register.
Program Counter (PC):
- It is a 16-bit special purpose register which is user accessible.
- It is required to keep track of the address of the next instruction to be fetched from the memory for execution.
- In other words we can say, PC provides the address of next instruction to memory which has to be executed.
- When a byte is fetched then PC automatically incremented by one (1), to point to next memory location.
- When the microprocessor is reset, the PC sets to zero(O).
Stack Pointer (SP):
- It is a 16 bit SPR, used as a memory pointer.
- “SP” provides the address of stack top or top address of stack.
– A memory location in R/W memory is called “STACK”. It is a part of RAM, which is used’ during Subroutines, PUSH and POP operations. _
- It operates as last in first out (LIFO).
System Bus
Address bus:
- It is 16 bits of length.
- It is unidirectional bus.
- It is decided into two parts namely,
Lower order address bus (A0 - A7)® is also called “Line number”.
Higher order address bus (A8 - ,415) ® is also called “Page Number”.
Data Bus:
It carries ‘data’, in binary form, between microprocessor and other external units, such as memory.
Multiplexed Address/Data bus:
- Its length is in 8-bit.
- It is a bidirectional bus.
- It is multiplexed with lower order address bus with lines (AD0 - AD7).
- To reducing the no. of pins in microprocessor databus is “TDM” with address bus.
Control Bus:
Control Bus are various lines which have-specific functions tor coordinating and controlling microprocessor operations. Eg: Read/Not Write line, single binary digit. Control whether memory is being ‘written to’ (data stored in memory) or ‘read from’ (data taken out of memory) 1 = Read, 0 = Write.
8085 Pin Description
Here we will discuss only few important pins of the microprocessor,
RP (Output 3state)
READ; indicates the selected memory or 1/0 device is to be read and that tjie Data Bus is available for the data transfer.
WR (Output 3state)
WRITE; indicates the data on the Data Bus is to be written into the selected memory or I/O location. Data is set up at the trailing edge of WR. 3stated during Hold and Halt modes.
READY (Input)
If Ready is high during a read or write cycle, it indicates that the memory or peripheral is ready to send or receive data. If Ready is low, the CPU will wait for Ready to go high before completing the read or write cycle.
HOLD (Input)
HOLD; indicates that another Master is requesting the use of the Address and Data Buses. The CPU, upon receiving the Hold request, will relinquish the use of buses as soon as the completion of the current machine cycle. Internal processing can continue. The processor can regain the buses only after the Hold is removed. When the Hold is acknowledged, the Address, Data, RD, WR, and IO/M lines are 3stated.
HLDA (Output)
Hold Acknowledge; indicates that the CPU has received the Hold request and that it will relinquish the buses in the next clock cycle. HLDA goes low .after the Hold request is removed. The CPU takes the buses one half clock cycle after JHLDA goes low.
INTR (Input)
Interrupt Request; is used as a general purpose interrupt. It is sampled only during the next to the last clock cycle of the instruction If it is active the Program Counter (PC) will be inhibited from incrementing and an INTA will be issued. During this cycle a RESTART or CALL instruction an be inserted to jump to the interrupt service routine.
The INTR is enabled and disabled by software, it is disabled by Reset and immediately after an interrupt is accepted.
INTA (Output)
Interrupt Acknowledge; is used instead of (and has the same timing as) after an INTR is accepted the 8259 Interrupt chip or some other interrupt port.
Restart Interrupts
These three inputs have the same timing as I NTR except they cause an internal RESTART to be automatically inserted.
RST7.5: Highest Priority
RST6.5
RST5.5: Lowest Priority
The priority of these interrupts is ordere~d as shown above. These interrupts have a higher priority than the INTR.
TRAP (Input)
Trap interrupt is a non-maskable restart interrupt. It is recognized at the same time as INTR. It is unaffected by any mask or Interrupt Enable. It has the highest priority of any interrupt.
RESET IN (Input)
Reset sets the Program Counter to zero and resets the Interrupt Enable and HLDA flip-flops none of the other flags or registers (except the instrator register) arc affected The CPU is held in the resetioni as long as Reset is applied.
RESET OUT (Output)
Indicates microprocessor is being reset. Can be used as a system RESET. The signal is synchronized to the processor clock.
CLK (Output)
Clock Output for use as a system clock when a crystal or R/ C network isTjsed as an input to the CPU. The period of CLK is twice the X1 , X2 input period.
Interfacing in Microprocessors
- The computer simply performs a given task on specified data in response to a certain “Instructions’
- Each instruction contains two parts:
- Operation code (opcode)
- Operand
- The part of instruction which specifies the task to 3y the microprocessor is called “OPCODE”.
- The part of instruction in which the data to be operated on, is called “OPERAND”.
Instruction Cycle (IC)
- It is the time required by the microprocessor to complete the execution of an instruction.
- During this process, microprocessor reads opcodes from memory, decode the data and then execute the corresponding operation.
- “IC” consists of two cycles namely Fetch cycle (FC) and Execution cycle (EC).
i.e. IC = FC + EC
Fetch Cycle (FC)
In FC, a microprocessor fetches opcodes (the machine code of an instruction) from the memory.
Execution Cycle (EC)
After the FC completed, execution of corresponding operation begins.
Interfacing with the I/O Ports
- The locations or terminals from where data is taken into the MPU are called Input ports and locations to which data flows out of MPU are called output ports, combinedly they are called I/O ports.
- The two ways by which I/O port can be connected to the microprocessor is as following:
- Program controlled I/O (Pl/O).
- Memory mapped I/O.