UNIT 18 PROGRAMMING MICROPROCESSORS

Size: px
Start display at page:

Download "UNIT 18 PROGRAMMING MICROPROCESSORS"

Transcription

1 UNIT 18 PROGRAMMING MICROPROCESSORS Structure 18.1 Introduction Objectives 18.2 Computer Languages High Level Languages and Compilers Assembly Language and the Assembler 18.3 Microprocessor Programming Data Representation Instruction Formats Addressing Modes 18.4 Instruction Types Data Transfer Instructions Arithmetic Instructions Logic Instructions Branching Instructions Program Control Instructions 18.5 Programming Examples 18.6 Summary 18.7 Answers to SAQs 18.1 INTRODUCTION Any computer, however powerful it may be, needs a program to run. In other words, it is up to us to make the best use of the computational power of the computer by programming it properly. A program is a series of instructions given to the computer in order to meaningfully complete a specified task. The complexity of the instructions and consequently that of the program depends on the complexity of the computer itself. Modem, state-of-the-art computers that can carry out sophisticated tasks also require programs that are relatively complex. However, as mentioned in the previous unit, microprocessors are less computationally intensive than general purpose computers and therefore are also easier to program. More specifically, the microprocessor that we have chosen for our study, the Intel 8085, has a very simple set of instructions which are very easy to learn and use. Objectives After studying this unit, you should be able to differentiate between the approaches used in programming a general purpose computer and a microcomputer, distinguish between programming in high level languages for a general purpose computer and assembly language for microprocessors, represent the data required by the program and describe the techniques by which the microprocessor can access this data, define instruction formats, describe the details of the 8085 instructions by classifying them into different groups, define the techniques of developing programs for the 8085 microprocessor, and write simple programs for the 8085 microprocessor COMPUTER LANGUAGES When a program is written and stored in the memory of a computer, the CPU accesses this program sequentially one instruction at a time for execution. Whatever may be the degree of sophistication of the computer, the program as it is stored in the main memory of the computer for the CPU access, has to be in binary code because binary is the only language that a CPU can understand. However, it is very cumbersome to write programs in binary

2 2- Teddqmea & code. nerefore, computer users write programs either in a high level language or in the assembly language. We shall explain these two terms further in the following paragraphs. cmpm~ese~r~ High Level Languages and Compilers Not every user of a computer can be expected to be familiar with its hardware. Users like to write programs and run them on a computer without having to learn its architecture. Further, they would like to be able to run these programs on different computers, depending on their availability, without making any changes in the program. There do exist such computer languages which are designed such that programs can be written independent of the type of computer on which they will be run. Such languages which are machine independent are called high level languages. FORTRAN, BASIC, PASCAL and C are examples of such languages. These languages concentrate more on the techniques of solving problems and very little on the resources available within the computer. How does such a program run on a computer, more so on different machines? A program written in a high level language has to be translated into machine language. Such a process is called compilation. Compilers are software programs which take into account the machine resources and Uanslate the high level language into appropriate binary codes which run on the computer. Compilers are designed and written by the designers of the computer, sometimes specifically known as system programmers. Obviously, compilers differ from machine to machine and different compilers have to be used for different high level languages. Occasionally, the high level language programmer (also called application programmer) may have to make slight changes in the program to suit a specific compiler, but such changes are minimal and are easy to incorporate into the program Assembly Language and the Assembler Programs written in high level languages are not efficient since they do not take into account the resources available within the CPU of the computer. Compilation may not always produce the best possible machine code in terms of utilising the architecture of the computer effective1y.a programming language which takes into account the architecture of the CPU is called the assembly language. Assembly language programming breaks down the task to be performed into steps that have a one to one correlation to the CPU hardware. As an example, in order to find the product of two numbers N1 and N2, a high level language program will probably use an instruction where N, and N2 would have been previously defined and P will be used later in the program On the other hand, the assembly language program will break it into steps by which the values of N1 and N2 will be moved into CPU registers, the multiplication carried out and the product stored at P. It will probably look as follows : MOV A, N1 ; MOV B, N2 ; Move value Nl to A register Move value N2 to B register MPY A, B ; Multiply A and B STA P, Store the product at P This program is much more efficient because the program moves the operands around in the most efficient way, whereas in the case of a high level language, we have no idea how the CPU is going to handle the operands. However, assembly language programming is more difficult because (a) you have to know the architecture of the CPU before using it, and (b) you have to break each operation down to steps that the CPU can perform. The rewards of assembly language programming lie in its increased speed and better utilization of the CPU for a given task. Since microprocessors are generally used less for computationally intensive tasks and more for control functions, they are usually programmed in assembly language in order to keep a better track of the input parameters and efficiently and speedily modify the output parameters. Even when a program is written in assembly language, it still has to be converted to binary code. This operation is called assembling and is performed by a software utility called assembler. However, an assembler is a much simpler software compared to a compiler because in the case of an assembler, the program has already taken into account the CPU hardware and the operations have already been broken down to steps. All that needs to be done is translation to binary code. In our study, we will use assembly language for learning the instructions of the 8085 microprocessor and for subsequent writing of programs. Further, since 8085 is such a

3 -. simple microprocessor with a fairly small numwr or mrrucuuns, wt: uu uur r;vgll ubbu u. assembler to convert our programs to machine code. We can do it manually by looking through a table which gives all the assembly instructions and their corresponding binary codes. (In practice, however, to save space, we will use hexadecimal numbers instead of binary numbers to represent the binary codes). These codes can then be directly loaded into the memory of the microcomputer system for storing and running MICROPROCESSOR PROGRAMMING As we studied in the previous section, programming a microprocessor is slightly different from programming a general purpose computer. Microprocessor programming uses assembly language and one should be familiar with the resources and limitations of the microprocessor in order to write efficient programs for microprocessors. We learned about the major features of the 8085 microprocessor in the last Unit. In this section, we will study some basic rules about representing data, addressing data and the format of the instructions. In subsequent sections, we will learn the actual instructions and programming techniques Data Representation The 8085 microprocessor has only a limited number of data manipulation instructions such as ADD, SUB etc. Since the processor is only an 8-bit processor, the range of data that can be processed is limited. Since microprocessors work with binary data, with 8 bits one can represent only 256 different values viz., the numbers from 0 to 255. This range represents only the magnitude and if both positive and negative numbers are to be represented, one bit goes for representing sign, leaving only 7 bits for the magnitude as shown in Figure 18.1, Figure 18.1 : Sign-magnitude rep.esentation of an 8-bit Binary Number where s represeiits the sign bit and m, the magnitude bits. me 8085 uses the popular 2's complement notation. For positive numbers, the sign bit is 0 md the magmtude M of the number is the decimal equivalent of the binary bits mm...m. For legative numbers, the sign bit is 1 and the magnitude M of the number is given by 2" - M vhere n is the number of magnitude bits and M is the decimal equivalent of the binary bits nm...m. Zxample 18.1 Find the decimal values (sign and magnitude) of the following 8-bit 2's complement numbers : (a) (b) Sr lution (a) Sign bit is 0, the number is positive = Thenumber is therefore, + (b) Sign bit is 9 the number is negative ~ = 76*0, magnitude is = = 5210 The number is therefore, Example 18.2 What are the largest and smallest numbers that can be represented in 8-bit 2's complement binary form? Solution Largest number is = Smallest number is 1OOOOOOO = - (128-0) = - l2gi0 How do you convert a decimal number into a 2's complement binary number? If the number is positive, convert it the same way you would convert a decimal number into a binary number viz., by repeated division by 2. Then append a 0 for the sign bit (MSB). If the number is negative, make the sign bit 1. Subtract the magnitude of the number from 2"

