GGSIPU Mid-Term-1 April 2022 Solution Microprocessors by Ravinder Nath Rajotiya - April 11, 2022April 11, 20220 Share on Facebook Share Send email Mail Print Print Solution MT-1 April 2022 ETEE 310 Microprocessors and Microcontrollers Time 1.5 Hours MM: 30 Table of Contents Toggle Q1. Differentiate between PC and SPQ1. (b) Briefly describe different memory technologies used in microprocessor system.Q.1 (c) What are one byte, two byte, and three byte instructions?Q.1 (d) Explain the concept of memory segmentation in 8086.Q.1 (e) Discuss the function of INTR, NMI, ALE, READY.Q2.(a) What is an assembly language program? Explain it with the help of an example.Q.2(b) What is a subroutine? Write a software routing for 8085Q3.(a) Connect 128K word ( 128×16) RAM with the system lines of 8086 microprocessor. Assume suitable addressQ3.(b) Draw the timing diagram of minimum mode memory read cycleQ4. (a) Write a program for 8086 microprocessor (using assemble directive ) to add two numbers of 10 bytes each. Q1. Differentiate between PC and SP Sl PC SP 1 Program counter (PC) points to the next instruction in memory to be executed Stack Ponter(SP) points to the top of the stack memory from where an item could be accessed 2 It is auto incremented for normal sequential program Incremented for PUSH and for POP operation an item accessed and the SP decremented for stack-up configuration Q1. (b) Briefly describe different memory technologies used in microprocessor system. A microprocessor system does not contain any memory internally other than the set of registers. Memory can be interfaced externally with the microprocessor. They can be in the form of primary memories which are random access memory (RAM ) and read only memory ( ROM) RAM comes as SRAM, SDRAM, DRAM, DDRAM ROM comes in various types as Masked ROM, PROM, EPROM, EEPROM Q.1 (c) What are one byte, two byte, and three byte instructions? Microprocessor instruction sets can be classified depending on the size of the instruction. One byte instructions – These instructions have implied operands and take one byte space in memory. Examples of such instructions are CMC, STC, CLC, Two byte instructions – These instructions are of two byte in size. The first byte is the OPCODE and the second byte is the operand. Examples are MVI B, 55h, ANI 35h Three byte instructions – These instructions are three byte in size. First byte is the OPCODE and the subsequent two byte are the operand or address of the operand. Examples – LXI H, 2050h; LDA 2000h Q.1 (d) Explain the concept of memory segmentation in 8086. 8086 microprocessor supports 1MB of memory. To address 1MB it requires a 20 bit address, but it does not have a 20 bit address register. Instead, all address registers (segment/pointer registers) are 16 bit. Concept of memory segmentation allows 1 MB memory to be accessed using only the 16-bit registers. Thus the 1 MB memory of 8086 is logically divided into four segments, each segment is of 64KB in size which could be easily accessed using any 8086 address registers. These segments are : Code Segment Data Segment Stack Segment Extra Segment To address the memory we then require two addresses these are the segment value of the address and the effective address. The physical address of 20 bit will be formed using thses two addresses: Physical address = segment value x 10h + EA Q.1 (e) Discuss the function of INTR, NMI, ALE, READY. INTR: It is an interrupt pin on the microprocessor indicating an interrupt signal. It is a vectored and maskable interrupt, and the lowest priority. NMI : NMI is a non-maskable interrupt pin on a microprocessor. Signal of very critical in nature are applied to this pin. Once an interrupt signal arrives on this pin, the ISR for that interrupt will be processed. This has the highest priority in 8086 system. ALE: Full form of the ALE is address latch enable. In a microprocessor system, this pin is connected to the enable pin of the address latch. When ALE signal is active it enables the latch to latch the address at the output. Thus dividing the AD lines into two separate lines called as address lines ot address bus and the data bus. READY : This signal is used to synchronize the slow speed peripherals with the microprocessor. This signal is used by the peripherals and memory devices in order to show the readiness for the next operation Q2.(a) What is an assembly language program? Explain it with the help of an example. An assembly language is a symbolic machine language having one-to-one correspondence with the OPCODE of an instruction. This language was evolved to make the human task of remembering and writing the programs for a given processor. As the program or instructions are written using a human readable mnemonic or symbols, an assemble software is required for a system to convert the symbolic program into the machine program which is to be executed by the microprocessor. Example of an assembly program: The following code exemplifies an assembly program to add the values of two registers. MVI A, 55h ; Mov an immediate value Hex 55 into accumulator MVI B, 35h ; Mov an immediate value Hex 35 into register B MVI D, 0h ; Clear to save carry ADD B ; Adds the conten of accumulator and register B; A=A+B STA 2050h ; saves the sum at address 2050 JNC save_carry INR D ; increment D if carry arises Save_carry: MOV A, D ; mov carry to accumulator STA 2051h ; save carry at address 2051h HLT Q.2(b) What is a subroutine? Write a software routing for 8085 A subroutine is a subprogram written to perform a specific task or routine for a main program. Once written, a subroutine can be called any number of times from within the main program to perform that assigned task. The concept of the subroutine allows the code reusability and relieves the coder from the effort of writing and understanding the program. Software delay in assembly can be very easily implemented using the subroutine using the concept of loop statements. We only need to understand the concept of T states an instruction take to execute. Sum all the T states in a loop inside the subroutine and multiply with the time for each T state. Here is a simple example of writing a 1 ms delay for 8085 having the clock frequency of 2MHz 1 ms = (no. of T States * N)* time/Tstate 15 Count *0.5us = 1ms + 3*0.5us Count = 134 Delay: MVI C, Count again : NOP 1T DCR C 4T JNZ again 10/7T 1ms= (15* Count – 3)*0.5us Q3.(a) Connect 128K word ( 128×16) RAM with the system lines of 8086 microprocessor. Assume suitable address Total address space 128K word = 258 K byte. No of address lines = 18 (A17 – A0) A19 A18 A17 A16 A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 The use of BHE’ and A0 is evident from the following table BHE’ AO usage 0 0 Both bytes accessed 0 1 High Byte (Odd memory bank) 1 0 Low byte (Even memory bank) 1 1 None selected 128 K word= 256 byte of memory interfacing with 8086 system. Q3.(b) Draw the timing diagram of minimum mode memory read cycle Q4. (a) Write a program for 8086 microprocessor (using assemble directive ) to add two numbers of 10 bytes each. Data segment A DB 26h.24h,32h, 34h, 45h,65h,67h,76h,66h, 55h B DB 27h.74h,32h, 34h, 15h,05h,67h,76h,56h, 25h SUM DB 11 dup(0) Data ends Code segment Assume CS: code, DS: data MOV AX, data MOV DS, AX LEA SI, A LEA BX, B LEA DI, SUM MOV CL, 0Ah MOV CH, 00h nextByte : MOV AL, [SI] ADC AL, [BX] MOV [DI], AL INC SI INC BX DEC DI DEC CL JNZ nextByte JNC save_carry INC CH save_carry: DEC DI MOV [DI], CH Code ends Share on Facebook Share Send email Mail Print Print