2 What is a Microprocessor? A microprocessor is a digital electronic component with transistors on a single semiconductor integrated circuit (IC).A Central processing unit (CPU) in acomputer system or handheld device consists ofone or more microprocessors.Microprocessor is processing device of everycomputing device. It is like an artificial brain. Itneeds to communicate with outer world.For example, It needs to communicate with Inputdevices to get data, it needs to communicate with memoryto process data according to instructions written in memoryand finally it needs to communicate with output devicesto display the output.To communicate with external world, Microprocessor make use of buses.A bus is a group of conducting lines that carries data, address and control signals.
3 There are three microprocessor buses There are three microprocessor buses . They are the address bus, data bus and control bus:Address bus: used to specify a physical memory address. This can include primary memory (e.g. RAM and ROM) secondary memory (e.g. hard disk drives) and any other connected devices. Monitors, printers, scanners, and keyboards will all be mapped to memory.The width of the address bus determines the amount of memory that can be addressed. A 32-bit bus can address 4,294,967,296 (2 ^ 32) bytes of memory. This explains the 4 GB memory restriction on 32-bit operating systems.Data bus: connects the microprocessor (CPU) with other devices mapped onto the system. This is often described pictorially using a memory map.Unlike the address bus, the data bus is bi-directional (it supports read and write operations). The data bus is not limited to transferring data; it is also used to transfer program instructions.Control bus: carries commands from and returns status signals to the microprocessor. The control unit inside a CPU manages the internal control bus — internal to the CPU — and the external control bus.
5 List of the devices with microprocessors Pocket CalculatorsDigital WatchesAutomatic tellersSmart TelephonesCompact Disk PlayersHome Security and Control devicesRealistic video gamesTalking dolls and other toysVCRsPersonal Computers
6 Kinds of Processors Complex Instruction Set Computers (CISC) have a large instruction set, with hardware support for a wide variety of operations. In scientific, engineering, and mathematical operations with hand coded assembly language (and some business applications with hand coded assembly language), CISC processors usually perform the most work in the shortest time.These types of processors are used in desktops, laptops and servers.Reduced Instruction Set Computers (RISC)have a small, compact instruction set. In most business applications and in programs created by compilers from high level language source, RISC processors usually perform the most work in the shortest time.These types of processors are commonly used in ovens, air conditioners, etc.
7 Kinds of Processors Hybrid processors Special purpose processors are some combination of CISC and RISC approaches, attempting to balance the advantages of each approach.Special purpose processorsare optimized to perform specific functions. Digital signal processors and various kinds of co-processors are the most common kinds of special purpose processors.
8 Basic Block Diagram of Microprocessor Arithmetic and Logic Unit (ALU)Register ArrayTiming and Control unitThe basic units or blocks of microprocessor are ALU, array of registers and control unit:ALU – Performs all arithmetic and logical operationsRegister array – Holds the data temporarily for processingControl Unit – It supervises/ monitors all the operations carried out in the computer
9 Intel 8085 Microprocessor Architecture 8-bit_Internal_databusAccumulatorTemp. RegFlag RegInstruction RegB CD EArithmetic and Logic UnitH LInstruction decoderStack PointerProgram CounterIncrementer/ DecrementerAddress latchAddress Buffer A8-A15Data/address Buffer AD0-AD7Timing and Control unit8- bit External Data busRAM memoryClockWriteRead
10 Define the various registers Accumulator – 8 bit register which holds the latest result from ALUB, C, D, E, H and L are general purpose registersHL pair can be used for indirect addressing as wellProgram counter – 16 bit register which holds the address of the next instruction to be executedInstruction register – It holds the instruction that is currently being processed.Stack pointer is used during subroutine calling and execution.Address Latch – It increments/ decrements the address before sent to the address buffer
11 Various FlagsSign Flag: If the result of the latest arithmetic operation is having MSB ‘1’ (meaning it is a negative number), then the sign flag is set. Otherwise, it is reset to ‘0’ which means it is a positive number.Zero flag: If the result of the latest operation is zero, then zero flag will be set; otherwise it be reset.Auxiliary Carry Flag: This flag is not accessible to programmer. This flag will be used by the system during BCD operations.Parity Flag: If the result of the latest operation is having even number of ‘1’s, then this flag will be set. Otherwise this will be reset to ‘0’. This is used for error checking.Carry Flag: If the result of the latest operations exceeds 8-bits then this flag will be set. Otherwise it be reset.
12 Machine Cycles & Timing of 8085 Timing Diagram:a graphical representation. It represents the execution time taken by each instruction in a graphical format. The execution time is represented in T-states.Instruction Cycle:the time required to execute an instruction is called an instruction cycle.Machine Cycle:the time required to access the memory or input/output devices is called machine cycle.T-State:the machine cycle and instruction cycle takes multiple clock periods. A portion of an operation carried out in one system clock period is called as T-State.
15 Pin Description All the signal can be classified into six groups: Address Bus:The 8085 microprocessor has 8 signal line, A15 - A8 which are unidirectional & used as a high order address bus.Data Bus:The signal line AD7 - AD0 are bidirectional for dual purpose. They are used as low order address bus as well as data bus.
16 Pin Description Control signal and Status signal: Control Signal RD bar - It is a read control signal (active low). It is active then memory read the data.WR bar - It is write control signal (active low). It is active when written into selected memory.Status signalALU (Address Latch Enable) - When ALU is high microprocessor is use address bus. When ALU is low microprocessor is use data bus.IO/M bar - This is a status signal used to differentiate between i/o and memory operation. When it is high, it indicate an i/o operation and low, it indicate memory operation.S1 and S0 - These status signal, similar to i/o and memory bar, can identify various operation, but they are rarely used in small system.
17 Pin Description Power Supply and Frequency signal: Vcc - +5v power supply.Vss - ground reference.X, X - A crystal is connected at these two pins. The frequency is internally divided by two operate system at 3-MHz, the crystal should have a frequency of 6-MHz.CLK out - This signal can be used as the system clock for other devices.
18 Pin Description Externally initiated signal: INTR(i/p) - Interrupt request.INTA bar (o/p) - It is used as acknowledge interrupt.TRAP(i/p) - This is non maskable interrupt and has highest priority.HOLD(i/p) - It is used to hold the executing program.HLDA(o/p) - Hold acknowledge.READY(i/p) - This signal is used to delay the microprocessor read or write cycle until a slow responding peripheral is ready to accept or send data.RESET IN bar - When the signal on this pin goes low, the program counter is set to zero, the bus are tri-stated, & MPU is reset.RESET OUT - This signal indicate that MPU is being reset. The signal can be used to reset other devices.RST 7.5, RST 6.5, RST 5.5 (Request interrupt) - It is used to transfer the program control to specific memory location. They have higher priority than INTR interrupt.
19 Pin Description Serial I/O ports: The 8085 microprocessor has two signals to implement the serial transmission serial input data and serial output data.
21 Fetch – Execute Cycle Fetch Cycle Fetch the Instruction from Main MemoryThe CPU presents the value of the program counter on the address bus. The CPU then fetches the instruction from main memory via the data bus into the Instruction Register.Decode the InstructionThe instruction decoder (ID) interprets and implements the instructionExecute CycleGet Data from Main MemoryFetch required data from main memory to be processed and placed into registers.Execute the InstructionControl signals are initialized to process the data using ALU and write the result back to a register.Store ResultsThe result generated by the operation is stored in the main memory, or sent to an output device.
22 Semiconductor Memories What is Semiconductor memory?A device for storing digital information that is fabricated by using integrated circuit technology.Semiconductor memory technology is an essential element of today's electronics.Indeed as processors have become more popular and the number of microprocessor controlled items has increased so has the requirement for semiconductor memory.With the rapid growth in the requirement for semiconductor memories there have been a number of technologies and types of memory that have emerged. Names such as ROM, RAM, EPROM, EEPROM, Flash memory, DRAM, SRAM, SDRAM, and the very new MRAM can now be seen in the electronics literature.Each one has its own advantages and area in which it may be used.
23 Semiconductor Memories RAM - Random Access Memory: As the names suggest, the RAM or random access memory is a form of semiconductor memory technology that is used for reading and writing data in any order as required. It is used for such applications as the computer or processor memory where variables and other stored and are required on a random basis. Data is stored and read many times to and from this type of memory.ROM - Read Only Memory: A ROM is a form of semiconductor memory technology used where the data is written once and then not changed. In view of this it is used where data needs to be stored permanently, even when the power is removed - many memory technologies lose the data once the power is removed.PROM: This stands for Programmable Read Only Memory. It is a semiconductor memory which can only have data written to it once - the data written to it is permanent. These memories are bought in a blank format and they are programmed using a special PROM programmer. Typically a PROM will consist of an array of fuseable links some of which are "blown" during the programming process to provide the required data pattern.
24 EPROM: This is an Erasable Programmable Read Only Memory. This form of semiconductor memory can be programmed and then erased at a later time. This is normally achieved by exposing the silicon to ultraviolet light. To enable this to happen there is a circular window in the package of the EPROM to enable the light to reach the silicon of the chip. When the PROM is in use, this window is normally covered by a label, especially when the data may need to be preserved for an extended period.EEPROM: This is an Electrically Erasable Programmable Read Only Memory. Data can be written to it and it can be erased using an electrical voltage. This is typically applied to an erase pin on the chip. Like other types of PROM, EEPROM retains the contents of the memory even when the power is turned off. Also like other types of ROM, EEPROM is not as fast as RAM.
25 Flash Memory:Flash memory may be considered as a development of EEPROM technology. Data can be written to it and it can be erased, although only in blocks, but data can be read on an individual cell basis. To erase and re-programme areas of the chip, programming voltages at levels that are available within electronic equipment are used. It is also non-volatile, and this makes it particularly useful. As a result Flash memory is widely used in many applications including memory cards for digital cameras, mobile phones, computer memory sticks and many other applications.DRAM: Dynamic RAM is a form of random access memory. DRAM uses a capacitor to store each bit of data, and the level of charge on each capacitor determines whether that bit is a logical 1 or 0. However these capacitors do not hold their charge indefinitely, and therefore the data needs to be refreshed periodically. As a result of this dynamic refreshing it gains its name of being a dynamic RAM. DRAM is the form of semiconductor memory that is often used in equipment including personal computers and workstations where it forms the main RAM for the computer.
26 SRAM: Static Random Access Memory. This form of semiconductor memory gains its name from the fact that, unlike DRAM, the data does not need to be refreshed dynamically. It is able to support faster read and write times than DRAM (typically 10 ns against 60 ns for DRAM), and in addition its cycle time is much shorter because it does not need to pause between accesses. However it consumes more power, is less dense and more expensive than DRAM. As a result of this it is normally used for caches, while DRAM is used as the main semiconductor memory technology.SDRAM: Synchronous DRAM. This form of semiconductor memory can run at faster speeds than conventional DRAM. It is synchronised to the clock of the processor and is capable of keeping two sets of memory addresses open simultaneously.MRAM: This is Magneto-resistive RAM, or Magnetic RAM. It is a non-volatile RAM memory technology that uses magnetic charges to store data instead of electric charges. Unlike technologies including DRAM, which require a constant flow of electricity to maintain the integrity of the data, MRAM retains data even when the power is removed. An additional advantage is that it only requires low power for active operation. As a result this technology could become a major player in the electronics industry now that production processes have been developed to enable it to be produced.
28 Instruction A microprocessor executes instructions given by the user. Instructions should be in a language known to the microprocessor.Microprocessor understands the language of 0’s and 1’s onlyThis language is called Machine Language.An instruction is a binary pattern designed inside a microprocessor to perform a specific function .Intel 8085 has 246 instructions.Each instruction is represented by an 8-bit binary value.
29 The instruction set is a collection of pre-defined machine codes, which the CPU is designed to expect and be able to act upon when detected.Each machine code of an instruction set consists of two separate fields:The opcode is a short code which indicates what operation is expected to be performed. Each operation has a unique opcode.The operand, or operands, indicate where the data required for the operation can be found and how it can be accessed (the addressing mode, which is discussed in full later).The length of a machine code can vary - common lengths vary from one to twelve bytes in size.
30 Opcodes are also given mnemonics (short names) so that they can be easily referred to in code listings and similar documentation.
32 Microprocessor understands Machine Language only! Microprocessor cannot understand a program written in Assembly languageA program known as Assembler is used to convert a Assembly language program to machine languageAssemblyLanguageProgramAssemblerProgramMachineLanguageCode
33 A Machine language program to add two numbers ;Copy value 2H in register A;Copy value 4H in register B;A = A + B
34 Assembly Language of 8085It uses English like words to convey the action/meaning called as MNEMONICSFor e.g.MOV to indicate data transferADD to add two valuesSUB to subtract two values
35 Assembly language program to add two numbers MVI A, 2H ;Copy value 2H in register AMVI B, 4H ;Copy value 4H in register BADD B ;A = A + BNote:Assembly language is specific to a given processor
36 Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV 246 Instructions, e.g. MOV A,B8085 instructions can be classified asData Transfer (Copy) instructionsArithmetic instructionsLogical and Bit manipulationBranching instructionsMachine Control instructions
37 Example Data Transfer (Copy) Operations / Instructions Load a 8-bit number 4F in register BCopy from Register B to Register ALoad a 16-bit number 2050 in Register pair HLCopy from Register B to Memory Address 2050Copy between Input/Output Port and AccumulatorMVI B, 4FHMOV A,BLXI H, 2050HMOV M,BOUT 01HIN 07H
38 Example Arithmetic Operations / Instructions Add a 8-bit number 32H to AccumulatorAdd contents of Register B to AccumulatorSubtract a 8-bit number 32H from AccumulatorSubtract contents of Register C from AccumulatorIncrement the contents of Register D by 1Decrement the contents of Register E by 1ADI 32HADD BSUI 32HSUB CINR DDCR E
39 Example Logical & Bit Manipulation Operations / Instructions Logically AND Register H with AccumulatorLogically OR Register L with AccumulatorLogically XOR Register B with AccumulatorCompare contents of Register C with AccumulatorComplement AccumulatorRotate Accumulator LeftANA HORA LXRA BCMP CCMARAL
40 Addressing Modes of 8085Addressing modes specify the way in which the address of the operand is given in the instruction. Opcode [Operands] [;comments] E.g.: MVI B, 05 : Here MVI (Move Immediate) is the opcode part and the rest is the operand part. MOV A , B : Here MOV is the opcode part and the rest is the operand part. ADD B : Here ADD is the opcode part and the rest is the operand part.
41 Addressing Modes of 8085The various formats of specifying operands are called addressing modes.Addressing modes of 8085:Register AddressingImmediate AddressingMemory AddressingInput/Output Addressing
42 1. Register AddressingIn this addressing mode, a register contains the operand. Depending upon the instruction, the register may be the first operand, the second operand or both.Operands are one of the internal registers of 8085.Examples:MOV A, BADD C
43 2. Immediate AddressingIn the immediate addressing mode, direct data is given in the operand which move the data in accumulator. It is very fast.Value of the operand is given in the instruction itselfExamples:MVI A, 20HLXI H, 2050HADI 30HSUI 10H
44 3. Memory Addressing One of the operands is a memory location Depending on how address of memory location is specified, memory addressing is of two typesDirect addressingIndirect addressing
45 3(a) Direct AddressingIn the direct addressing mode, address of the operand is given in the instruction and data is available in the memory location which is provided in instruction. We will move this data in desired location.16-bit Address of the memory location is specified in the instruction directly.Examples:LDA 2050H ;load A with contents of memory location with address 2050HSTA 3050H ;store A with contents of memory location with address 3050H
46 3(b) Indirect Addressing In the indirect addressing mode, the instruction specifies a register which contain the address of the operand. Both internal RAM and external RAM can be access via indirect addressing mode.A memory pointer register is used to store the address of the memory location.Example:MOV M, A ;copy register A to memory location whose address is stored in register pair HLHLA30H20H50H2050H30H
47 HL RegisterThe HL register is the only register that can be used to specify a memory address.It is called a pointer register because it points to a memory location.The H register contains the high byte of the address, and the L register the low byte.High and low bytes may be unfamiliar to you. Consider the decimal number 47. From convention we know that 4 is the number of "tens", and the 7 is the number of "units", high and then low.For the hex number 47, 4 is the number of "sixteens", and 7 is the number of "units".In the same way for the number 4768, 47 is the number of "two-hundred-fifty-sixes", and 68 is the number of "units".We split it this way because the first two digits can fit in the high byte (register) and the second two can fit in the low register.
48 MOV InstructionThis instruction is used to copy the data from one place to another.The MOV instruction takes two operands.Syntax:Syntax of the MOV instruction is:The MOV instruction may have one of the following five forms:
49 MOV Instruction Examples: MOV Rd, Rs (This instruction copies the content of Rs to Rd)MOV M, Rs (This instruction copies the content of register Rs to memory location pointed by HL Register)MOV Rd, M (This instruction copies the content of memory location pointed by the HL register to the register Rd.)*Note: the contents of the source register are not altered.
50 MVI InstructionMVI: move immediate date to a register or memory location.Examples:MVI Rd, #30H (30h is stored in register Rd)MVI M, #30H (30h is stored in memory location pointed by HL Reg)
51 4. Input/Output Addressing 8-bit address of the port is directly specified in the instructionExamples:IN 07HOUT 21H
52 5. Instruction & Data Formats 8085 Instruction set can be classified according to size (in bytes) as1-byte Instructions2-byte Instructions3-byte Instructions
53 1. One-byte Instructions Includes Opcode and Operand in the same byteExamples:OpcodeOperandBinary CodeHex CodeTaskMOVC, A4FHCopy the contents of the accumulator in the register C.ADDB80HAdd the contents of register B to the contents of the accumulator.HLT76H
55 3. Three-byte Instructions First byte specifies Operation CodeSecond & Third byte specifies OperandExamples:OpcodeOperandBinary CodeHex CodeLXIH, 2050H21H50H20HLDA3070H3AH70H30H
56 An example assembly language program Address Instruction202A MVI A, 21 ;Copies 21 into accumulator202C MVI B, 2A ;Copies 2A into B register202E ADD B ;Adds B reg content with Acc and stores the result in Acc.202F STA 41 FF ; Stores the Acc (the sum) into the memory location 41 FF.2032 HLT ; Stops the program
57 Another example assembly language program Address Instruction2020 MVI B, 24 ;Copies 24 into accumulator2022 INR B ;Increment B reg content by 12023 MOV A, B ;Copies B register into Acc.2024 SUB B ;Subtracts B reg content from Acc and stores the result in Acc.2025 STA 5F FF ; Stores the Acc content into the memory location 5F FF.2028 HLT ; Stops the program