4 wnere n is tne number of magnitude bits and then convert the difference into binary representation by repeated division by 2. Example Convert the decimal numbers 83 and -105 into 8 bit 2's complement binary numbers. Solution (a) (b) 8310 = using 7 magnitude bits = including the sign bit. Z7-105 = = 23; 2310= ,u~ing 7 bits = including the sign bit. SAQ 1 Express the following 2's complement 8-bit binary numbers as decimal numbers : (a) (b) (c) SAQ 2 Represent the following decimal numbers in 8-bit 2's complement binary form : (a) (b) (c) + 1 (d) Instruction Formats Just like data, microprocessor instructions are also represented as binary numbers. For an 8-bit microprocessor, each word is 8 bits wide from which we can form 256 combinations. Each of these can be the code for an instruction, giving rise to a theoretical maximum of 256 possible instructions. However, not all the instructions can be only a byte wide. (A string of bits is referred to as a binary word; when the word has eight bits, it is given the special name byte. When the word has four bits it is called a nibble). For example, in order to load the accumulator with the content of a memory location, we need to specify the address of the memory location as part of the instruction. This is clearly not possible with 8 bits since the address alone requires 16 bits. The 8085 has three different instruction fonnats : Single byte instructions, two byte instructions and three byte instructions. Single byte instructions, - -- are the ones which do not require any data or address to be specified as part of the instruction and the instruction is simply an 8-bit binary code. MOV A, C : copies data from register C to register A ADD B : adds the content of register B to that of register A NOP : No operation is performed. Two-byte Instructions : - Instructions which require one additional byte to follow the operation byte are called 2-byte instructions. The first byte specifies the operation to be performed as a binary code and the second byte is either a data byte or a port address.

5 bxampres : MVI D, : move data byte 00 to register D IN 2 1 ~ : input to accumulator from port number 2111 CMP 37~ i compare the content of accumulator with 37H Three-byte Instructions : Instructions which require two bytes (either a 16 bit data or an address) to be specified as a part of the instruction are called three byte instructions. The first byte specifies the operation as a binary code and the second and third bytes are either a sixteen bit data or a memory address. LXI SP, 20C2H : load the Stack Pointer with the 16-bit data 20C2H LDA 10oH -... : load accumulator from memory address 1000H STA 200H : store accumulator content at memory address 2000H In each case, the first byte is the binary code of the operation to be performed and is called the operation code or simply op-code, for short. Obviously, a single byte instruction occupies one memory location, a two byte instruction two memory locations, and a three byte instruction three memory locations. Although the instructions of a program are stored sequentially in memory, the addresses are not consecutive because of their varying lengths. As an example, let us assume that the following short program is stored in the memqry ' starting at address 2000H. Observe the starting address of each instruction. Starting address of the instruction 200OH 2003~ 2005~ 2006~ 2007~ 2009~ The instructions of the above program are stored sequentially in the memory starting at address 200OH. The starting addresses of the consecutive instructions are not consecutive and it has taken 10 bytes to store 6 instructions Addressing Modes Instruction LXI SP,~OC~H IN 21H MOV B, M ADD B OUT 22H HLT Length of the instruction in bytes 3 Instructions require data to be operated on. The data required to complete the execution of an instruction is called the operand There are several ways in which an operand can be supplied to the CPU and these are called the addressing modes of the microprocessor. For example, the data required may be available in a CPU register or an external memory location ot may have to be supplied along with the instruction. Let us examine the different addressing modes available in the 8085 microprocessor : (1) Register mode : In this mode, the operand is available in a CPU register specified by the instruction. MOV C, B : B is the register holding data that has to be copied. into register C ADD B : Content of register B is to be added to that of A (2) Immediate mode : The data is supplied as part of the instruction and can be either 8 bits or 16 bits. ~ MVI A, 37H : Data byte 37H is to be loaded into accumulator LXI H, 2000H : 16-bit number 200OH is to be loaded into H, L register, pair. /

6 DigitPl Techniques & (3) Y I ~ ~ CIIIUUI: L M c r o p ~ ~ s ; ~ LUIIS I IIIUUC, UIG ILIGIIIV~Y UUUILJJ IVLULIVII Uc ~~lllu1l VpUIUL.U LV available is directly specified in the instruction. LDA 1000H : Content of memory location 1000H is to be loaded into the accumulator SHLD 2000~ : Content of H, L register pair is to be stored at memory locations 200oH and 2001H (2 bytes) (4) Register indirect mode : In this mode, the address is not explicitly specified, but a register pair which holds the address of the operand is implicitly or explicitly specified. MOV B, M : Content of memory is to be copied into register B, but the address is not given. It is implied that the address is held by H, L register pair. LDAX D : Content of memory whose address is contained in the register pair D, E is to be copied into the accumulator (explicit mention of register pair D, E). (5) Inherent mode : This mode is used for instructions which normally do not require any transfer of operand. CMA : Complement the content of accumulator RRC : Rotate accumulator content by one bit position to the right INSTRUCTION TYPES The set of basic operations that a microprocessor can perform is its Instruction Set and varies from one microprocessor to another. As we have seen earlier, an 8-bit microprocessor will have an 8-bit operation code giving rise to a maximum of 256 different instructions. This includes all the possible variations of every instruction. For the 8085 microprocessor, there are 66 basic operations resulting in a total of 243 instructions counting all the variations of each instruction. In order to learn and use these instructions effectively, it is better to classify them into functional groups and understand the working of instructions in each group. It will then be easy to'use the variations as and when the need arises. The 8085 instructions can be classified into the following five functional groups. Data Transfer Instructions Arithmetic Instructions Logic Instructions Branching Instructions Program control Instructions We shall now consider in detail, the instructions in each group. In describing operations carried out by the instructions, we will follow the standard Register Transfer Language. In this, an arrow indicates a transfer and a register within brackets indicates its content. (a) (A) -+ (B) indicates that the content of register A is copied to register B (b) 12H -+ (C) indicates that the hexadecimal number 12 is loaded into the register C (c) ((H) (L)) -+ (A) indicates that the content of the memory whose address is in turn contained in the H, L register pair is transferred to register A. The double brackets indicate the content of memory location whose address is in turn contained in the register pair H, L.

