string(20) ‘ the picture a bit\. ‘
MICROPROCESSOR 8085 • Reference point Book: – Ramesh S i9000. Goankar, “Microprocessor Architecture, Coding and Applications with 8085”, 5th Release, Prentice Hall • Week 1 – Basic Principle and Concepts about Microprocessor. • Week 2 , Architecture of 8085 • Week several , Responding to Modes and Instruction set of 8085 • Week four – Interrupts of 8085 • Week 5 onwards – Peripherals.
Basic Principles of Microprocessors • Distinctions between: – Microcomputer – a computer having a microprocessor as the CPU. Contains memory, I/O etc . Processor – si chip which includes ALU, enroll circuits , control circuits – Microcontroller – silicon chip which include microprocessor, memory , I/O in a single package deal. What is a Microprocessor? • The term comes from the combination micro and cpu. – Processor chip means a tool that operations whatever. In this context processor chip means a tool that processes numbers, especially binary quantities, 0’s and 1’s. • To process means to change. It is a standard term that describes most manipulation. Again in this articles, it means to perform certain operations on the quantities that be based upon the microprocessor’s design.
How about micro? • Micro is a new addition. – In the late 1960’s, processors had been built employing discrete factors. • These devices performed the mandatory operation, although were too big and not fast enough. – In the early 70’s the microchip was invented. All of the components that made-up the cpu were today placed on just one piece of si. The size started to be several thousand times smaller plus the speed became several hundred times faster. The “Micro”Processor came to be. Was generally there ever a “mini”processor? • No . – It gone directly from under the radar elements to a single processor chip. However , omparing today’s microprocessors to the types built in the early 1970’s you will find an extreme embrace the amount of integration. • So , What is a processor? Definition of the Microprocessor The microprocessor is a programmable unit that takes in numbers, performs on them arithmetic or reasonable operations in line with the program stored in memory and then produces different numbers consequently. Definition (Contd. ) • Lets broaden each of the underlined words: – Programmable unit: The microprocessor can perform several sets of operations for the data it receives depending on the sequence of instructions delivered in the presented program.
By simply changing the program, the processor manipulates the data in different methods. – Recommendations: Each microprocessor is designed to execute a specific selection of operations. This kind of group of operations is called a great instruction set. This teaching set defines what the microprocessor can and cannot carry out. Definition (Contd. ) – Takes in: The information that the microprocessor manipulates must come from somewhere. • It is about from what is called “input devices”. • These are gadgets that take data in the system externally world. • These symbolize devices for example a keyboard, a mouse, buttons, and the like.
Description (Contd. ) – Figures: The microprocessor has a incredibly narrow approach to life. That only understands binary numbers. A binary digit is called a bit (which comes from binary digit). The microprocessor recognizes and processes a group of parts together. This group of pieces is called a “word”. The number of bits within a Microprocessor’s expression, is a way of measuring its “abilities”. Definition (Contd. ) – Words, Bytes, etc . • The earliest microprocessor (the Intel 8088 and Motorola’s 6800) recognized 8-bit words. – They processed information 8-bits at a time. For this reason they are named “8-bit processors”.
They can manage large numbers, in order to process these amounts, they out of cash them in 8-bit items and highly processed each group of 8-bits separately. • Later microprocessors (8086 and 68000) were built with 16-bit phrases. – A team of 8-bits were referred to as a “half-word” or “byte”. – A group of 5 bits is named a “nibble”. – As well, 32 bit groups were given the term “long word”. • Today, all processors manipulate for least thirty-two bits at any given time and there is certainly microprocessors that may process 64, 80, 128 bits Definition (Contd. ) – Arithmetic and Logic Operations: Every microprocessor provides arithmetic operations such as add and take away as part of the instruction arranged. – Many microprocessors could have operations such as multiply and divide. – Some of the more recent ones will have complex operations such as sq root. • In addition , microprocessors have common sense operations as well. Such as AND, OR, XOR, shift remaining, shift correct, etc . • Again, the number and types of operations define the microprocessor’s teaching set and depends on the certain microprocessor. Classification (Contd. ) – Trapped in memory: • First, precisely what is memory? – Memory is a location where information can be kept whilst in current use. Memory is a assortment of storage devices. Usually, every storage device keeps one bit. Also, in most kinds of storage, these safe-keeping devices will be grouped in to groups of 8. These almost eight storage places can only be accessed with each other. So , you can only go through or create in terms of octet to and form memory space. – Memory space is usually measured by the volume of bytes it could hold. It really is measured in Kilos, Megas and these days Gigas. A Kilo in computer terminology is 210 =1024. Therefore , a KB (KiloByte) is usually 1024 octet. Mega is 1024 Kgs and Giga is 1024 Mega. Classification (Contd. ) – Kept in memory: • When a plan is entered into a computer, it really is stored in memory.
Then because the microprocessor starts to do the guidelines, it brings the guidelines from recollection one at a time. • Memory is also used to contain the data. – The microprocessor reads (brings in) the info from memory when it demands it and writes (stores) the results into memory when it is carried out. Definition (Contd. ) – Produces: Intended for the user to start to see the result of the execution in the program, the results should be presented in a human understandable form. • The effects must be presented on an end result device. • This can be the monitor, a paper in the printer, an easy LED or many other varieties. A Microprocessor-based system
From the above description, we can draw the next block plan to represent a microprocessor-based system: Input End result Memory Inside Microprocessor • Internally, the microprocessor consist of 3 key units. – The Arithmetic/Logic Unit (ALU) – The Control Device. – Numerous registers for holding info while it has been manipulated. Firm of a microprocessorbased system • Let’s increase the picture a little.
It provides this information to the processor whenever it is needed. • Usually, there is also a memory “sub-system” in a microprocessor-based system. This kind of sub-system includes: – The registers within the microprocessor – Read Just Memory (ROM) • accustomed to store information that does not alter. – Random Access Storage (RAM) (also known as Read/Write Memory). • used to shop information supplied by the user. Including programs and data. Memory space Map and Addresses • The storage map can be described as picture representation of the addresses range and shows where different memory space chips are located within the treat range. 1000 0000 EPROM 3FFF 4400 Address Variety of EPROM Computer chip Address Range RAM 1 RAM 2 RAM three or more Address Selection of 1st MEMORY Chip 5FFF 6000 Talk about Range of second RAM Computer chip 8FFF 9000 A3FF A400 Address Array of 3rd RAM MEMORY Chip RAM MEMORY 4 F7FF FFFF Address Range of 4th RAM Computer chip Memory • To execute a program: – the user goes in its recommendations in binary format in to the memory. – The microprocessor then states these guidelines and what ever data is necessary from memory space, executes the instructions and places the results possibly in memory space or generates it on an output system. The three pattern instruction execution model To execute a program, the processor “reads” every single instruction coming from memory, “interprets” it, then simply “executes” that. • To work with the right brands for the cycles: – The microprocessor fetches every single instruction, – decodes that, – Then executes it. • This kind of sequence is continued until every instructions happen to be performed. Machine Language • The number of bits that constitute the “word” of any microprocessor is fixed for the particular processor. – These kinds of bits determine a most of mixtures. • By way of example an 8-bit microprocessor can have at most of the 28 = 256 diverse combinations. Yet , in most microprocessors, not all of these combinations are used. – Specific patterns will be chosen and assigned certain meanings. – Each of these patterns forms an instruction pertaining to the processor. – The whole set of patterns makes up the microprocessor’s equipment language. The 8085 Machine Language • The 8085 (from Intel) is a great 8-bit processor. – The 8085 uses a total of 246 bit patterns to form its teaching set. – These 246 patterns symbolize only 74 instructions. • The reason for the difference is that several (actually most) instructions have got multiple diverse formats. Because it is very difficult to enter the bit habits correctly, they are generally entered in hexadecimal instead of binary. • For example , the combination 0011 1100 which will translates into “increment the number in the register named the accumulator”, is usually moved into as 3C. Assembly Vocabulary • Going into the guidance using hexadecimal is quite simpler than going into the binary combinations. – However , that still is difficult to understand what a course written in hexadecimal really does. – Therefore , each organization defines a symbolic code for the instructions. – These requirements are called “mnemonics”. The mnemonic for each instruction is usually a selection of letters that suggest the operation performed. Assembly Terminology • Making use of the same model from before, – 00111100 translates to 3C in hexadecimal (OPCODE) – Its mnemonic is: “INR A”. – INR stands for “increment register” and A is short for accumulator. • An additional example can be: 1000 0000, – Which in turn translates to eighty in hexadecimal. – The mnemonic can be “ADD B”. – “Add register N to the accumulator and keep the result in the accumulator”. Assembly Dialect • It is important to remember that a machine terminology and its linked assembly language are entirely machine centered. In other words, they are not transferable from one processor to a different one. • For instance , Motorolla comes with an 8-bit microprocessor called the 6800. – The 8085 machine dialect is very not the same as that of the 6800. Thus is the assembly language. – A program drafted for the 8085 cannot be executed on the 6800 and vice versa. “Assembling” The Program • How does assembly language receive translated in machine language? – You will find two ways: – 1st there is certainly “hand assembly”. • The programmer means each set up language training into its comparable hexadecimal code (machine language).
Then the hexadecimal code is usually entered into recollection. – The other opportunity is a plan called a great “assembler”, which will does the translation automatically. 8085 Microprocessor Buildings • • • • • • 8-bit general purpose µp Capable of responding to 64 k of memory Has forty five pins Requires +5 sixth is v power supply May operate with 3 MHz clock 8085 upward appropriate Pins Power Supply: +5 Versus Frequency Electrical generator is connected to those pins Input/Output/ Recollection Read Write Multiplexed Treat Data Coach Address latch Enable Addresses Bus • System Coach – wires connecting memory , I/O to microprocessor – Treat Bus Unidirectional • Determining peripheral or memory location – Info Bus • Bidirectional • Transferring info – Control Bus • Synchronization signs • Time signals • Control sign Architecture of Intel 8085 Microprocessor Intel 8085 Microprocessor • Microprocessor consists of: – – – – – Control device: control microprocessor operations. BAUXITE: performs data processing function. Registers: present storage inside to CPU. Interrupts Inside data shuttle bus The ALUMINE • In addition to the arithmetic , logic circuits, the ALUMINE includes the accumulator, which is part of every single arithmetic , logic procedure. Also, the ALU incorporates a temporary enroll used for keeping data in the short term during the performance of the procedure. This temporary register is definitely not accessible by the developer. • Registers – Practical Registers • B, C, D, Electronic, H , L (8 bit registers) • Can be used singly • Or can be utilized as 18 bit register pairs – BC, DE, HL • H , L can be used as a info pointer (holds memory address) – Unique Purpose Registers • Accumulator (8 bit register) – Store almost eight bit data – Shop the result of surgery – Retail store 8 bit data during I/O copy Accumulator Flags B C D E H D Program Countertop Stack Pointer Address six 8 Info • Banner Register – 8 bit register – shows the status with the microprocessor before/after an operation – S (sign flag), Unces (zero flag), AC (auxillary carry flag), P (parity flag) , CY (carry flag) D7 S D6 Z D5 X D4 AC D 3 X D2 P D1 X D0 CY – Sign Flag • Employed for indicating the sign with the data in the accumulator • The indication flag is defined if adverse (1 – negative) • The indication flag is usually reset if perhaps positive (0 –positive) • Zero Banner – Is set if consequence obtained after an operation is 0 – Is set pursuing an increase or decrement operation of the register 10110011 + 01001101 , , , , , you 00000000 • Carry Banner Is set if there is a take or steal arithmetic procedure 1011 0101 + 0110 1100 , , , , , Carry 1 0010 0001 1011 0101 , 1100 1100 , , , , , Borrow you 1110 one thousand one • Auxillary Carry Flag – Is placed if there is a carry out of bit several • Parity Flag – Is set in the event that parity is even – Is cleaned if parity is odd The Internal Structure • We have already reviewed the general goal registers, the Accumulator, plus the flags. • The Program Counter (PC) – This is a register that is used to control the sequencing in the execution of instructions. – This sign-up always keeps the addresses of the next instruction. Because it holds an address, it must be 16 bits wide. The Internal Architecture • The Bunch pointer – The bunch pointer is additionally a 16-bit register which is used to level into storage. – The memory this register take into account is a unique area known as the bunch. – The stack is definitely an area of memory used to hold info that will be retreived soon. – The collection is usually accessed in a Previous In First Out (LIFO) fashion. Non Programmable Signs up • Instructions Register , Decoder – Instruction can be stored in IR after fetched by cpu – Decoder decodes instructions in IRGI Internal Time generator – 3. 125 MHz inside – 6th. 5 Megahertz externally The Address and Data Busses • The address coach has almost eight signal lines A8 – A15 that happen to be unidirectional. • The various other 8 treat bits happen to be multiplexed (time shared) together with the 8 data bits. – So , the bits AD0 – AD7 are bi-directional and function as A0 – A7 and D0 – D7 concurrently. • Through the execution with the instruction, these lines take the address bits during the early part, after that during the later parts of the execution, they will carry the eight data parts. – To be able to separate the address from the data, we are able to use a latch to save the value before the function of the pieces changes. Demultiplexing AD7-AD0 From the above description, it might be obvious that the AD7– AD0 lines are serving a dual purpose and they need to be demultiplexed to obtain all the information. – The large order components of the addresses remain on the bus for 3 clock durations. However , the reduced order pieces remain intended for only one time period plus they would be lost if they are not saved outwardly. Also, observe that the low buy bits of the address vanish when they are required most. – To make sure we now have the entire addresses for the complete three time cycles, all of us will use another latch just to save the value of AD7– AD0 launched carrying the address parts.
We utilize the ALE transmission to enable this latch. Demultiplexing AD7-AD0 8085 A15-A8 ALE AD7-AD0 Latch A7- A0 D7- D0 – Considering the fact that ALE functions as a pulse during T1, we will be capable to latch the address. Then when ALE should go low, the address is definitely saved and the AD7– AD0 lines can be utilised for their purpose as the bi-directional info lines. Demultiplexing the Tour bus AD7 – AD0 • • • • The high purchase address is positioned on the addresses bus and hold pertaining to 3 clk periods, The reduced order treat is dropped after the first clk period, this talk about needs to be keep however we should use latch The treat AD7 – AD0 is usually connected as inputs for the latch 74LS373.
The LIGHT BEER signal is usually connected to the enable (G) pin number of the latch and the OCCITAN – Output control – of the latch is grounded The Overall Photo • Adding all of the concepts together, we have: A15- A10 Chip Selection Circuit 8085 A15-A8 ALE AD7-AD0 Latch CS A9- A0 A7- A0 1K Byte Memory Chip WR RD IO/M D7- D0 RD WR Introduction to 8085 Instructions The 8085 Recommendations – Considering that the 8085 is usually an 8-bit device it may have approximately 28 (256) instructions. • However , the 8085 simply uses 246 combinations that represent an overall total of 74 instructions. – Most of the guidelines have more than one format. These instructions can be grouped into five different groups: • • • • • Data Operations Arithmetic Operations Common sense Operations Part Operations Equipment Control Businesses Instruction and Data Formats • Every instruction provides two parts. – The first portion is the process or operation to be performed. • This kind of part is called the “opcode” (operation code). – The other part is the data to become operated about • Called the “operand”. Data Transfer Functions – These kinds of operations simply COPY the info from the supply to the vacation spot. – PORT, MVI, LDA, and STA – They will transfer: • • • • Data between signs up.
Data Octet to a register or recollection location. Info between a memory area and a register. Data between an IO Device and the accumulator. – Your data in the supply is not really changed. The LXI instructions • The 8085 provides an instruction to place the 16-bit data in to the register match in one stage. • LXI Rp, (Load eXtended Immediate) – The instruction LXI B 4000H will you can put 16-bit number 4000 in the register set B, C. • The top two numbers are placed in the 1st enroll of the pair and the lower two numbers in the next. B 45 00 C LXI N 40 00H The Memory “Register” The majority of the instructions in the 8085 may use a recollection location instead of a register. – The memory position will become the “memory” enroll M. • MOV Meters B – copy the info from sign-up B in a memory location. – Which will memory position? • The memory area is discovered by the items of the HL register set. – The 16-bit material of the HL register couple are treated as a 16-bit address and used to determine the memory space location. Using the Other Enroll Pairs – There is also a great instruction to get moving data from memory to the accumulator without troubling the material of the L and D register. • LDAX Rp (LoaD Accumulator eXtended) Copy the 8-bit contents in the memory location identified by Rp enroll pair in the Accumulator. – This instructions only uses the BC or SOBRE pair. – It does not acknowledge the HL pair. Roundabout Addressing Function • Employing data in memory immediately (without reloading first into a Microprocessor’s register) is called Indirect Addressing. • Indirect handling uses the data in a register pair being a 16-bit treat to identify the memory site being utilized. – The HL register pair is often used in combination with the memory space register “M”. – The BC and DE signup pairs can be used to load info into the Accumultor using roundabout addressing.
Math Operations – Addition (ADD, ADI): – Any 8-bit number. – The contents of a register. – The contents of your memory area. • Could be added to the contents from the accumulator plus the result is stored in the accumulator. – Subtraction (SUB, SUI): – Any 8-bit number – The articles of a enroll – The contents of a memory area • Could be subtracted in the contents with the accumulator. The result is stored in the accumulator. Arithmetic Operations Associated with Memory • These guidelines perform a great arithmetic procedure using the contents of a memory space location although they are nonetheless in memory space. ADD – SUB – INR M M Meters / DCR M • Add the contents of M to the Accumulator • Sub the contents of M from your Accumulator • Increment/decrement the contents with the memory site in place. – All of these utilize contents in the HL signup pair to recognize the recollection location being utilized. Arithmetic Functions – Increment (INR) and Decrement (DCR): • The 8-bit items of any kind of memory area or any register can be immediately incremented or perhaps decremented simply by 1 . • No need to bother the items of the accumulator. Manipulating Details • Now that we have a 16-bit treat in a sign-up pair, exactly how manipulate that? It is possible to manipulate a 16-bit address trapped in a sign-up pair jointly entity applying some particular instructions. • INX Rp • DCX Rp (Increment the 16-bit number in the register pair) (Decrement the 16-bit number in the enroll pair) – The sign-up pair is incremented or perhaps decremented together entity. You should not worry about a carry from the lower 8-bits to the uppr. It is cared for automatically. Reasoning Operations • These guidelines perform reasoning operations on the contents of the accumulator. – ANA, ANI, ORA, ORI, XRA and XRI • Source: Accumulator and – An 8-bit number – The material of a register – The contents of your memory position Destination: Accumulator ANA R/M ANI # ORA ORI XRA XRI R/M # R/M # AND Accumulator With Reg/Mem AND Accumulator With an 8-bit quantity OR Accumulator With Reg/Mem OR Accumulator With an 8-bit number XOR Accumulator With Reg/Mem XOR Accumulator With an 8-bit quantity Logic Functions – Enhance: • 1’s complement from the contents in the accumulator. CMA No operand Additional Common sense Operations • Rotate – Rotate the contents from the accumulator one position left or right. – RLC – RAL – RRC – RAR Rotate the accumulator remaining. Bit 7 goes to little bit 0 As well as the Carry banner. Rotate the accumulator left through the bring.
Bit 7 goes to the carry and carry goes toward bit zero. Rotate the accumulator proper. Bit zero goes to bit 7 Plus the Carry flag. Rotate the accumulator right through the bring. Bit zero goes to the carry and carry would go to bit 7. RLC or RLA Bring Flag • RLC six 6 5 4 3 2 you 0 Accumulator Carry Banner • RAL 7 6th 5 5 3 two 1 0 Accumulator Logical Operations • Compare • Compare the contents of any register or memory area with the articles of the accumulator. – CMP R/M Assess the contents of the register or memory space location towards the contents in the accumulator. Evaluate the 8-bit number towards the contents of the accumulator. CPI # • The assess instruction sets the flags (Z, Cy, and S). • The compare is performed using an internal subtraction that does not change the items of the accumulator. A – (R as well as M as well as #) Branch Operations • Two types: – Unconditional department. • Go to a new area no matter what. – Conditional branch. • Go to a new area if the state is true. Complete, utter, absolute, wholehearted Branch – JMP Address • Leap to the treat specified (Go to). – CALL Address • Jump to the address specified although treat it as a subroutine. – RET • Return by a terme conseill�. – The addresses delivered to all part operations has to be 16-bits.
Conditional Branch – Go to new location when a specified state is met. • JZ Addresses (Jump in Zero) – Go to addresses specified if the Zero flag is set. • JNZ Address (Jump on NOT Zero) – Go to address particular if the Zero flag is definitely not arranged. • JC Address (Jump on Carry) – Visit the address specified if the Hold flag is set. • JNC Address (Jump on Simply no Carry) – Go to the treat specified if the Carry banner is not set. • JP • JM Treat (Jump upon Plus) Address (Jump about Minus) – Go to the addresses specified if the Sign banner is not really set – Go to the addresses specified in the event the Sign flag is set.
Equipment Control – HLT • Stop executing the program. – NOP • No procedure • Just as it says, do nothing. • Usually intended for delay as well as to replace guidance during debugging. Operand Types • You will find different ways to get specifying the operand: – There might not be an operand (implied operand) • CMA – The operand may be an 8-bit number (immediate data) • ADI 4FH – The operand can be an internal enroll (register) • SUB M – The operand may be a 16-bit address (memory address) • LDA 4000H Instruction Size • Depending on the operand type, the instructions may will vary sizes.
It is going to occupy a different number of memory bytes. – Typically, all instructions take up one byte only. – The exception is virtually any instruction which has immediate info or a recollection address. • Instructions including immediate info use two bytes. – One to get the opcode and the various other for the 8-bit info. • Guidelines that include a memory treat occupy three bytes. – One to get the opcode, and the additional two to get the 16-bit address. Teaching with Instant Date • Operation: Fill an 8-bit number in the accumulator. – MVI A, 32 • Operation: MVI A • Operand: The quantity 32 • Binary Code: 0011 1110 3E very first byte. 011 0010 32 2nd octet. Instruction which has a Memory Talk about • Procedure: go to talk about 2085. – Instruction: JMP 2085 • Opcode: JMP • Operand: 2085 • Binary code: 1100 0011 C3 multitude of 0101 eighty-five 0010 0000 20 initial byte. 2nd byte third byte Handling Modes • The processor has different methods of indicating the data for the training. These are named “addressing modes”. • The 8085 has four handling modes: – – – – Intended Immediate Immediate Indirect CMA MVI N, 45 LDA 4000 LDAX B • Load the accumulator together with the contents of the memory area whose addresses is kept in the register pair BC). Data Formats In an 8-bit microprocessor, info can be represented in one of four formats: • • • • ASCII BCD Signed Integer Unsigned Integer. – It is important to recognize that the microprocessor deals with 0’s and 1’s. • This deals with values as strings of parts. • Is it doesn’t job with the user to add a meaning to these strings. Data Platforms • Believe the accumulator contains the pursuing value: 0100 0001. – There are several ways of looking over this value: • It is an unsigned integer stated in binary, the equivalent fracci�n number can be 65. • It is a amount expressed in BCD (Binary Coded Decimal) format. That could make it, 41. Costly ASCII portrayal of a page. That would make it the letter A. • This can be a string of 0’s and 1’s where the 0th as well as the 6th portions are started 1 although all other bits are started 0. ASCII stands for American Standard Code for Information Interchange. Counters , Time Holds off Counters • A loop counter is set up by reloading a signup with a certain value • Then making use of the DCR (to decrement) and INR (to increment) the contents of the register will be updated. • A cycle is set up which has a conditional leap instruction that loops back again or certainly not depending on whether or not the count offers reached the termination rely.
Counters • The operation of a loop counter can be described making use of the following flowchart. Initialize Body system of trap Update the count Simply no Is this Final Count? Certainly Sample ALP for putting into action a trap Using DCR instruction MVI C, 15H LOOP DCR C JNZ LOOP Using a Register Pair as a Loop Counter • Using a sole register, anybody can repeat a loop for the maximum count of 255 times. • It is possible to increase this count by using a signup pair for the trap counter rather than the single sign-up. – A small problem arises in how to check for the ultimate count seeing that DCX and INX do not modify the flags. However , if the trap is looking for when the count becomes zero, we are able to use a small trick by simply ORing the two registers in the pair and then checking the absolutely no flag. Using a Register Pair as a Loop Counter • The following is among the a trap set up which has a register match as the loop counter. LXI W, 1000H LOOP DCX W MOV A, C ORA B JNZ LOOP Holdups hindrances impediments • It absolutely was shown in Chapter a couple of that each teaching passes through different mixtures of Get, Memory Browse, and Recollection Write cycles. • The actual combinations of cycles, one can calculate the length of time such an teaching would need to finish. The stand in Appendix F of the book consists of a column with the title B/M/T. – B to get Number of Bytes – Meters for Number of Machine Cycles – Capital t for Volume of T-State. Holds off • Finding out how many T-States an instruction requires, and keeping in mind that a T-State is usually one time clock cycle long, we can compute the time using the following solution: Delay = No . of T-States as well as Frequency • For example a “MVI” teaching uses 7 T-States. Consequently , if the Microprocessor is working at a couple of MHz, the instruction would require 3. 5 µSeconds to full. Delay coils • We are able to use a loop to produce a certain quantity of time hold off in a plan. The following is among the a postpone loop: MVI C, FFH LOOP DCR C JNZ LOOP 7 T-States four T-States 12 T-States • The first instruction initializes the loop counter and it is executed only once requiring just 7 T-States. • The subsequent two guidance form a loop that needs 14 T-States to execute and is repeated 255 occasions until C becomes zero. Delay Coils (Contd. ) • We need to keep in mind even though that within the last iteration of the loop, the JNZ instruction will fail and require only several T-States rather than the 10. • Therefore , we need to deduct three or more T-States in the total wait to receive an accurate hold off calculation. To calculate the delay, we use the next formula: Tdelay = TO + TL – Tdelay = total delay – TO sama dengan delay beyond the loop – TL sama dengan delay from the loop • TO is a sum of all delays away from loop. Delay Loops (Contd. ) • Using these types of formulas, we could calculate enough time delay pertaining to the previous case: • TO = several T-States – Delay from the MVI training • TL = (14 X 255) , 3 = 3567 T-States – 14 T-States for the two instructions repeated 255 moments (FF16 = 25510) lowered by the several T-States intended for the final JNZ. Using a Sign-up Pair as being a Loop Countertop • Using a single enroll, one can duplicate a cycle for a maximum count of 255 instances. It is possible to improve this depend by using a register pair pertaining to the loop counter instead of the single sign-up. – A small problem comes up in how to check for the ultimate count as DCX and INX usually do not modify the flags. – However , in case the loop is looking to get when the rely becomes zero, we can use a small technique by ORing the two registers in the pair and then checking the zero flag. Using a Sign-up Pair as being a Loop Countertop • Here i will discuss an example of a delay loop set up with a register set as the loop countertop. LXI W, 1000H CYCLE DCX B MOV A, C ATTUALMENTE B JNZ LOOP 12 T-States 6 T-States 5 T-States four T-States 15 T-States
By using a Register Couple as a Trap Counter • Using the same formula coming from before, we can calculate: • TO sama dengan 10 T-States – The delay for the LXI instruction • TL sama dengan (24 Back button 4096) , 3 = 98301 T- States – 24 T-States for the 4 instructions in the loop repeated 4096 times (100016 = 409610) decreased by the three or more TStates to get the JNZ in the last version. Nested Coils • Nested loops can be easily set up in Assemblage language by using two subscribes for both loop counter tops and upgrading the right sign-up in the right loop. – In the physique, the body of loop2 can be ahead of or after loop1.
Initialize loop 2 Human body of cycle 2 Run loop one particular Body of loop 1 Update the count1 Not any Is this Last Count? Certainly Update the count two No Are these claims Final Rely? Yes Nested Loops for Delay • Instead (or in conjunction with) Register Pairs, a nested loop structure can be used to improve the total wait produced. MVI B, 10H LOOP2 MVI C, FFH LOOP1 DCR C JNZ LOOP1 DCR B JNZ LOOP2 7 T-States 7 T-States some T-States 15 T-States some T-States 10 T-States Delay Calculation of Nested Coils • The calculation remains to be the same except that it the formula must be applied recursively to each trap. Start with the inner loop, in that case plug that delay inside the calculation with the outer trap. • Hold off of inner loop – TO1 = 7 T-States • MVI C, FFH instruction – TL1 = (255 Back button 14) , 3 = 3567 T-States • 18 T-States to get the DCR C and JNZ instructions repeated 255 Delay Calculations of Nested Loops • Delay of outer cycle – TO2 = 7 T-States • MVI B, 10H teaching – TL1 = (16 X (14 + 3574)) , a few = 57405 T-States • 14 T-States for the DCR W and JNZ instructions and 3574 T-States for loop1 repeated sixteen times (1016 = 1610) minus 3 for the ultimate JNZ. – TDelay sama dengan 7 & 57405 sama dengan 57412 T-States • Total Delay – TDelay sama dengan 57412 X 0. 5 µSec = 28. summer mSec Elevating the delay • The delay could be further elevated by using enroll pairs for each and every of the trap counters in the nested spiral setup. • It can also be elevated by adding dummy instructions (such NOP) within the body of the loop. Timing Picture Representation of Various Control signals generated during Execution of an Instruction. Subsequent Buses and Control Alerts must be proven in a Timing Diagram: •Higher Order Addresses Bus. •Lower Address/Data shuttle bus •ALE •RD •WR •IO/M Timing Diagram Instruction: A000h MOV A, B Related Coding: A000h 78 Timing Diagram Instructions: A000h MOV A, B Corresponding Code: A000h 79
OFC 8085 Memory Time Diagram Teaching: A000h PORT A, M 00h T1 T2 T3 T4 A0h A15- A8 (Higher Buy Address bus) Corresponding Coding: A000h 79 78h ALCOHOL RD OFC WR 8085 Memory IO/M Op-code fetch Cycle Timing Diagram Instruction: A000h MVI A, 45h Corresponding Coding: A000h A001h 3E forty-five Timing Picture Instruction: A000h MVI A, 45h OFC MEMR Corresponding Coding: A000h A001h 3E 45 8085 Memory Timing Diagram T1 T2 T3 T4 T5 T6 T7 A0h A0h A15- A8 (Higher Buy Address bus) 00h 3Eh 01h 45h DA7-DA0 (Lower order address/data Bus) Teaching: A000h MVI A, 45h Corresponding Code: A000h A001h 3E forty five WR RD ALE
IO/M Op-Code Get Cycle Memory space Read Cycle Timing Picture Instruction: A000h LXI A, FO45h Corresponding Coding: A000h A001h A002h 21 45 F0 Timing Diagram Training: A000h LXI A, FO45h OFC MEMR MEMR Matching Coding: A000h A001h A002h 21 forty-five F0 8085 Memory Time Diagram Op-Code Fetch Pattern Memory Examine Cycle Memory Read Circuit T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 A0h A0h A0h A15- A8 (Higher Order Address bus) 00h 21h 01h 45h 02h F0h DA7-DA0 (Lower buy address/data Bus) ALE RD WR IO/M Timing Diagram Instruction: A000h MOV A, M Related Coding: A000h 7E Time Diagram Teaching: A000h MOV A, M
OFC MEMR Corresponding Code: A000h 7E 8085 Storage Timing Diagram T1 T2 T3 T4 T5 T6 T7 A0h Content Of Reg They would A15- A8 (Higher Purchase Address bus) Instruction: A000h MOV A, M Related Coding: A000h 7E 00h 7Eh L Reg Content Of Meters DA7-DA0 (Lower order address/data Bus) LIGHT BEER RD WR IO/M Op-Code Fetch Routine Memory Go through Cycle Time Diagram Teaching: A000h PORT M, A Corresponding Code: A000h seventy seven Timing Picture Instruction: A000h MOV Meters, A OFC MEMW Related Coding: A000h 77 8085 Memory Time Diagram T1 T2 T3 T4 T5 T6 T7 A0h Content Of Reg H A15- A8 (Higher Order Talk about bus)
Instruction: A000h MOV M, A Corresponding Coding: A000h 77 00h 7Eh L Reg Content of Reg A DA7-DA0 (Lower order address/data Bus) LIGHT BEER RD WR IO/M Op-Code Fetch Pattern Memory Compose Cycle Section 9 Collection and Terme conseill� The Stack • The stack is definitely an area of memory determined by the developer for temporary storage details. • The stack is known as a LIFO structure. – Previous In Initial Out. • The bunch normally expands backwards in memory. – In other words, the programmer describes the bottom with the stack plus the stack grows up into minimizing address range. The Bunch grows backwards into memory space Memory Underlying part of the Bunch The Collection Given that the stack increases backwards in memory, it really is customary to put the bottom in the stack at the conclusion of memory to keep it because far away by user courses as possible. • In the 8085, the stack is defined by environment the SP (Stack Pointer) register. LXI SP, FFFFH • This kind of sets the Stack Tip to site FFFFH (end of memory for the 8085). Conserving Information on the Stack • Information is usually saved on the stack simply by PUSHing this on. – It is gathered from the stack by POPing it off. • The 8085 provides two instructions: PUSH and POP intended for storing information about the bunch and retrieving it back. – Both DRIVE and PUT work with sign-up pairs JUST.
The FORCE Instruction • PUSH B – Decrement SP – Copy the contents of register B to the memory space location indicated to by simply SP – Decrement BSP C F3 12 – Copy the contents of register C to the memory space location aimed to by simply SP F3 FFFB FFFC FFFD FFFE FFFF 12 SP The POP Instruction • PUT D – Copy the contents of the memory site pointed to by the SP to register Elizabeth – Increment SP – Copy the contents with the memory site D At the F3 12 pointed to by the SP to register G – Increase SP F3 SP FFFB FFFC FFFD FFFE FFFF 12 Operation of the Stack • During pushing, the stack are operating in a “decrement then store” style. The stack tip is decremented first, then the information is positioned on the stack. • During poping, the stack are operating in a “use then increment” style. – The information is usually retrieved through the top of the the stack after which the tip is incremented. • The SP pointer always points to “the top of the stack”. LIFO • The order of PUSHs and POPs has to be opposite of each other in order to retrieve data back into it is original area. PUSH W PUSH M , PUT D POP B The PSW Signup Pair • The 8085 recognizes one additional enroll pair referred to as the PSW (Program Status Word). This register couple is made up of the Accumulator as well as the Flags signs up. • It is also possible to push the PSW on to the collection, do no matter what operations happen to be needed, then POP it off of the collection. – The result is that the contents of the Accumulator and the status of the Red flags are came back to what we were holding before the operations were performed. Subroutines • A terme conseill� is a band of instructions that will be used frequently in different spots of the system. – Rather than repeat the same instructions a couple of times, they can be grouped into a terme conseill� that is referred to as from the several locations. In Assembly language, a terme conseill� can exist anywhere in the code. – However , it really is customary to position subroutines separately from the key program. Subroutines • The 8085 offers two guidelines for dealing with subroutines. – The CALL instruction is used to reroute program execution to the terme conseill�. – The RTE insutruction is used to return the setup to the dialling routine. The CALL Instruction • CALL 4000H – Force the treat of the training immediately following the phone call onto the stack 2150 CALL 4000 2003 countertop – Load the program LAPTOP OR COMPUTER 2 0 0 3with the 16-bit address supplied with the CALL teaching. FFFB FFFC FFFD FFFE FFFF 3 20 SP The RTE Instruction • RTE – Retrieve the return address from the the top of stack – Load this program counter together with the return address. 2003 PERSONAL COMPUTER 4014 4015 , RTE FFFB FFFC FFFD FFFE FFFF 03 20 SP Cautions • The CALL instructions places the return talk about at the two memory spots immediately before where the Bunch Pointer is usually pointing. – You must collection the SP correctly JUST BEFORE using the CALL instruction. • The RTE instruction takes the contents of the two memory spots at the top of the stack and uses these as the return talk about. – Will not modify the stack pointer in a terme conseill�. You will loose the returning address.
Passing Data to a Subroutine • In Assemblage Language info is exceeded to a subroutine through subscribes. – Your data is stored in one of the registers by the phoning program and the subroutine uses the value in the register. • The other possibility is by using agreed upon storage locations. – The calling program shops the data in the memory position and the terme conseill� retrieves the information from the position and uses it. Call by Reference and Call by Value • If the subroutine performs functions on the material of the subscribes, then these kinds of modifications will probably be transferred back to the dialling program after returning from a subroutine. Call by reference • If this is not desired, the subroutine should PUSH all the registers it takes on the collection on entrance and PUT them about return. – The original ideals are renewed before delivery returns towards the calling system. Cautions with PUSH and POP • PUSH and POP must be used in opposite order. • There has to be numerous POP’s and there is PUSH’s. – If certainly not, the S� statement will certainly pick up an incorrect information through the top of the collection and the program will are unsuccessful. • It is far from advisable to place PUSH or perhaps POP inside a loop. Conditional CALL and RTE Recommendations • The 8085 supports conditional CALL UP and conditional RTE guidance. The same conditions used with conditional JUMP instructions can be used. – – – – – CC, call subroutine if Carry flag is set. COMPUTER NUMERICAL CONTROL, call terme conseill� if Carry flag can be not established RC, go back from subroutine if Hold flag is set RNC, go back from subroutine if Hold flag is definitely not arranged Etc . A suitable Subroutine • According to Software Executive practices, a suitable subroutine: – Is only came into with a CALL UP and exited with a great RTE – Has a one entry point • Do not make use of a CALL statement to jump into several points of similar subroutine. – Has a single exit stage • There should be one come back statement coming from any terme conseill�. Following these types of rules, right now there should not be virtually any confusion with PUSH and POP usage. The Design and Operation of Memory Memory space in a processor system is wherever information (data and instructions) is stored. It can be classified into two main types:? Main memory (RAM and ROM) Storage storage (Disks, Dvd, etc . ) The simple view of RAM MEMORY is that it is made up of signs up that are made from flip-flops (or memory elements).? ROM on the other hand uses diodes instead of the flip flops to permanently hold the information. The number of flip-flops in a “memory register” determines the size of the memory word. Accessing Information in Recollection For the microprocessor to reach (Read or Write) data in recollection (RAM or perhaps ROM), it needs to do this: Select the right storage chip (using part of the talk about bus). Discover the memory location (using the rest of the treat bus). Access the data (using the data bus). 2 Tri-State Buffers An essential circuit element that is used widely in memory. This barrier is a logic circuit which has three declares: Logic zero, logic1, and high impedance. When this circuit is high impedance mode i think as if it really is disconnected through the output completely.
The Output can be Low The outcome is Substantial High Impedance 3 The Tri-State Buffer This signal has two inputs and one end result. The first input reacts like the typical input intended for the signal. The second type is an “enable”.? When it is set substantial, the output uses the proper signal behavior. If it is set low, the output appears to be a wire connected to nothing at all. Output Type OR Insight Output Permit Enable 4 The Basic Recollection Element The standard memory element is similar to a D latch. This latch has an suggestions where the data comes in. They have an enable input and an result on which data comes away. Data Insight D Info Output Q
Enable SOBRE 5 The standard Memory Element However , this is not safe. Info is always present on the type and the outcome is always started the items of the latch. To avoid this, tri-state buffers are added at the output and input of the latch. Data Input D Info Output Queen RD Permit EN WR 6 The fundamental Memory Element The WR signal handles the type buffer. The line over WR means that this is certainly an active low signal. Therefore , if WR is 0 the insight data reaches the latch input. In the event WR is 1 the input of the latch seems like a wire connected to nothing at all. The RD signal regulates the output in a similar manner. A Memory “Register” If we take four of these latches and connect them together, we would have got a 4-bit memory enroll I0 WR I1 I2 I3 D Q SOBRE EN RD D Q EN D Q SOBRE D Queen EN O0 O1 UNITED KINGDOM O3 almost 8 A group of recollection registers D0 o D1 o u D2 o D3 WR D SOBRE Q Deb EN Q D SOBRE Q Deb EN Queen D Q D EN Q D EN Q D EN Q Growing on this structure to add even more memory subscribes we get the diagram to the right. EN D EN Q D EN Q D SOBRE Q Deb EN Queen D SOBRE Q D EN Q D SOBRE Q M EN Queen o um o to RD D0 D1 D2 9 D3 Externally Initiated Operations Exterior devices may initiate (start) one of the some following operations: Reset?
Most operations happen to be stopped as well as the program table is totally reset to 0000. The microprocessor’s operations are interrupted and the microprocessor executes what is called a “service routine”. This routine “handles” the interrupt, (perform the necessary operations). Then the microprocessor returns to its past operations and continues. Interrupt? 10 A group of Memory Signs up If we represent each memory space location (Register) as a stop we get this I0 I1 I2 I3 WR EN0 EN1 EN2 EN3 RD O0 Suggestions Buffers Memory Reg. zero Memory Reg. 1 Memory space Reg. 2 Memory Reg. 3 Output Buffers O1 O2 O3 11
The Design of a Memory Chip Making use of the RD and WR handles we can decide the direction of circulation either in to or away of memory. Then using the appropriate Enable input we enable someone memory register. What we have designed is a memory with 4 places and each area has 5 elements (bits). This recollection would be referred to as 4 By 4 [Number of location X number of bits per location]. 12 The Enable Advices How do we generate these permit line? Since we can never convey more than one of those enables effective at the same time, we could have them encoded to reduce the number of lines getting into the computer chip.
These protected lines are the address lines for recollection. 13 The Design of a Recollection Chip Therefore , the previous plan would today look like the subsequent: I We I We 0 you 2 a few WR A d d r e s t D at the c um d at the r Suggestions Buffers Storage Reg. 0 Memory Reg. 1 Memory space Reg. two Memory Reg. 3 Result Buffers A2 A0 RD O0 O1 O2 O3 14 The style of a Recollection Chip Seeing that we have tri-state buffers in both the inputs and outputs of the sandals, we can truly use one set of pins only. Input Buffers WR A1 A0 A D The chip Recollection Reg. at this point look likeDthis: would zero d electronic 0 D0 A1 A0 D1 D2 D3 g r elizabeth s s c u d electronic r Storage Reg. one particular Memory Reg. 2 Memory space Reg. End result Buffers D1 D2 D3 RD RD WR 15 The steps of writing in to Memory What are the results when the developer issues the STA instruction? The processor would start up the WR control (WR = 0) and turn off of the RD control (RD sama dengan 1). The address is definitely applied to the address decoder which builds a single Enable signal to activate only one from the memory registers. The data is then applied on the data lines in fact it is stored in to the enabled register. 16 Sizes of Storage Memory is generally measured by simply two figures: its size and its thickness (Length Times Width).? The space is the amount of spots.
The width is the quantity of bits in each position. The length (total number of locations) is a function of the quantity of address lines. # of memory locations = 2( # of address lines) 210 sama dengan 1024 spots (1K)? Therefore , a recollection chip with 10 address lines might have Looking at that from the various other side, a memory chip with 4K locations will need? Log2 4096=12 address lines 17 The 8085 and Memory The 8085 offers 16 talk about lines. That means it can address 216 sama dengan 64K memory locations. Then it will need 1 memory processor chip with sixty four k locations, or two chips with 32 K in each, or four with sixteen K every single or 16 of the some K poker chips, etc . ow would all of us use these types of address lines to control the multiple poker chips? 18 Computer chip Select Generally, each memory chip includes a CS (Chip Select) suggestions. The nick will only job if an active signal is usually applied on that input. To allow the use of multiple chips in the make up of memory, we must use a range of the treat lines when it comes to “chip selection”. These talk about lines happen to be decoded to generate the 2n necessary CS inputs pertaining to the memory space chips to be used. 19 Chip Assortment Example Assume that we need to create a memory system made up of 5 of the some X four memory poker chips we designed earlier.
All of us will need to employ 2 inputs and a decoder to identify which chip will be used at what time. The causing design might now look like the one within the following slide. 20 Computer chip Selection Model RD WR D0 D1 RD WR A0 A1 CS RD WR A0 A1 CS RD WR A0 A2 CS RD WR A0 A1 CS A0 A1 A2 A3 2 X4 Decoder 21 Memory Map and Tackles The memory space map is known as a picture representation of the addresses range and shows where different storage chips can be found within the treat range. 0000 0000 EPROM 3FFF 4400 Address Array of EPROM Computer chip Address Selection RAM 1 RAM a couple of RAM three or more Address Array of 1st MEMORY Chip 5FFF 6000 Addresses Range of second RAM Nick FFF 9000 A3FF A400 Address Range of 3rd MEMORY Chip RAM 4 F7FF FFFF Addresses Range of next RAM Processor chip 22 Address Range of a Memory Chip The address range of a specific chip is definitely the list of every addresses that are mapped for the chip. An example for the address range and its romantic relationship to the memory chips is the Post Office Containers in the mailbox. • Every box has its unique quantity that is designated sequentially. (memory locations) • The containers are assembled into teams. (memory chips) • The first field in a group has the quantity immediately after the very last box in the last group. twenty-three Address Range of a Recollection Chip
The above example may be modified somewhat to make that closer to each of our discussion in memory. • Let’s say that this post office features only multitude of boxes. • Let’s likewise say that they are grouped in to 10 groups of 100 containers each. Boxes 0000 to 0099 happen to be in group 0, boxes 0100 to 0199 are in group 1 and so on. We can consider the box quantity as if it is made up of two pieces: • The group number and the box’s index within the group. • Therefore , box number 436 is the 36th field in the fourth group. The top digit from the box amount identifies the group plus the lower two digits identify the box within the group. twenty-four
The 8085 and Talk about Ranges The 8085 features 16 address lines. So , it can addresses a total of 64K memory space locations. Whenever we use memory chips with 1K locations each, in that case we will require 64 these kinds of chips. The 1K memory chip demands 10 treat lines to uniquely discover the 1K locations. (log21024 = 10) That leaves 6 talk about lines which is the exact number needed for picking between the 64 different poker chips (log264 = 6). twenty-five The 8085 and Address Ranges Right now, we can split up the 16-bit address in the 8085 in to two bits: A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 Chip Collection Location Assortment within the Computer chip
Depending on the combo on the talk about lines A15 , A10, the addresses range of the specified chip is determined. 26 Chip Select Case A computer chip that uses the combination A15 , A10 = 001000 would have addresses that range from 2000H to 23FFH. Keep in mind that the 10 talk about lines for the chip provides range of 00 0000 0000 to 10 1111 5555 or 000H to 3FFH for each of the chips. The memory chip in this example would require the following outlet on their chip select input: A 10 A 14 A 12 A 13 A 18 A 12-15 CS twenty seven Chip Choose Example Whenever we change the over combination to the following: A TEN A 14 A doze A 13 A 16 A 15 CS
Now the processor chip would have address ranging from: 2400 to 27FF. Changing the combination of the address pieces connected to the chip select adjustments the address range intended for the memory chip. 28 Chip Choose Example To illustrate this kind of with a picture:? in the 1st case, the memory chip occupies the piece of the memory map identified as prior to. In the second case, this occupies the piece referred to as after. Ahead of After 0000 2000 23FF 2400 27FF 0000 FFFF FFFF twenty nine High-Order versus Low-Order Addresses Lines The address lines from a microprocessor could be classified in two types: High-Order? Low-Order?