Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Similar presentations

Presentation on theme: "Microprocessor By: Dk Izzati binti Pg Haji Ahmad."— Presentation transcript:

1 Microprocessor By: Dk Izzati binti Pg Haji Ahmad

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 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.

3 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.

4 Microcomputer Block Diagram

5 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

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 – 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.

8 Basic Block Diagram of Microprocessor Arithmetic and Logic Unit (ALU) Register Array Timing and Control unit 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

9 Flag RegInstruction Reg Instruction decoder Address Buffer A8-A15 BCBC DEDE HLHL Stack Pointer Program Counter Incrementer/ Decrementer Address latch Data/address Buffer AD0-AD7 Temp. RegAccumulator Arithmetic and Logic Unit Timing and Control unit RAM memory 8-bit_Internal_databus Intel 8085 Microprocessor Architecture 8- bit External Data bus ReadWriteClock

10 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 pair can 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 pointer is used during subroutine calling and execution. Address Latch – It increments/ decrements the address before sent to the address buffer

11 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 1s, 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.

13 Machine Cycles & Timing of 8085

14 Pin Diagram of a Basic 8085 Microprocessor

15 Pin Description All the signal can be classified into six groups: 1.Address Bus: The 8085 microprocessor has 8 signal line, A 15 - A 8 which are unidirectional & used as a high order address bus. 2.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 3.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 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. S 1 and S 0 - 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 4.Power Supply and Frequency signal: V cc - +5v power supply. V ss - 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 5.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 6.Serial I/O ports: The 8085 microprocessor has two signals to implement the serial transmission serial input data and serial output data.

20 Microprocessor Operation Fetch Decode Execute

21 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.

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.

27 Understanding Assembly Language program

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 0s and 1s 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.

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.

31 Examples OpcodeOperand MOVC, A ADDB MVIA, 32H MVIB, F2H

32 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

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 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

35 Assembly language program to add two numbers MVI A, 2H;Copy value 2H in register A MVI B, 4H;Copy value 4H in register B ADD B;A = A + B Note: 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,B 8085 instructions can be classified as 1.Data Transfer (Copy) instructions 2.Arithmetic instructions 3.Logical and Bit manipulation 4.Branching instructions 5.Machine Control instructions

37 Example Data Transfer (Copy) Operations / Instructions 1.Load a 8-bit number 4F in register B 2.Copy from Register B to Register A 3.Load a 16-bit number 2050 in Register pair HL 4.Copy from Register B to Memory Address Copy between Input/Output Port and Accumulator MVI B, 4FH MOV A,B LXI H, 2050H MOV M,B OUT 01H IN 07H

38 Example Arithmetic Operations / Instructions 1.Add a 8-bit number 32H to Accumulator 2.Add contents of Register B to Accumulator 3.Subtract a 8-bit number 32H from Accumulator 4.Subtract contents of Register C from Accumulator 5.Increment the contents of Register D by 1 6.Decrement the contents of Register E by 1 ADI 32H ADD B SUI 32H SUB C INR D DCR E

39 Example Logical & Bit Manipulation Operations / Instructions 1.Logically AND Register H with Accumulator 2.Logically OR Register L with Accumulator 3.Logically XOR Register B with Accumulator 4.Compare contents of Register C with Accumulator 5.Complement Accumulator 6.Rotate Accumulator Left ANA H ORA L XRA B CMP C CMA RAL

40 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.: 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 The various formats of specifying operands are called addressing modes. Addressing modes of 8085: 1.Register Addressing 2.Immediate Addressing 3.Memory Addressing 4.Input/Output Addressing Addressing Modes of 8085

42 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 Examples: MOV A, B ADD C

43 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: MVI A, 20H LXI H, 2050H ADI 30H SUI 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 types – Direct addressing – Indirect addressing

45 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: LDA 2050H ;load A with contents of memory location with address 2050H STA 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 HL 30H A 20H H 50H L 30H 2050H

47 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.

48 MOV Instruction 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:

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 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)

51 4. Input/Output Addressing 8-bit address of the port is directly specified in the instruction Examples: IN 07H OUT 21H

52 5. Instruction & Data Formats 8085 Instruction set can be classified according to size (in bytes) as 1.1-byte Instructions 2.2-byte Instructions 3.3-byte Instructions

53 1. One-byte Instructions Includes Opcode and Operand in the same byte Examples: OpcodeOperandBinary Code Hex Code Task MOVC, A FH Copy the contents of the accumulator in the register C. ADDB H Add the contents of register B to the contents of the accumulator. HLT H

54 2. Two-byte Instructions First byte specifies Operation Code Second byte specifies Operand Examples: OpcodeOperandBinary CodeHex Code MVIA, 32H EH 32H MVIB, F2H H F2H

55 3. Three-byte Instructions First byte specifies Operation Code Second & Third byte specifies Operand Examples: OpcodeOperandBinary CodeHex Code LXIH, 2050H H 50H 20H LDA3070H AH 70H 30H

56 An example assembly language program Address Instruction 202AMVIA, 21;Copies 21 into accumulator 202CMVIB, 2A;Copies 2A into B register 202EADDB;Adds B reg content with Acc and stores the result in Acc. 202FSTA41 FF; Stores the Acc (the sum) into the memory location 41 FF. 2032HLT; Stops the program

57 Another example assembly language program Address Instruction 2020MVIB, 24;Copies 24 into accumulator 2022INRB;Increment B reg content by MOVA, B;Copies B register into Acc. 2024SUBB;Subtracts B reg content from Acc and stores the result in Acc. 2025STA5F FF; Stores the Acc content into the memory location 5F FF. 2028HLT; Stops the program

Download ppt "Microprocessor By: Dk Izzati binti Pg Haji Ahmad."

Similar presentations

Ads by Google