7 Data Transfer Instructions A major portion of a microprocessor program consists of moving data around either within the CPU or between the CPU and the peripheral units such as memory or I/O devices. About 40% of all instructions used in a program are data transfer instructions. Consequently, this group has the maximum number of instructions and the most variations in them (1) MOV d,s MOV d, s copies the content of a source register s into the destination register d. Tbe content of the source register is unaltered. d and s may be CPU registers or one of them may be a memory location. (a) MOV A, B ; (B) + (A) (b) MOV C, M ; ((H)(L)) + (C) (c) MOV M. D ; (D) + ((H)(L)) (2) MVI d, data8 MVI instruction loads the destination register d, which can be either a CPU register or a memory location, with an &bit data that follows the instruction. (a) Mm A, 21H ; 21H + (A) (b) Mm M, 37~ ; 37~ + ((H)(L)) (3) LXI d, data16 LXI loads the destination register pair with the 16-bit data that follows the instruction. Example : LXB, 1234~ ; 12~ + (B) ; 34~+ (C) (4) Direct address instructions load into or store from a registerlregister pair from or into one or two memory location(s) pointed by the address given in the instruction. (a) LDA 1000~ ; (1000) + (A) (b) STA 2000~ ; (A) + (2000) (c) LHLD 3000~ ; (3000) + (L),(3001) + (HI (d) SHLD 400ql ; (L) + (4000). (H) + (4001) (5) Indirect address instructions either load into or store from the accumulator from or into a memory location pointed by the address contained in a register pair (a) LDAX B ; ((B)(C)) + (A) (b) STAX D ; (A) + ((D)(E)) (6) INIOUT instructions: IN instruction reads an 8-bit data from an input port into the accumulator; OUT instruction writes the accumulator content to an output port. (7) XCHG instruction exchanges the contents of register pair H, L with those of D, E i.e., (H)- (D) and (L)-(E) Example 18.4 The following table illustrates how the content of each of the registers and the memory locations varies after execution of each of the specified instructions. Initial LDAX D XCHG MVIM, 56~ MVI A, 25~ d MOV C. D

8 Digital Tedmiqoea & Meroprocewon SAQ 3 Complete the following table to indicate the contents of the various registers and the memory locations after execution of each of the following instructions. Assume the initial values as shown after execution of the last instruction (MOV C, D) in the table given in Example A B C D E H L 1000 loo STA 1004~ MOV M, D SAQ 4 Starting from the position after execution of the last instruction in SAQ 3, which additional instructions will you use to make the contents of all the registers and all the memory locations 2 5~? Arithmetic Instructions Although the data transfer group of instructions are the most frequently used, the instructions that do the actual manipulation of data are the ones in the arithmetic and the logic groups. (1) ADD r Add instruction adds the content of register r to that of the accumulator and leaves the result of the addition in the accumulator. If the addition generates a carry, the CY bit in the flag register is set, otherwise it is reset. Since one of the operands in the arithmetic operation is in the accumulator, only the source of the other operand is explicitly indicated in the instruction. (a) ADD B ; (A) + (B) -+ (A) (b) ADD M ; (A) + ((H)(L)) -+ (A) (2) AD1 data 8 Example : AD1 adds an 8-bit data in hexadecimal format following the instruction, to the content of the accumulator. AD1 27H ; (A) ~ (A) (3) ADC r ADC instruction is similar to the ADD instruction except that it also adds the existing CY bit of the flag register. The CY bit is then modified to reflect the result of the addition. Similafinstruction is also available for adding immediate data along with carry (ACI).

9 (a) (b) ADC B ; (A) + (B) + (CY) + (A) ADC M ; (A) + ((H)(L)) + (CY) + (A) (c) ACI 56~ ; (A) + 56~ + (CY) + (A) (4) Corresponding to each addition instruction, is a subtract instruction. SUB r, SUB M, SUI data 8, SBB r, SBB M and SBI data 8 are the counterparts of ADD r, ADD M, AD1 data 8, ADC r, ADC M and ACI data 8 respectively. In the first three cases the content of the operand register is subtracted from the content of the accumulator and the result of subtraction is placed in the accumulator. The CYbit of the flag register is modified according to the result of subtraction. In the latter three cases, the content of the CY register is also subtracted. (a) SUB D ; (A) - (D) + (A) (b) SUB M ; (A) - ((H)(L)) + (A) (c) SUI 57H : (A) - 57H + (A) (d) SBB C ; (A) - (C) - (CY) + (A) (el SBB M ; (A) - ((H)(L)) - (CY) + (A) (f) SBI 46~ ; (A) - 46~ - (CY) + (A) (5) INR instruction increments the content of a register (a CPU register or memory) by one. DCR decrements the content of a register by one. INX increments the content of a register pair by one and DCX decrements the content of a register pair by one. (a) INR B ; (B) (B) (b) DCR C ; (C) (C) (c) INXB ; (B)(C) (B)(C) (d) DCX D ; (D)(E)- 1 + (D)(E) (6) DAD rp adds the content of a register pair to that of the register pair H, L. Example : DAD B ; (H)(L) + (B)(C) + (H)(L) (7) DM is used to adjust the hexadecimal format of the accumulator content to BCD form. Example 18.5 The following table illustrates how the contents of various registers, memory locations and the CY flag bit vary after execution of each of the specified instructions. A B C H L CY Initial ADCB ADDC ADDM C SAQ 5 Complete the following table to indicate the contents of the various registers, memory locations and the CY flag bit after execution of each of the following instructions. Assume the initial values to be as shown after the last instruction (ADD M) in the table given in Example 18.5.

10 Logic Instructions These instructions are meant for manipulating the data at the bit level whereas the arithmetic instructions handle data as bytes. The logic group of instructions are very useful in control applications where individual bits (representing, say, positions of switches) have to be monitored and manipulated as desired. (1) ANA r, AN1 data 8 ANA instruction carries out the logical AND operation of each bit of the register r (CPU or memory) with the corresponding bit of the accumulator. AM instruction does a similar AND operation of each bit of an 8-bit data following the instruction with the corresponding bit of the accumulator. (2) ORA r, OR1 data 8 are instructions similar to the ones described above to carry out the OR operation. (3) XRA r, XRA data 8 are instructions to carry out the EXCLUSIVE-OR operation. (4) CMA, CMC are the instructions which complement the content of the accumulator and the CY flag bit respectively. (5) STC sets the CY bit to 1 (a) ANA B ; (A) n (B) + (A) (b) AM21H ; (A)n21H + (A) (c) CMA (d) CMC ; ( r) + (A) ; ( E) + (CY) (e) STC ; 1 + (CY) (6) Rotate Instructions These instructions are used to shift each bit of the accumulator content by one position. There are four variations. (a) RLC (rotate left) (An) + (An+,), (A7)+(AoX (A71 + (CY) (b) RRC (rotate right) (An+l) + (A,), (Ao) +(A7), (Ao) + (CY) (c) RAL (rotate left through carry) ; (An) + (A,+l), (A71 + (CY), (CY) + (Ao) (d) RAR (Rotate right through carry) ; (An+l) + (An), (Ao) + (CY), (CY) + (A7). (7) CMP r This instruction subtracts the content of a register (CPU or memory) from that of the accumulator. Register contents are not changed, but the flags are modified according to the result of the comparison. (8) CPI data8 CPI is used to subtract an 8-bit data in hexadecimal form that follows the instruction from the content of the accumulator. The content of the accumulator is not changed, but the flags are modified according to the result of the comparison. (a) CMPB ; (A) - (B) (b) CMP M ; (A) - ((H)(L)) (c) CPI 2 7~ ; (A) - 2 7~ Example 18.6 The table below indicates the contents of various registers and flag bits after each of the following instructions is executed.

11 A B C S Z A C P CY Microprocewozs Initial Note : CY flag 1s cleated and AC is set for ANA C th~s mao on. OR1 5 5 ~ Note : CY and AC flags are cleared fa thns instruclion. CMP B Given the initial contents of registers as at the last step of Example 18.6, complete the table to indicate the contents of the various registers and the flag bits shown in the table after execution of each of the following instructions. A B C S Z AC P CY RAL CMA CPI 2 7 ~ Branching Instructions Normally, instructions of a microprocessor program are executed sequentially. However, this sequential flow can be altered by branching instructions. There are two types of branching instructions: unconditional and conditional. Unconditional branch instruction transfers the control of the program from one location to another by simply altering the content of the Program Counter. Conditional branch instruction, on the other hand, examines the condition specified in the instruction and branches only if the specified condition is met. (1) JMP addr The program branches to the address specified in the instruction. (2) J (condition) addr The program branches to the address specified in the instruction if the condition is met. Condition can be one of the processor flags 2, CY, P or S. In each case, the branching can occur either on the condition being met or not met as specified in the instruction. JC ad& ; ad& -+ (PC) if CY = 1 JM ad& ; ad& + (PC) if S = 1 JNC addr ; addr + (PC) if CY = 0 JZ addr ; addr + (PC) if Z = 1 JP addr ; addr + (PC) if S = 0 JNZ addr ; addr + (PC) if Z = 0 (3) A variation of the JMP instruction is the CALL instruction. This instruction is used to branch to a subroutine from a main program CALL instruction is different from the JMP instruction in the sense that in the case of CALL, the control returns to tlie main program on completion of the subroutine execution. In the case of JMP, the program does not return to the address from which the JMP occurred. Like the JMP instruction, CALL also has two variations, conditional and unconditional. (4) RET and R (condition) are instructions to return control to the main program from a subroutine unconditionally or on a condition being met respectively.

12 wmch transfers the control of -_ given by n multiplied by 8. Values of n from 0 to 7 are allowed., --., r 1. ro ul~ WUUL~O~ Example :,_,_ ,,,, RST3 ; Nlo or ISH + (PC) (6) PCHL instruction takes the program control to the address specified by the H, L register pair; (L) + (P~L). (H) -9 (PCH) Program Control Instructions This group of instructions is used to manipulate the stack, alter the flags and control the microprocessor operation. (1) PUSH rp, POP rp PUSH is used to save the content of a register pair in the stack. This is usually done before executing a subroutine which ma; needto use the register pair. On re& from the subroutine, the content of the register pair can be restored by the POP instruction. \ PUSH B ;(B) + ((SP) - 1) ; (C) + ((SP) - 2) ;(SP) POP B ; ((SP)) + (C) ; ((SP) + 1)- (SP) (B) ; (SP) (SP) (2) XTHL exchanges the content of H, L register pair into the content of the top two locations of the stack. (3) SPHL copies the content of the H, L register pair into the Stack Pointer (4) EI and DI are instructions to enable and disable the 8085 interrupts respectively. (5) HLT instruction is used to stop the processor from executing. (6) NOP does not perform any operation. This is used to produce a specified time delay without affecting the status of the processor in anyway. (7) RIM and SIM are instructions used with the interrupts of the These are too confusing to be explahed at this stage. They will be explained in Unit PROGRAMMING EXAMPLES In this section, we will understand the use of the instructions that we learned in the last section by writing some sample programs. This will be followed by a few exercises in program writing. Example 18.7 Write a program to add 29~ and SOH and save the result in the memory address 2 m. Solution 0 Start MVI A, 29~ ; 2gH + (A) MWB,~OH ;80H + (B) ADD B ;(A) + (B) -9 (A) Registers STA 2000 ;(A) + (UX)O) HLT ; stop execution Save the result NOTE : Comments an0 explanauons are wtltten on each line of instruction by separating the instruction from the comment by a semicolon (;) L+ ThP. flnw chart is eiven in Firmre Figure 18.2 : Flow &ad fa Example 18.7

13 Solution Add the numbers 8 7 and ~ 80H. If the sum is greater than AAH, send FFH to output PORT 0; otherwise send the sum. Start Registers MVI A. 87H ; 8 7 +(A) ~ MVI B, 80H ; 80H + (B) ADD B ; (A) + (B) + (A) CPI AAH ; (A)- AAH JM OUT ; if Sum 5 AA, go to OUTPUT MVIA,FF ; FF + (A) OUTPUT: OUT PORT 0 ; (A) + (PORT 0) HLT ;stopexecution Load A with FF Output Port 0 Figure 18.3 : Flow chart for Example 18.8 Example 18.9 A set of eight switches are connected to a microprocessor as an input PORTl and a set of eight LEDs (Light Emitting Diodes) are connected as an output PORT2 Write a program to read the status of the switches ( 1 = ON, 0 = OFF) and cohlrol the LEDs accordingly (1 = ON, 0 = OFF). This process should go on indefbitely. Solution C Start -1 switches Output /q START : IN PORTl ; read switches OLTT PORT2 ; output LEDs JMP START ; go back to start u Figure 18.4 : Flow chart for Example 18.9

14 'Ibis is a -cation of the previous example. The switches are disco~ected and only the LEDs are corn-to the micropfocessor. Write a program to keep only one LED ON at a time. Rotate the lit LED from left to right continuously. MVI A, 01 ; setl,tobeon OUT : OUT PORT 2 ; output to LED Lo be ON RLC ; rotate left ; go and output to next LED / / Output L T Rotate Figure 18.5 : Flow chart for Example There is a flaw in the solution given above.?be rotate left and jump instructions are executed so fast that after a complete rotation from L1 to L7, LED Lo will be turned ON again faster than our eyes can track. This will result in all LEDs appearing to be ON dl tbe time. This phenomenon is called persistence of vision and is used in the projection of motion pictures. To avoid this problem, a time delay should be introduced after each rotation. A delay can be introduced in a program by setting up a loop of instructions which are repeatedly executed. There are ways of precisely designing the loop for the amount of time &lay required, but such a &sign procedure is too involved and is beyond the scope of this treatment. Numbers are loaded in registers (which are not otherwise Wing used in the program) and allowed to decrement by one at a time. When the number reaches 0, the program comes out of the loop. In our example, we use registers B and C for this purpose. B is loaded with E;FH (25Sl0) and C with 32~ (5010). Each time register B decrements from FF to 0 (inner loop), register C is decremented by 1 and register B is reloaded with bt (outex loop). When register C finally reduces to 0, the program gets out of the loop. The modified flow chart and the program are given below : MVI A, 01 ; set Do to 1 'r' OUT: OUT PORT 2 ; output to LED ; rotate left Set up for LED MM C.32~ OUTER: MM B, IFFH 1 INNER: DCRB JNZ INNER loop DCR C JNZ OumR +-I Rotate I left I 0 Delay -1, Figure 18.6 : Modified Flow chart for Exarnplc 18.10

15 Example Write a program to copy the contents of 1610 consecutive memory locations starting at address 1000~ to 1610 successive memory locations starting at address 2000H. Solution 7 Start LXI H, la ; initialize address of 1 st block LXI D, 2 a ; initialize address of 2nd block Initialize memory addresses Read from. one location Write to the other location Decrement counter I I MVIB,lOH BACK : MOV A,M INR H XCHG MOV M,A INR H XCHG DCR B JNZ BACK HLT ; setupcounter for 16 ; readfromlst block ;,advance to next location ; (DXE)-(H)(L) ; write to 2nd block ; advance to next location ; if nat done, go back to copy the next byte ; stopexecution Figure 18.7 : Flow chart for Example SAQ 7 Write a program using 8085 assembly language to fmd the sum of loh numbers stored at successive locations in the memory starting at address 1000H. The sum should be stored at the location next to the last stored number. I SAQ 8 Write a program to search a block of 10~ successive memory locations starting at address 1000H to see if a specified byte of data (say AAH) is found in the block. If the byte is found, output 00~ to the output PORT2, otherwise output byte to the output PORT2.

16 L SAQ 9 All the bits of the accumulator in an 8085 microprocessor are 0 except one bit which is 1. Write a program to determine which bit is 1. The result should be a decimal number from 0 to 7 and should be found in register C SUMMARY In this unit, we have learnt about programming microprocessors. We learned the meygs of the terms, high level languages and assembly language and learned the difference between the two. We learned the formats of 8085 instructions, methods of representing and methods of addressing the data for program execution. We studied about different groups of 8085 instructions and learned in detail the instructions in each group. Finally, learned the techniques of writing programs for the 8085 microprocessor by writing a number of sample programs and solving problems in program writing ANSWERS TO SAQs SAQ 1 (a) (b) (c) represents a negative number = 6llO ; = = 67. The number is represents a positive number =5110;thenumberis represents a negative number = 76,o ; = = The number is SAQ 2 (a) +123;12310= ;signbitis ,0= 0111 loll2. (b) -123 ; = = 510 = Since the number is negative, the sign bit is i0 = SAQ ; llo=ooooool ; + l10= (c) 7 (d) -1 ;2-1 = = 12710= Ilo= A B C D E H L STA 1 WH MOV M, D MOV E, M LHLD 100IH

17 SAQ 4 SAQ 5 SAQ6 MVIB,~~H STA STA1003~ A B C H L lo AD E ACI SUB C F INXH F SBB M 9D A B C S Z AC P RLC AA RAL CMA AB \ CY 0 Note:OnlyCY flagisaffected fathisilmuctioa 1 Note : Only CY flag is affected for this instruc2ion. 1 Nok:Nofhgisaffectedfu this iastrudion. 0 SAQ 7 LXI H, 1000H ; initialize memory address MVIB,l& ;setupcounterforl& MVI A, % ; clear A ADD: ADD M ; add next byte of data INX H ; advance to next address DCR B ; decrement count by 1 JNZAD~ ;ifn~tzero,~obackto~ MOV.M,A ; write the sum in the memory HLT ; stop execution (See Figure on next page for Flow chart) SAQ 8 LXI H, 1000H ; initialize memory address MVI B, loh ; set up a counter for loh SEARCH: MOV A, M ; read memory CPI AAH ; compare with AAH JZ FOUND ; if zero, go to FOUND INX H ; if not, increment memory address DCR B ; decrement count JNZ SEARCH ; if count is not zero, search NOT FOUND: MVI A, FFH ; move FFH to A (not found) OUT PORT 2 ; output to PORT 2 JMP END ; go to END FOUND: MVI A, 00~ ; move 00~ to A (found) OUT PORT 2 ; output to PORT 2 END: HLT ; stop execution (See Figure on next page for Flow chart)

18 7 Start Initialize initialize mem. add ; Setup a counter set up a counter Move data from memory 1 and compare 1 Found : move Inc. mern. addr Dec. count el 'i Write sum to memory Not Found : c;=i Out Port I Figure fa Answa to SAQ 7 Fig- fa Answer to SAQ 8

19 FOUND: CLR C ; clear C to hold the bit position of 1 MVI B, OIH ; load B witb 01 to try out bit 0 ANA B ; ANDA with B JNZFOUND ;ifthetesultisnotzero,tbebitpositionisfd INR C ; if not, increment C RRC ; move the 1 in tbe accumdator to the next position to right JMP SEARCH ; search again HLT ; stop execution Clear c ; set bit 0 of B 9 AND B with A Plow chut for Aarwcs to SAQ 9

Instruction Set Instruction set of 8085 can be classified in following groups: Data Transfer Instructions These instructions can perform data transfer operations between Registers of 8085 e.g. MOV 8085

More information

8085 INSTRUCTION SET INSTRUCTION DETAILS

8085 INSTRUCTION SET INSTRUCTION DETAILS 8085 INSTRUCTION SET INSTRUCTION DETAILS DATA TRANSFER INSTRUCTIONS MOV Rd, Rs Copy from source to destination This instruction copies the contents of the source register Rs into the destination register

More information

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples. (1) Explain instruction format and Opcode format of 8085 μp with example. OR With help of examples, explain the formation of opcodes of 8085 OR What is an instruction? List type of instruction based on

More information

INSTRUCTION SET OF 8085

INSTRUCTION SET OF 8085 INSTRUCTION SET OF 8085 Instruction Set of 8085 An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The entire group of instructions that a microprocessor

More information

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1 Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1 High Level Language Compiler Assembly Language Assembler Machine Code Microprocessor Hardware 1/18/2011 2 8085A Instruction Set

More information

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI-621213. QUESTION BANK DEPARTMENT: EEE SUB CODE: EE2324 YR/ SEM:III/ VI SUB NAME: MICROPROCESSORS & MICROCONTROLLERS UNIT 2- PROGRAMMING OF 8085 MICROPROCESSORS

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor understands

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085

More information

SAMPLE STUDY MATERIAL

SAMPLE STUDY MATERIAL Microprocessor-IN Postal Correspondence Course 1 SAMPLE STUDY MATERIAL Instrumentation Engineering IN Postal Correspondence Course GATE & PSUs Microprocessor Microprocessor-IN Postal Correspondence Course

More information

MSMF GATE CENTRE. Sub: MICROPROCESSORS. Time: 50min Date: Marks:33

MSMF GATE CENTRE. Sub: MICROPROCESSORS. Time: 50min Date: Marks:33 MSMF GATE CENTRE Sub: MICROPROCESSORS Time: 50min Date:20-12-16 Marks:33 1. Which interrupt has highest priority in 8085 microprocessor? a) INTR b) RST 4.5 c) RST 6.5 d) RST 7.5 2. In 8085 microprocessor,

