0% found this document useful (0 votes)
43 views7 pages

Midterm Solution

Solution

Uploaded by

Mohammad Zayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
43 views7 pages

Midterm Solution

Solution

Uploaded by

Mohammad Zayan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Page: TE att yg ys Name Cara Ghulam Ishaq Khan institute of SN i Engineering Sciences and Technology ee Max Time allowed: 601 | Max Points: 30 Mid-Term F: a es amination ins -222 Microprocessor Systems (CLO-1; CLO-2; CLO-3; PLO-1; PLO-2, Cog © Level 2+3 (Understanding + Applying)] NOTE: No extra sheets will be provided. Read the questions and instructions carefully Question 1: Check the code below and select the correct options from the given MCQ’s (5) PSW: PROGRAM STATUS WORD, BIT ADDAESSABLE 18H 1FH ORG OOH; All memory is by default zero at the code initiation. SP default value is 07H SETB PSW.3 MOV RO, #20 INC RO PUSH OH _ ; First SP is incremented, then data from mentioned location is pushed there PUSH 1H __; Same for all PUSH commands PUSH 0 POP 2H ; First data from stack is popped to given location and then SP is decremented POP | POP 0H END 1) What is the value at address 00H after the execution of this code? Oo) (b) 01 (©) 20 (21 2) What is the value at address 01H after the execution of this code? (6) 01 © 20 @21 Page 2 3) What is the value at address 07H after the execution of this code? (b) 01 (©) 20 (d) 21 4) What QD (b) 01 (c) 20 @21 the value at address 08H after the execution of this code? 5) What is the value of RO after the execution of this code? ( 01 (g) 20 (h) 21 Question 2: Write a code to implement a traffic light system which follows the sequence given below. Use timers to create the delay/delays. (10) 1 ce aoe RED [<6 sec | 5] 4 sec Jzsece—4 see3f_ |2 see] t i i 1 ' i oe i ORANGE GREEN \ K—4 sec] i <—4 sec >| Red light is connected to P2.0, Orange light to P2.1, and Green light to P2.2. Clearly show the calculations you made for delay and to calculate the register values. Also write comments with your code to clarify your logic. Codes without comments will marked out of 7. Question 3: Given below is the instruction set and block diagram of'a basic computer with summary of all commands. You have to design an application specific computer using the given information that can execute the following task. (1s) 1. Get data from input register (INPR) that is connected to any source and save it in AC 2. Add the data already there in memory location 195H (M[195H)) to the received data 3. Store the [Link] M[166H] and also send the lower 8-bits of the data to output (OUTR) First write the step by step code for the given task along with the control expression for each instruction (Use the given instruction set). Then write the control expressions of all the involved inputs of all the registers/memory/bus used in all the commands combined. Ignore the Flags/Interrupts. Also write the binary contents of instruction register (IR) for each step Fetch Decode Indirect Interrupt Ton Memory-Reference AND ADD LDA STA BUN BSA Isz. DoT: Date: Dita: Dit: Register-Reference CLA CLE CMA CME CIR ciL INC SPA SNA SZA SZE HLT Input-Output INP OUT SKI sKO ION lOF D,I'T3=r IR() =B, cs Page 3 AR «PC IR¢-M[AR], PC «PC +4 00, ..., D7 « Decode IR(12~ 14), AR ¢ IR(0~ 11), 1 « AR © MIAR) ( ) Pe IR(18) Re1 AR«0,TRePC MIAR] & TR, PC 0 PC DReDR+1 M[AR] — OR, if(DR=0) then (PC < PC + 1), Sce0 (Common to all register-reference instr) (i= 01,2, .., 11) SCe0 ACeO E«0 AC+AC’ Ece AC € shrAC,AC(18) G0) a encesaceoe ODE (se Oso Yonsei) nop ( aD) saat CaaS EEN CN oniyosoisat on c'vo Our Csey > Nv g 9100;9990; 0006 ene Cov oy (ney) Me Cones Cucnas) ED Ce ADA EUG LG I IGN) Leek = ey, f > ma Seen Say \ Serres Sees nay (oS Cuetec ee aap re eee eo Ove nel N= Casey ES cea SNe CLC CaN ai 3 + D2, (Bye Bw) DRA cow = © STO Moy Tod 4 01 Mov R., Hos Aaa s up Scars om Pay ag Rae \ co Delay Sao R2-0 ce Pay aby Q24 cA Deley : Sea, Pr.0 oo metal he Pro Coxt delay : SL ae 220 an R221 5 ae Pr-0 Cet ddag ds Pr.0 Bs Pr) Carle Porn, Cot akg de Rr-0 Soke Pr.) ae e2-2 Ce delay some Roan 5 Delay > Mov Bo, #3) Rgsuk ¢ Mov THO,s#03H Mov TLo,# OFCH Seds Teo ING TOS, Vin Re 2 RO; Repead Man Loop Dae Getle Y dindes Qos him 5. 3% ard ho SD second cmh cetes ot cat Ughh 6” acd Reperd bray Myla 7 Peleg 2 secon chy To Ore ot Naren, Mou hos wb 3] My Oh Ag Ve cere Hicatt Aoow NoP CWws Ro, # 0, One ONE: Z£eo Sab P2.0 pe Cy P2.1 oan Aca DeLay anc RO SImP AGA Two: cive eo,4 2, Wiees THRse Seth P2.0 Seth Pr-1 a Ay Pr.2 AchcL DeLay INC Ro SSMP ftcAWw FOE: CINE RO, oy Piye es Genes Uae ty Sth e2.2 Rent Delhy Zne eo SOme Noa eens Mev 20,46 Dery. Simp Aaa Repent Mov Mov THO, # O34 TLo, # ofc | CINe 20,4 1 Two Sede Pro lr Tee Che Prd Acace — DeLthy Ine Ro comp AoA CINE RO, 3, Foun dr 02-9 Gy Pt Seth Pra Act decay INC Ro SSMP AGAIN cave hy Seth Bs 80, wo, Rerer 2.6 21 Pr Feat vet ay INc Ro Sim AGaw Cea » MOV THe, Ho3H Mou Ses Tue Dswz Rex COR areal oc TRo TPO st re RN Ripaat SD ca ears tea ee ye Moke 5 dey aN tee Seay (64516 « 31) 2 So ee BMD GACY cl, oe O3FE (ie RopRUStwalrceve ey) ose ee eae Ro 2/ SemOctacemiec vo teu. Ry Cotten) O- Ran I ne \ 8 Cx @ ae) | | oO 3 > Ye ° ic Ss © ° ° { : ° Caine ONO a Cow: heck eaicdee ti Po sete Se cond Apprnct

You might also like