Microprocessor. By: Dk Izzati binti Pg Haji Ahmad. 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 a computer system or handheld device consists of
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Microprocessor By: DkIzzatibinti Pg Haji Ahmad
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 a computer system or handheld device consists of one or more microprocessors. • Microprocessor is processing device of every computing device. It is like an artificial brain. It needs to communicate with outer world. • For example, It needs to communicate with Input devices to get data, it needs to communicate with memory to process data according to instructions written in memory and finally it needs to communicate with output devices to 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.
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.
List of the devices with microprocessors • Pocket Calculators • Digital Watches • Automatic tellers • Smart Telephones • Compact Disk Players • Home Security and Control devices • Realistic video games • Talking dolls and other toys • VCRs • Personal Computers
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.
Kinds of Processors • Hybrid processors • are some combination of CISC and RISC approaches, attempting to balance the advantages of each approach. • Special purpose processors • are optimized to perform specific functions. Digital signal processors and various kinds of co-processors are the most common kinds of special purpose processors.
Arithmetic and Logic Unit (ALU) Register Array Timing and Control unit Basic Block Diagram of Microprocessor The basic units or blocks of microprocessor are ALU, array of registers and control unit: ALU – Performs all arithmetic and logical operations Register array – Holds the data temporarily for processing Control Unit – It supervises/ monitors all the operations carried out in the computer
Intel 8085 Microprocessor Architecture 8-bit_Internal_databus Accumulator Temp. Reg Flag Reg Instruction Reg B C D E Arithmetic and Logic Unit H L Instruction decoder Stack Pointer Program Counter Incrementer/ Decrementer Address latch Address Buffer A8-A15 Data/address Buffer AD0-AD7 Timing and Control unit 8- bit External Data bus RAM memory Clock Write Read
Define the various registers • Accumulator– 8 bit register which holds the latest result from ALU • B, C, D, E, H and L are general purpose registers • HL paircan be used for indirect addressing as well • Program counter– 16 bit register which holds the address of the next instruction to be executed • Instruction register– It holds the instruction that is currently being processed. • Stack pointeris used during subroutine calling and execution. • Address Latch– It increments/ decrements the address before sent to the address buffer
Various Flags • Sign 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.
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.
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.
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 signal ALU (Address Latch Enable)- When ALU is high. 8085 microprocessor is use address bus. When ALU is low. 8085 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.
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.
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.
Pin Description • Serial I/O ports: • The 8085 microprocessor has two signals to implement the serial transmission serial input data and serial output data.
Microprocessor Operation • Fetch • Decode • Execute
Fetch – Execute Cycle Fetch Cycle • Fetch the Instruction from Main Memory The 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 Instruction The instruction decoder (ID) interprets and implements the instruction Execute Cycle • Get Data from Main Memory Fetch required data from main memory to be processed and placed into registers. • Execute the Instruction Control signals are initialized to process the data using ALU and write the result back to a register. • Store Results The result generated by the operation is stored in the main memory, or sent to an output device.
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.
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.
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.
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.
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.
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 only This 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.
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.
Opcodes are also given mnemonics (short names) so that they can be easily referred to in code listings and similar documentation.
Microprocessor understands Machine Language only! • Microprocessor cannot understand a program written in Assembly language • A program known as Assembler is used to convert a Assembly language program to machine language Assembly Language Program Assembler Program Machine Language Code
A Machine language program to add two numbers 00111110 ;Copy value 2H in register A 00000010 00000110 ;Copy value 4H in register B 00000100 10000000 ;A = A + B
Assembly Language of 8085 • It uses English like words to convey the action/meaning called as MNEMONICS • For e.g. • MOV to indicate data transfer • ADD to add two values • SUB to subtract two values
Assembly language program to add two numbers MVIA, 2H ;Copy value 2H in register A MVIB, 4H ;Copy value 4H in register B ADDB ;A = A + B Note: • Assembly language is specific to a given processor
Instruction Set of 8085 • Consists of • 74 operation codes, e.g. MOV • 246 Instructions, e.g. MOVA,B • 8085 instructions can be classified as • Data Transfer (Copy) instructions • Arithmetic instructions • Logical and Bit manipulation • Branching instructions • Machine Control instructions
Load a 8-bit number 4F in register B Copy from Register B to Register A Load a 16-bit number 2050 in Register pair HL Copy from Register B to Memory Address 2050 Copy between Input/Output Port and Accumulator MVIB, 4FH MOVA,B LXIH, 2050H MOVM,B OUT 01H IN 07H Example Data Transfer (Copy) Operations / Instructions
Add a 8-bit number 32H to Accumulator Add contents of Register B to Accumulator Subtract a 8-bit number 32H from Accumulator Subtract contents of Register C from Accumulator Increment the contents of Register D by 1 Decrement the contents of Register E by 1 ADI 32H ADDB SUI 32H SUB C INR D DCR E Example ArithmeticOperations / Instructions
Logically AND Register H with Accumulator Logically OR Register L with Accumulator Logically XOR Register B with Accumulator Compare contents of Register C with Accumulator ComplementAccumulator RotateAccumulator Left ANAH ORAL XRA B CMP C CMA RAL Example Logical & Bit ManipulationOperations / Instructions
Addressing Modes of 8085 • Addressing modes specify the way in which the address of the operand is given in the instruction. • Opcode[Operands] [;comments] E.g.: MVIB, 05: Here MVI (Move Immediate) is the opcode part and the rest is the operand part. MOVA , B : Here MOV is the opcode part and the rest is the operand part. ADDB : Here ADD is the opcode part and the rest is the operand part.
Addressing Modes of 8085 • The various formats of specifying operands are called addressing modes. • Addressing modes of 8085: • Register Addressing • Immediate Addressing • Memory Addressing • Input/Output Addressing
1. Register Addressing • In 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: MOVA, B ADDC
2. Immediate Addressing • In 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 itself • Examples: MVIA, 20H LXIH, 2050H ADI 30H SUI 10H
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 types • Direct addressing • Indirect addressing
3(a) Direct Addressing • In 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: LDA2050H ;load A with contents of memory location with address 2050H STA3050H ;store A with contents of memory location with address 3050H
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: MOVM, A;copy register A to memory location whose address is stored in register pair HL H L A 30H 20H 50H 30H 2050H
HL Register • The 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.
MOVInstruction • This 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:
MOVInstruction 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.
MVI Instruction • MVI: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)