More information

م.م. ماجد عيدان. Introduction to microprocessor and microcomputer

م.م. ماجد عيدان. Introduction to microprocessor and microcomputer Lect. (1) Introduction to microprocessor and microcomputer Reference Books: 1. Ramesh S. Gaonkar, "Microprocessor Architecture, Programming and Application with the 8085". 2. Anokh Singh, A.K. Chhabra,Fundamentals

More information

UNIT 1 REFERENCE 1 PREPARED BY S.RAVINDRAKUMAR, LECT/ECE, CHETTINAD COLLEGE OF ENGG AND TECH, KARUR

UNIT 1 REFERENCE 1 PREPARED BY S.RAVINDRAKUMAR, LECT/ECE, CHETTINAD COLLEGE OF ENGG AND TECH, KARUR UNIT 1 REFERENCE 1 PROGRAMMING THE 8085 DEVELOPMENT OF PROGRAM A program is a sequence of instructions written to tell a computer to perform a specific function. The instructions are selected from the

More information

Practical Course File For

Practical Course File For Practical Course File For Microprocessor (IT 473) B.Tech (IT) IV-SEM Department of IT University Institute of Engineering & Technology Panjab University, Chandigarh Page 1 INTRODUCTION... 4 EXPERIMENT-1:

More information

Its Assembly language programming

Its Assembly language programming 8085 Architecture & Its Assembly language programming Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati 8085 Era and Features 8085 Outline Block diagram (Data Path) Bus Structure Register Structure

More information

EE309: Computer Organization, Architecture and MicroProcessors. sumantra/courses/up/up.html GND HIGH ORDER ADDRESS BUS

EE309: Computer Organization, Architecture and MicroProcessors.   sumantra/courses/up/up.html GND HIGH ORDER ADDRESS BUS CMP:8085 Primer-1 EE309: Computer Organization, rchitecture and MicroProcessors http://www.ee.iitb.ac.in/ sumantra/courses/up/up.html The 8085 Chip F LGS: S Z x x P x cy EXTERNLLY INITITED SIGNLS SERIL

More information

UNIT I. Differences between: Microcomputer, Microprocessor and Microcontroller

UNIT I. Differences between: Microcomputer, Microprocessor and Microcontroller UNIT I SYLLABUS INTRODUCTION TO 8085 Intel 8085 Microprocessor architecture signals Addressing modes Instruction classification Instruction set Timing diagram ALP format Programming 8085 8-bit and 16-bit

More information

EXAMPLE PROGRAMS 8085

EXAMPLE PROGRAMS 8085 P! EXAMPLE PROGRAMS 8085 Statement:Multiply the 8-bit unsigned number in memory location 2200H by the 8-bit unsigned number in memory location 2201H. Store the 8 least significant bits of the result in

More information

ELECTRICAL ENGINEERING

ELECTRICAL ENGINEERING Serial : 1. JP_EE_Microprocessor_130618 CLASS TEST Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: 011-45124612 ELECTRICAL ENGINEERING

More information

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web:     Ph: Serial :. PT_EE-EC_A_Microprocessor_968 Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: -452462 CLASS TEST 28-9 Subject : Microprocessors

More information

The 8085 Instruction Set

The 8085 Instruction Set 1 of 8 2/9/2011 5:14 PM The 8085 Instruction Set As I promised, in an earlier lesson, I am going to go through an in-depth explaination of ALL the 8085 instructions. Intel 88888 000 88888 5555555 A 8 8

More information

Unit 1 8 BIT MICROPROCESSOR ARCHITECTURE

Unit 1 8 BIT MICROPROCESSOR ARCHITECTURE Unit 1 8 BIT MICROPROCESSOR ARCHITECTURE 8085 -Internal Architecture - Addressing modes - Instruction set -Timing diagrams -Interrupts-Assembly language Programming 1. Internal Architecture of 8085 Microprocessor

More information

LIST OF PROGRAMS. Prg. Name of the Program. 1 Study of Pin Diagram of Study of Architecture of Study of 8085 Kit.

LIST OF PROGRAMS. Prg. Name of the Program. 1 Study of Pin Diagram of Study of Architecture of Study of 8085 Kit. LIST OF PROGRAMS Prg. Name of the Program No. 1 Study of Pin Diagram of 8085 2 Study of Architecture of 8085 3 Study of 8085 Kit 4 Reverse Order 5 Exchange of memory blocks 6 Absolute Difference 7 Even

More information

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web:     Ph: Serial : 01. ND_EE_NW_Microprocessors_150718 Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: 011-45124612 CLASS TEST 2018-19 ELECTRICAL

More information

Subject Code: Model Answer Page No: /25

Subject Code: Model Answer Page No: /25 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Programming of 8085 microprocessor and 8051 micro controller Study material

Programming of 8085 microprocessor and 8051 micro controller Study material 8085 Demo Programs Now, let us take a look at some program demonstrations using the above instructions Adding Two 8-bit Numbers Write a program to add data at 3005H & 3006H memory location and store the

More information

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT I THE 8085 & 8086 MICROPROCESSORS. PART A (2 Marks)

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT I THE 8085 & 8086 MICROPROCESSORS. PART A (2 Marks) MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI-621213. UNIT I THE 8085 & 8086 MICROPROCESSORS PART A (2 Marks) 1. Give the significance of SIM and RIM instruction available in 8085. [NOV/DEC 2006] Instruction

More information

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller of 8085 microprocessor 8085 is pronounced as "eighty-eighty-five" microprocessor. It is an 8-bit microprocessor designed by Intel in 1977 using NMOS technology. It has the following configuration 8-bit

More information

Computer Organization

Computer Organization Computer Organization (Instruction set Architecture & Assembly Language Programming) KR Chowdhary Professor & Head Email: kr.chowdhary@gmail.com webpage: krchowdhary.com Department of Computer Science

More information

Microcontroller Intel [Instruction Set]

Microcontroller Intel [Instruction Set] Microcontroller Intel 8051 [Instruction Set] Structure of Assembly Language [ label: ] mnemonic [operands] [ ;comment ] Example: MOV R1, #25H ; load data 25H into R1 2 8051 Assembly Language Registers

More information

Assembly language Programming

Assembly language Programming Assembly language Programming Applications With out the assembly language programming microprocessor can not works. Instructions are the patterns which is require by the microprocessor to done any task.

More information

GATE Exercises on Microprocessors

GATE Exercises on Microprocessors 1 GATE Exercises on Microprocessors Abstract This problem set has questions taken from GATE papers over the last twenty years. Teachers can use the problem set for courses tutorials. 1) The clock frequency

More information

8085 Microprocessor Programs

8085 Microprocessor Programs 8085 Microprocessor Programs Courtesy : www.8085projects.info Rachit Agrawal 07-CE-52 Kalol Institute of Technology & Research Center PROGRAMS FOR 8085 MICROPROCESSOR PROGRAMS FOR LEARNERS 1. Store 8-bit

More information

LABORATORY MANUAL. PROGRAMME: B.Tech SEMESTER /YEAR: 3rd year 5th Semester SUBJECT CODE: CS592 SUBJECT NAME: Microprocessor & Microcontroller Lab

LABORATORY MANUAL. PROGRAMME: B.Tech SEMESTER /YEAR: 3rd year 5th Semester SUBJECT CODE: CS592 SUBJECT NAME: Microprocessor & Microcontroller Lab LABORATORY MANUAL PROGRAMME: B.Tech SEMESTER /YEAR: 3rd year 5th Semester SUBJECT CODE: CS592 SUBJECT NAME: Microprocessor & Microcontroller Lab DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING INSTITUTE OF

More information

G. Pullaiah College of Engineering and Technology: Kurnool Department Of Electronics and Communication Engineering

G. Pullaiah College of Engineering and Technology: Kurnool Department Of Electronics and Communication Engineering G. Pullaiah College of Engineering and Technology: Kurnool Department Of Electronics and Communication Engineering LECTURE NOTES MICROPROCESSORS AND INTERFACING PREPARED BY V.SHANTHI ASST PROFESSOR DEPT

More information

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers 1. Define microprocessors? UNIT-I A semiconductor device(integrated circuit) manufactured by using the LSI technique. It includes

More information

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor Subject Name: Microprocessor and Microcontroller Year: 3 rd Year Subject Code: CS502 Semester: 5 th Module Day Assignment 1 Microprocessor

More information

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman Microprocessors 1 The 8051 Instruction Set Microprocessors 1 1 Instruction Groups The 8051 has 255 instructions Every 8-bit opcode from 00 to FF is used except for A5. The instructions are grouped into

More information

Instruction set of 8085

Instruction set of 8085 Instruction set of 05 /23/2016 ptkarule@rediffmail.com 1 Instruction set of 05 Instruction set is divided into various groups depending on the operations performed: 1. Data transfer 2. rithmetic 3. Logical

More information

SIR.C.R.R.COLLEGE OF ENGINEERING DEPT. OF ELECTRONICS AND INSTRUMENTATION ENGG. EIE-328: MICROPROCESSOR LABORATORY 3/4 B.E. EIE: SECOND SEMESTER

SIR.C.R.R.COLLEGE OF ENGINEERING DEPT. OF ELECTRONICS AND INSTRUMENTATION ENGG. EIE-328: MICROPROCESSOR LABORATORY 3/4 B.E. EIE: SECOND SEMESTER SIR.C.R.R.COLLEGE OF ENGINEERING DEPT. OF ELECTRONICS AND INSTRUMENTATION ENGG. EIE-328: MICROPROCESSOR LABORATORY 3/4 B.E. EIE: SECOND SEMESTER (AS PER UNIVERSITY SYLLABUS) LIST OF EXPERIMENTS 1. UNDERSTANDING

More information

Contents 8051 Instruction Set BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter I : Control Transfer Instructions Lesson (a): Loop Lesson (b): Jump (i) Conditional Lesson (c): Lesson (d): Lesson (e):

More information

COPYRIGHT IS NOT RESERVED BY AUTHORS. AUTHORS ARE NOT RESPONSIBLE FOR ANY LEGAL ISSUES ARISING OUT OF ANY COPYRIGHT DEMANDS

COPYRIGHT IS NOT RESERVED BY AUTHORS. AUTHORS ARE NOT RESPONSIBLE FOR ANY LEGAL ISSUES ARISING OUT OF ANY COPYRIGHT DEMANDS COPYRIGHT IS NOT RESERVED BY AUTHORS. AUTHORS ARE NOT RESPONSIBLE FOR ANY LEGAL ISSUES ARISING OUT OF ANY COPYRIGHT DEMANDS AND/OR REPRINT ISSUES CONTAINED IN THIS MATERIALS. THIS IS NOT MEANT FOR ANY

More information

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER OBJECT: EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER To understand the structure and operating instruction of the microprocessor trainer. INTRODUCTION: The MKT 8085 is a single-board microcomputer,

More information

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT ELECTRONICS AND COMMUNICATION ENGINEERING CS 2252-MICROPROCESSOR AND MICROCONTROLLER COURSE NOTES UNIT I 8085 MICROPROCESSOR OBJECTIVES:.* Study

More information

1 = Enable SOD 0 = Disable SOD. Serial Output Data. Fig.12.9 SIM Instruction Format

1 = Enable SOD 0 = Disable SOD. Serial Output Data. Fig.12.9 SIM Instruction Format Lecture-67 The 8085 Serial I/O Lines: SOD & SID The 8085 microprocessor has two pins specially designed for software control serial I/O. One is called SOD (serial output data) and the other is called SID

More information

S.R.M. INSTITUTE OF SCIENCE & TECHNOLOGY SCHOOL OF ELECTRONICS & COMMUNICATION ENGINEERING

S.R.M. INSTITUTE OF SCIENCE & TECHNOLOGY SCHOOL OF ELECTRONICS & COMMUNICATION ENGINEERING S.R.M. INSTITUTE OF SCIENCE & TECHNOLOGY SCHOOL OF ELECTRONICS & COMMUNICATION ENGINEERING QUESTION BANK Subject Code : EC307 Subject Name : Microprocessor and Interfacing Year & Sem : III Year, V Sem

More information

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web:     Ph: Serial : LS2_EE_S_Microprocessors_2688 Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: -452462 CLASS TEST 28-9 ELECTRICAL ENGINEERING

More information

(2½ Hours) [Total Marks: 75]

(2½ Hours) [Total Marks: 75] (2½ Hours) [Total Marks: 75] N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.

More information

8051 Overview and Instruction Set

8051 Overview and Instruction Set 8051 Overview and Instruction Set Curtis A. Nelson Engr 355 1 Microprocessors vs. Microcontrollers Microprocessors are single-chip CPUs used in microcomputers Microcontrollers and microprocessors are different

More information

SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU DIGITAL ELECTRONICS & MICROPROCESSOR LAB MANUAL 2/4 CSE: II- SEMESTER

SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU DIGITAL ELECTRONICS & MICROPROCESSOR LAB MANUAL 2/4 CSE: II- SEMESTER SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU 534007 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DIGITAL ELECTRONICS & MICROPROCESSOR LAB MANUAL 2/4 CSE: II- SEMESTER Faculty: B.Homer Benny (Section- A

More information

INDEX. 1 Study of intel 8085 micropeocessor kit. 2 Program to find addition of two 8 bit no. 3 Program to find subtraction of two 8 bit no.

INDEX. 1 Study of intel 8085 micropeocessor kit. 2 Program to find addition of two 8 bit no. 3 Program to find subtraction of two 8 bit no. INDEX PROGRAM NO. NAME OF THE PROGRAM 1 Study of intel 8085 micropeocessor kit SIGNATURE 2 Program to find addition of two 8 bit no. 3 Program to find subtraction of two 8 bit no. 4 Program to find 1 s

More information

Micro Processor & Micro Controllers

Micro Processor & Micro Controllers Micro Processor & Micro Controllers 1. What is microprocessor? It is a program controlled semi conductor device (IC), which fetches, decodes and execute instructions. 2. What are the basic units of microprocessor?

More information

Microcontroller. Instruction set of 8051

Microcontroller. Instruction set of 8051 UNIT 2: Addressing Modes and Operations: Introduction, Addressing modes, External data Moves, Code Memory, Read Only Data Moves / Indexed Addressing mode, PUSH and POP Opcodes, Data exchanges, Example

More information

CS2259-MICROPROCESSOR AND MICROCONTROLLER LABORATORY MANUAL

CS2259-MICROPROCESSOR AND MICROCONTROLLER LABORATORY MANUAL CS2259-MICROPROCESSOR AND MICROCONTROLLER LABORATORY LABORATORY MANUAL FOR IV SEMESTER B.TECH / IT ACADEMIC YEAR: 2012-2013 (FOR PRIVATE CIRCULATION ONLY) ANNA UNIVERSITY, CHENNAI. NAME REG.NO BATCH :

More information

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING Instructions Alphabetical List of Instructions ACALL: Absolute Call ADD, ADDC: Add Accumulator (With Carry) AJMP: Absolute Jump ANL: Bitwise AND CJNE: Compare

More information

ROEVER ENGINEERING COLLEGE

ROEVER ENGINEERING COLLEGE ROEVER ENGINEERING COLLEGE ELAMBALUR, PERAMBALUR- 621 212 DEPARTMENT OF INFORMATION TECHNOLOGY MICROPROCESSOR & MICROCONTROLLER 2 marks questions andanswers Unit I 1. Define microprocessor? A microprocessor

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER MODEL ANSWER SUMMER 17 EXAMINATION Subject Title: Microprocessor Subject Code: 17443 I m p o r t a n t I n s t r u c t i o n s t o e x a m i n e r s : 1) The answers should be examined by key words and

More information

AE66/AC66/AT66/ AE108/AC108/AT108 MICROPROCESSORS & MICROCONTROLLERS

AE66/AC66/AT66/ AE108/AC108/AT108 MICROPROCESSORS & MICROCONTROLLERS Q.2 a. Draw pin diagram and signal group diagram of 8085 microprocessor. (8) b. List out the various categories of the 8085 instructions. Give examples of the instructions for each group. (8) Data transfer

More information

Microprocessor Micro Syllabus BSc. CSIT, IOST, TU. Microprocessor

Microprocessor Micro Syllabus BSc. CSIT, IOST, TU. Microprocessor Microprocessor Micro Syllabus BSc. CSIT, IOST, TU Microprocessor Course Title: Microprocessor Full Marks: 60 + 20 + 20 Course No: CSC162 Pass Marks: 24 + 8 + 8 Nature of the Course: Theory + Lab Credit

More information

Valliammai Engineering College

Valliammai Engineering College Valliammai Engineering College SRM Nagar, Kattankulathur - 603203 Department of Electrical and Electronics Engineering EE6612 Microprocessors and Microcontrollers Laboratory LAB MANUAL VI Semester - Electrical

More information

SN8F5000 Family Instruction Set

SN8F5000 Family Instruction Set SONiX Technology Co., Ltd. 8051-based Microcontroller 1 Overview SN8F5000 is 8051 Flash Type microcontroller supports comprehensive assembly instructions and which are fully compatible with standard 8051.

More information

Lecture-19 MICROPROCESSOR INSTRUCTIONN SET: Each subsystem in a microprocessor based system the memory, the microprocessor and the input and output

Lecture-19 MICROPROCESSOR INSTRUCTIONN SET: Each subsystem in a microprocessor based system the memory, the microprocessor and the input and output Lecture-19 MICROPROCESSOR INSTRUCTIONN SET: Each subsystem in a microprocessor based system the memory, the microprocessor and the input and output devices- can be thought of in terms of the registers

More information

1. What is Microprocessor? Give the power supply & clock frequency of 8085?

1. What is Microprocessor? Give the power supply & clock frequency of 8085? 1. What is Microprocessor? Give the power supply & clock frequency of 8085? A microprocessor is a multipurpose, programmable logic device that reads binary instructions from a storage device called memory

More information

Machine Cycle- 2 or (Machine Cycle-1 of next instruction):

Machine Cycle- 2 or (Machine Cycle-1 of next instruction): Lecture-29 17. CMA: (Complement accumulator) This is an ALP statement. The meaning of the instruction is Complement the content of accumulator bit by bit and store the result back into the accumulator.

More information

MGM S Jawaharlal Nehru Engineering College

MGM S Jawaharlal Nehru Engineering College MGM S Jawaharlal Nehru Engineering College Laboratory Manual MICROPROCESSOR AND INTERFACING TECHNIQUES For TE (EEP) Prof.J.R.Rana Author JNEC, Aurangabad PREFACE It is my great pleasure to present this

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

EKT222 Miroprocessor Systems Lab 5

EKT222 Miroprocessor Systems Lab 5 LAB 5: Interrupts Objectives: 1) Ability to define interrupt in 8085 microprocessor 2) Ability to understanding the interrupt structure in the 8085 microprocessor 3) Ability to create programs using the

More information

Matrix Multiplication in 8085

Matrix Multiplication in 8085 Matrix Multiplication in 8085 Semester Project for B.Tech. (Computer Science & Engineering) by Praneeth A S (UG20110023) & Rohit Yeravothula (UG201110039) Project Guide: Dr. K R Chowdhary Head of Department,

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP 805 SFR Bus Digital Blocks Semiconductor IP 805 Microcontroller Configurable Peripherals General Description The Digital Blocks (Configurable Peripherals) Microcontroller Verilog IP Core is complaint with

More information

Counters & Time Delays. Microprocessors & Interfacing 1

Counters & Time Delays. Microprocessors & Interfacing 1 Counters & Time Delays Microprocessors & Interfacing 1 Counters A loop counter is set up by loading a register with a certain value Then using the DCR (to decrement) and INR (to increment) the contents

More information

1. What is microprocessor? It is a program controlled semi conductor device (IC), which fetches, decodes and execute instructions.

1. What is microprocessor? It is a program controlled semi conductor device (IC), which fetches, decodes and execute instructions. Downloaded from www.books4career.blogspot.com 1. What is microprocessor? It is a program controlled semi conductor device (IC), which fetches, decodes and execute instructions. 2. What are the basic units

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP Digital Blocks Semiconductor IP 805 Microcontroller General Description The Digital Blocks Microcontroller Verilog IP Core is complaint with the MCS 5 Instruction Set and contains standard 805 MCU peripherals,

More information

8051 Microcontrollers

8051 Microcontrollers 8051 Microcontrollers Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu March 15, 2016 8051 INSTRUCTIONS JUMP, LOOP AND CALL INSTRUCTIONS 8051 INSTRUCTIONS Repeating a sequence of instructions

More information

Q. P. Code : b. Draw and explain the block dig of a computer with microprocessor as CPU.

Q. P. Code : b. Draw and explain the block dig of a computer with microprocessor as CPU. Q. P. Code : 08235 (2½ Hours) [Total Marks: 75] N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question

More information

Q. Classify the instruction set of 8051 and list out the instructions in each type.

Q. Classify the instruction set of 8051 and list out the instructions in each type. INTRODUCTION Here is a list of the operands and their meanings: A - accumulator; Rn - is one of working registers (R0-R7) in the currently active RAM memory bank; Direct - is any 8-bit address register

More information

TYPES OF INTERRUPTS: -

TYPES OF INTERRUPTS: - There are 3 types of interrupts. TYPES OF INTERRUPTS: - External Interrupts. Internal Interrupts. Software interrupts. Hardware Interrupts (1) External interrupts come from I/O devices, from a timing device

More information

3.0 Instruction Set. 3.1 Overview

3.0 Instruction Set. 3.1 Overview 3.0 Instruction Set 3.1 Overview There are 16 different P8 instructions. Research on instruction set usage was the basis for instruction selection. Each instruction has at least two addressing modes, with

More information

The due date for submitting this assignment has passed. 1) How many times will the following loop be executed? Depends on the initial value of A

The due date for submitting this assignment has passed. 1) How many times will the following loop be executed? Depends on the initial value of A X reviewer2@nptel.iitm.ac.in Courses» and Microcontrollers Unit 4 - Week 3 Announcements Course Ask a Question Progress Mentor Course outline How to access the portal Week 3 Assignment The due date for

More information

MICROPROCESSOR BASICS AND RELATED TERMS

MICROPROCESSOR BASICS AND RELATED TERMS MICROPROCESSOR BASICS AND RELATED TERMS Microprocessor: Programmable integrated device that has computing ability and decision making capacity. It is the CPU of computer. A multipurpose, programmable,

More information

3.1 DATA MOVEMENT INSTRUCTIONS 45

3.1 DATA MOVEMENT INSTRUCTIONS 45 3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,

More information

Chapter Four Instructions Set

Chapter Four Instructions Set Chapter Four Instructions set Instructions set 8086 has 117 instructions, these instructions divided into 6 groups: 1. Data transfer instructions 2. Arithmetic instructions 3. Logic instructions 4. Shift

More information

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples. MICROCONTROLLERS AND APPLICATIONS 1 Module 2 Module-2 Contents: Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples. MEMORY

More information

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE: 1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE: A microprocessor is a programmable electronics chip that has computing and decision making capabilities similar to central processing unit

More information

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP Digital Blocks Semiconductor IP DB805C-FSM 805 Microcontroller FSM Finite State Machine General Description The Digital Blocks DB805C-FSM IP Core contains Digital Blocks compact DB805C CPU Core & GPIO

More information

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts Lecture 4 Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts One part is the task to be performed, called operation code or opcode in

More information

B.C.A 2017 MICROPROCESSOR AND ASSEMBLY LANGUAGE MODULE SPECIFICATION SHEET. Course Outline

B.C.A 2017 MICROPROCESSOR AND ASSEMBLY LANGUAGE MODULE SPECIFICATION SHEET. Course Outline B.C.A 2017 MICROPROCESSOR AND ASSEMBLY LANGUAGE Course Outline MODULE SPECIFICATION SHEET The objective of the course is to expose to the students to the architecture and instruction set of typical 8-bit

More information

PERIPHERAL INTERFACING Rev. 1.0

PERIPHERAL INTERFACING Rev. 1.0 This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en

More information

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING YEAR : III SEM : VI

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING YEAR : III SEM : VI DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING YEAR : III SEM : VI EE2354- MICROPROCESSORS AND MICROCONTROLLER UNIT I 8085 and 8086 PROCESSOR PART A 1. Define

More information

1. Internal Architecture of 8085 Microprocessor

1. Internal Architecture of 8085 Microprocessor Practical 1 Date : AIM : Introduction Of Microprocessor 8085. 1. Internal Architecture of 8085 Microprocessor Control Unit Generates signals within µp to carry out the instruction, which has been decoded.

More information

1. Internal Architecture of 8085 Microprocessor

1. Internal Architecture of 8085 Microprocessor Practical 1 Date : AIM : Introduction Of Microprocessor 8085. 1. Internal Architecture of 8085 Microprocessor Control Unit Generates signals within µp to carry out the instruction, which has been decoded.

More information

CPU Design John D. Carpinelli, All Rights Reserved 1

CPU Design John D. Carpinelli, All Rights Reserved 1 CPU Design 1997 John D. Carpinelli, All Rights Reserved 1 Outline Register organization ALU design Stacks Instruction formats and types Addressing modes 1997 John D. Carpinelli, All Rights Reserved 2 We

More information

Intel 8086: Instruction Set

Intel 8086: Instruction Set IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction

More information

ORG ; TWO. Assembly Language Programming

ORG ; TWO. Assembly Language Programming Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify

More information

DE60/DC68 MICROPROCESSORS & MICROCONTROLLERS JUN 2015

DE60/DC68 MICROPROCESSORS & MICROCONTROLLERS JUN 2015 Q.2 a. Draw block diagram schematic of 8085 bus structure. Explain buses/ communication lines used by 8085. (6) 8085 Bus organization structure: 8085 MPU and peripheral devices communicate through three

More information

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory

More information

PERIPHERAL INTERFACING Rev. 1.0

PERIPHERAL INTERFACING Rev. 1.0 This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en

More information

The advantages of registers over memory locations are as follows:

The advantages of registers over memory locations are as follows: Q.2 a. In a microprocessor, what is the use of a register? What are the advantages & disadvantages of using registers over a memory location? What is the speciality of register A (accumulator) over other

More information

Computer System Architecture

Computer System Architecture CSC 203 1.5 Computer System Architecture Department of Statistics and Computer Science University of Sri Jayewardenepura Addressing 2 Addressing Subject of specifying where the operands (addresses) are

More information

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

ET355 Microprocessors Thursday 6:00 pm 10:20 pm ITT Technical Institute ET355 Microprocessors Thursday 6:00 pm 10:20 pm Unit 4 Chapter 6, pp. 139-174 Chapter 7, pp. 181-188 Unit 4 Objectives Lecture: BCD Programming Examples of the 805x Microprocessor

More information

MICROPROCESSOR AND MICROCONTROLLER

MICROPROCESSOR AND MICROCONTROLLER A Course Material on By Mr. C.JAGADEESHWARAN ASSISTANT PROFESSOR DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING SASURIE COLLEGE OF ENGINEERING VIJAYAMANGALAM 638 56 QUALITY CERTIFICATE This is to

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LAB MANUAL. Academic Year: ODD SEMESTER

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LAB MANUAL. Academic Year: ODD SEMESTER DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LAB MANUAL Academic Year: 2015-16 ODD SEMESTER Programme (UG/PG) : UG-B.Tech Semester : 03 Course Code Course Title :CS1033 : MICROPROCESSOR & INTERFACING

More information