Skip to main content
  1. Resources/
  2. Study Materials/
  3. Electronics & Communication Engineering/
  4. ECE Semester 4/
  5. Microprocessor & Microcontroller (4341101)/

Microprocessor and Microcontroller (4341101) - Winter 2023 Solution

19 mins· ·
Study-Material Solutions Microprocessor 4341101 2023 Winter
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

Question 1(a) [3 marks]
#

Compare RISC and CISC.

Answer:

FeatureRISCCISC
InstructionsSimple, fixed-lengthComplex, variable-length
ExecutionSingle cycleMultiple cycles
Addressing modesFewMany
RegistersManyFew
Design focusHardware simplicityCode density

Mnemonic: “RISCs Complete Instructions Simply”

Question 1(b) [4 marks]
#

Compare Von-Neumann and Harvard architecture.

Answer:

FeatureVon-NeumannHarvard
MemorySingle shared memorySeparate program & data memory
BusSingle bus for data & instructionsSeparate buses
SpeedSlower (memory bottleneck)Faster (parallel access)
ComplexitySimpler designMore complex
ApplicationsGeneral computingReal-time systems

Diagram:

VHoanCrC-PvPNUaUerudm:an<=<n===:==================>>>MPMDMereaemomtmogoaorrrryayym

Mnemonic: “Harvard Has Separate Spaces”

Question 1(c) [7 marks]
#

Explain: 8085 Instruction Format, Control Unit, Machine Cycle, ALU

Answer:

Instruction Format:

O1p-c3odbeytesOpteortaanld1l|enOgptehrand2|
ComponentFunction
Instruction Format1-3 byte structure with opcode and operands
Control UnitFetches, decodes instructions; generates signals
Machine CycleBasic operation cycle (T-states)
ALUPerforms arithmetic and logical operations
  • Instruction Format: Contains opcode (3-8 bits) and 0-2 operands
  • Control Unit: Heart of processor that coordinates all operations
  • Machine Cycle: Consists of fetch, decode, execute phases
  • ALU: Handles ADD/SUB/AND/OR/XOR operations on data

Diagram:

C(oSnetqAruLoeUlncUenri)8t085IRRneesggtiirssuttceetrrison

Mnemonic: “CIMA: Control Interprets, Machine Acts”

Question 1(c OR) [7 marks]
#

Compare Microprocessor and Microcontroller.

Answer:

FeatureMicroprocessorMicrocontroller
DesignCPU onlyCPU + peripherals
MemoryExternalInternal (RAM/ROM)
I/O portsLimitedMany built-in
CostHigherLower
ApplicationsGeneral computingEmbedded systems
Power consumptionHigherLower
ExampleIntel 8085/8086Intel 8051

Diagram:

MMiicCcrProUSoCIApecP/lrpoUOloan,crtiearTnstoiselmoolenrcerehrsSMi:M,cyepehsmsmeitootpernrcmyey.:ededI/O

Mnemonic: “Micro-P Processes, Micro-C Controls”

Question 2(a) [3 marks]
#

Explain Instruction Fetching, Decoding and Execution Operation in microprocessor.

Answer:

PhaseOperation
FetchingCPU gets instruction from memory using PC
DecodingDetermines operation type and operands
ExecutionPerforms the actual operation

Diagram:

FetchDecodeExecute

Mnemonic: “FDE: First Get, Then Understand, Finally Do”

Question 2(b) [4 marks]
#

Explain Bus Organization of 8085 microprocessor.

Answer:

Bus TypeWidthFunction
Address Bus16-bitCarries memory addresses (A0-A15)
Data Bus8-bitTransfers data (D0-D7)
Control BusVarious linesManages data flow (RD, WR, IO/M)
MultiplexedAD0-AD7Lower address bits + data bits

Diagram:

8085MicropADCrdaoodtncrateerssBossulosrBBu(us8s-(b1i6t-)bit)MCSeLDoimoangocttnraaraytolilson

Mnemonic: “ADC: Address points, Data flows, Control directs”

Question 2(c) [7 marks]
#

Describe architecture of 8085 microprocessor with the help of neat diagram.

Answer:

ComponentFunction
ALUArithmetic & logical operations
Register ArrayTemporary data storage (B,C,D,E,H,L)
AccumulatorMain register for arithmetic
Control UnitInstruction control & timing
Instruction RegisterHolds current instruction
Timing & ControlGenerates timing signals
Address BufferManages address bus
Data BufferHandles data bus transfers

Diagram:

IARBANDECSDDGCTRAICURETSMUSATUCSEDLTBRAIBUTOUFAEONFFRRFERRERAHERYG.8L0|8<5--M-I>C|ROPTRIOCMCOIENNSTGSROAOARLLNUDUNCIOTNTROL
  • ALU: Performs arithmetic & logical operations
  • Control Unit: Fetches & decodes instructions
  • Registers: Store data temporarily during processing
  • Buses: Carry address, data and control signals

Mnemonic: “ARCBD: Architecture Registers Control Buses Data”

Question 2(a OR) [3 marks]
#

Explain De-multiplexing of Address and Data buses for 8085 Microprocessor.

Answer:

StepAction
1ALE signal goes high
2Lower address (A0-A7) appears on AD0-AD7
3Latch captures address using ALE
4ALE goes low, AD0-AD7 now carries data

Diagram:

AD0-AD7DataLAaLtEchA0-A7

Mnemonic: “ALAD: ALE Latches Address before Data”

Question 2(b OR) [4 marks]
#

Draw Flag Register of 8085 microprocessor & explain it.

Answer:

FlaS7gReZ6gist05er(A48C-bi03t):P211C0Y
FlagNameSet when
SSignBit 7 of result is 1 (negative)
ZZeroResult is zero
ACAuxiliary CarryCarry from bit 3 to bit 4
PParityResult has even parity (even 1s)
CYCarryCarry generated from bit 7

Mnemonic: “SuZie AC’s Perfect CarrY”

Question 2(c OR) [7 marks]
#

Describe Pin diagram of 8085 microprocessor with the help of neat diagram.

Answer:

Pin GroupFunction
Address/DataMultiplexed AD0-AD7, A8-A15
ControlRD, WR, IO/M, S0, S1, ALE, CLK
InterruptsINTR, RST 5.5-7.5, TRAP
DMAHOLD, HLDA
PowerVcc, Vss
Serial I/OSID, SOD
ResetRESET IN, RESET OUT

Diagram:

RREESSEEIXXTTO12/AAAAAAAAAOIMSRWLS111111AADDUN1DRE05432109876T--12>|534678911111111112012345678904309333633333322222222287|543210987654321<--VHcORcLHCERISRWASAAAAAAAADLLSEO1DRL011111198DKEA/E543210ATDMYIN
  • Address/Data Pins: Multiplexed pins save physical pins
  • Control Pins: Coordinate memory and I/O operations
  • Interrupt Pins: Allow external device interrupts
  • Serial Pins: Provide basic serial communication

Mnemonic: “ACID-PS: Address-Control-Interrupt-DMA-Power-Serial”

Question 3(a) [3 marks]
#

Explain Stack, Stack Pointer and Stack operation.

Answer:

TermDescription
StackLIFO memory area for temporary data storage
Stack Pointer16-bit register that points to stack top
OperationsPUSH (store), POP (retrieve)

Diagram:

MemDDoaarttyaa:SPPtUOaSSPcPH:k:PSdoPai-tn-at,=eMrM[:[SSPP]],=dSaPt+a+

Mnemonic: “SP Points to LIFO Lane”

Question 3(b) [4 marks]
#

Draw Pin diagram of 8051 microcontroller.

Answer:

RPPPPPPPPXXGPPPPPPPPS11111111TTN33333333T........AAD........01234567LL0123456721////////<<RTIITTWR--XXNN01RD--DDTT<<<<<<01----12345678911|--<<>>>>011>>--2>>11121178903411564333333333309876543210292222|224321<8722-65-PPPPPPPP-V00000000EAc........ALPPPPPc01234567ESPP2222///////V/E22PP....AAAAAAAAPPN..223210DDDDDDDDPR76..////01234567O/54AAAAGAA//119811AA10541132
Pin GroupFunction
P0Port 0, multiplexed with address/data
P1Port 1, general purpose I/O
P2Port 2, upper address and I/O
P3Port 3, special functions and I/O

Mnemonic: “PORT 0123: Data-General-Address-Special”

Question 3(c) [7 marks]
#

Draw Timers/Counters logic diagram of 8051 microcontroller and explain its operation in various modes.

Answer:

Timer/Counter Diagram:

TTCILR/NxxTTxCLM8Rooo-engdbgtieiirctsoCtloenrtrolLogic8R(-eTbgHiixts)tGeArTEInterrupt
ModeOperation
Mode 013-bit timer (5-bit TL, 8-bit TH)
Mode 116-bit timer (8-bit TL, 8-bit TH)
Mode 28-bit auto-reload (TL counts, TH reloads)
Mode 3Split timer (Timer 0 only)
  • Timer: Uses internal clock, counts machine cycles
  • Counter: Uses external input, counts external events
  • Control Bits: TMOD register sets mode, TCON controls operation
  • Modes: Different configurations for different timing needs

Mnemonic: “MARC: Mode Auto-Reload Count”

Question 3(a OR) [3 marks]
#

List Common features of Microcontrollers.

Answer:

FeaturePurpose
CPU CoreProcess instructions
Memory (RAM/ROM)Store program and data
I/O PortsInterface with external devices
Timers/CountersMeasure time intervals
InterruptsHandle asynchronous events
Serial CommunicationTransfer data with other devices

Mnemonic: “CRITICS: CPU ROM I/O Timers Interrupts Comm Serial”

Question 3(b OR) [4 marks]
#

Explain Internal RAM Organization of 8051 microcontroller.

Answer:

RAM AreaAddress RangeUsage
Register Banks00H-1FHR0-R7 (4 banks)
Bit-addressable20H-2FH128 bits (0-7FH)
Scratch Pad30H-7FHGeneral purpose
SFRs80H-FFHControl registers

Diagram:

805RRRRBS1eeeeicggggtrIiiii-anssssattttttdceeeeedhrrrrrrnePaBBBBsalaaaasdnnnnaRkkkkbAlM0123e(10011238208080008HHHHHHHbytes):

Mnemonic: “RBBS: Registers Bits Buffer Scratch”

Question 3(c OR) [7 marks]
#

Explain architecture of 8051 microcontroller with the help of neat diagram.

Answer:

ComponentFunction
CPU8-bit processor with ALU
Memory4K ROM, 128 bytes RAM
I/O PortsFour 8-bit ports (P0-P3)
TimersTwo 16-bit timers/counters
Serial PortFull-duplex UART
InterruptsFive interrupt sources
Special Function RegistersControl registers

Diagram:

TCSioFmuCRenPsrtUse/rs8051MCUP(I(I(S(r4n1/PeUoKt2O0rAge8,iRrbrPPaTaynbo1l)mtayr,elttPPRses2oO)Rs,rMA)PtM3)
  • Harvard Architecture: Separate program and data memory
  • CISC Design: Rich instruction set (over 100 instructions)
  • In-built Peripherals: No need for external components
  • Single-chip Solution: Complete system on one chip

Mnemonic: “CAPITALS: CPU Architecture Ports I/O Timer ALU LS-Interface Serial”

Question 4(a) [3 marks]
#

Write an 8051 Assembly Language Program to Copy the data from external RAM Location 0123h to TL0 and Data from external RAM location 0234h to TH0.

Answer:

      MOV  DPTR, #0123H   ; Load DPTR with source address 0123H
      MOVX A, @DPTR       ; Read data from external RAM
      MOV  TL0, A         ; Copy to Timer 0 low byte
      
      MOV  DPTR, #0234H   ; Load DPTR with source address 0234H
      MOVX A, @DPTR       ; Read data from external RAM
      MOV  TH0, A         ; Copy to Timer 0 high byte

Key Steps:

  • Use DPTR to address external RAM
  • MOVX instruction for external memory access
  • Direct transfer to timer registers

Mnemonic: “DRAM: DPTR Read Address Move”

Question 4(b) [4 marks]
#

Write an 8051 Assembly Language Program to blink LED interfaced at port P1.3 at time interval of 1ms.

Answer:

AGAIN:  SETB P1.3         ; Turn ON LED at P1.3
        ACALL DELAY       ; Call delay subroutine
        CLR  P1.3         ; Turn OFF LED at P1.3
        ACALL DELAY       ; Call delay subroutine
        SJMP AGAIN        ; Repeat forever

DELAY:  MOV  R7, #250     ; Load R7 for outer loop
OUTER:  MOV  R6, #1       ; Load R6 for inner loop
INNER:  DJNZ R6, INNER    ; Decrement R6 until zero
        DJNZ R7, OUTER    ; Decrement R7 until zero
        RET               ; Return from subroutine

Key Steps:

  • Toggle P1.3 pin to blink LED
  • Nested delay loop for timing
  • Infinite loop for continuous blinking

Mnemonic: “STACI: Set-Timer-And-Clear-Infinitely”

Question 4(c) [7 marks]
#

List Addressing Modes of 8051 Microcontroller and explain all of them with the help of example.

Answer:

Addressing ModeExampleDescription
ImmediateMOV A, #25HData is in instruction
RegisterMOV A, R0Data is in register
DirectMOV A, 30HData is at RAM address
IndirectMOV A, @R0R0/R1 contains address
IndexedMOVC A, @A+DPTRAccess program memory
BitSETB P1.3Access individual bits
RelativeSJMP LABELJumps with 8-bit offset

Examples:

  • Immediate: MOV A, #55H (Load A with 55H)
  • Register: ADD A, R3 (Add R3 to A)
  • Direct: MOV 40H, A (Store A at address 40H)
  • Indirect: MOV @R0, #5 (Store 5 at address in R0)
  • Indexed: MOVC A, @A+DPTR (Read code memory)
  • Bit: CLR C (Clear carry flag)
  • Relative: JZ LOOP (Jump if A is zero)

Mnemonic: “I’M DIRBI: Immediate Register Direct Bit Indexed”

Question 4(a OR) [3 marks]
#

Write an 8051 Assembly Language Program to Subtract the content of RAM location 11h from RAM location 14h; put result in RAM location 3Ch.

Answer:

      MOV  A, 14H       ; Load content of RAM location 14H to A
      CLR  C            ; Clear carry flag
      SUBB A, 11H       ; Subtract content of 11H with borrow
      MOV  3CH, A       ; Store result in RAM location 3CH

Key Steps:

  • Load minuend into accumulator
  • Clear carry for correct subtraction
  • Use SUBB for subtraction with borrow
  • Store result in destination

Mnemonic: “LCSS: Load-Clear-Subtract-Store”

Question 4(b OR) [4 marks]
#

Write an 8051 Assembly Language Program to generate a square wave of 50% duty cycle on bit 3 of Port 1 using Timer 0 in Mode 1.

Answer:

      MOV  TMOD, #01H   ; Timer 0, Mode 1 (16-bit)
AGAIN: MOV  TH0, #0FCH   ; Load high byte
      MOV  TL0, #18H    ; Load low byte (-1000 in 16-bit)
      SETB TR0          ; Start timer
      JNB  TF0, $       ; Wait for overflow
      CLR  TR0          ; Stop timer
      CLR  TF0          ; Clear timer flag
      CPL  P1.3         ; Toggle P1.3
      SJMP AGAIN        ; Repeat

Key Steps:

  • Configure Timer 0 in Mode 1
  • Preload timer with value for 1ms delay
  • Wait for timer overflow
  • Toggle output bit for square wave

Mnemonic: “MSTCCS: Mode-Set-Timer-Check-Clear-Switch”

Question 4(c OR) [7 marks]
#

Explain any seven Logical Instructions with example for 8051 Microcontroller.

Answer:

InstructionExampleOperation
ANLANL A, #3FHLogical AND
ORLORL P1, #80HLogical OR
XRLXRL A, R0Logical XOR
CLRCLR AClear (set to 0)
CPLCPL P1.0Complement (invert)
RLRL ARotate left
RRRR ARotate right

Examples:

  • ANL: ANL A, #0FH (A = A AND 0FH, masks high nibble)
  • ORL: ORL 20H, A (20H = 20H OR A, sets bits)
  • XRL: XRL A, #55H (A = A XOR 55H, toggles bits)
  • CLR: CLR C (Clear carry flag, C = 0)
  • CPL: CPL A (Complement A, A = NOT A)
  • RL: RL A (Rotate A left one bit)
  • RR: RR A (Rotate A right one bit)

Mnemonic: “A-OX-CCR: AND OR XOR Clear Complement Rotate”

Question 5(a) [3 marks]
#

Draw Interfacing of Push button Switch with 8051 microcontroller.

Answer:

P1.0VcRc(10K)PushButtonGND
ComponentConnection
Push ButtonBetween P1.0 and GND
Pull-up Resistor10K between P1.0 and VCC
Port PinP1.0 configured as input

Key Points:

  • Active-low configuration (button press gives 0)
  • Pull-up resistor prevents floating input
  • Can connect to any I/O pin

Mnemonic: “PIP: Pull-up-Input-Press”

Question 5(b) [4 marks]
#

Interface Relay with 8051 microcontroller.

Answer:

P1.0-R(330)---5RV(N(1PBGKCNCN)5D(4D7ioRdeel)ayLoad
ComponentPurpose
NPN TransistorCurrent amplification
DiodeBack EMF protection
ResistorsCurrent limiting
RelayHigh-power switching

Key Steps:

  • Port pin drives transistor base
  • Transistor switches relay coil
  • Diode protects against back EMF
  • Relay contacts switch high-power load

Mnemonic: “TRIP: Transistor-Relay-Interface-Protection”

Question 5(c) [7 marks]
#

Interface ADC0804 with 8051 microcontroller.

Answer:

Circuit Diagram:

VCRWIA0rSDRNn-e---Ta5f---RlV/----o2----g----->>>>>Input--->AD8C0058104PP13..02-P1.7|
Connection8051 PinADC0804 Pin
Data BusP1.0-P1.7D0-D7
CSP3.0CS
RDP3.1RD
WRP3.2WR
INTRP3.3INTR
  • ADC0804: 8-bit A/D converter with 0-5V input range
  • Interface: Connect data pins to Port 1, control to Port 3
  • Operation: Write to ADC to start conversion, wait for INTR, read result
  • Resolution: 8-bit (256 steps) for 0-5V gives ~19.5mV per step

Mnemonic: “CRIW: Control-Read-Interrupt-Write”

Question 5(a OR) [3 marks]
#

List Applications of microcontroller in various fields.

Answer:

FieldApplications
IndustrialMotor control, automation, PLCs
MedicalPatient monitoring, diagnostic equipment
ConsumerWashing machines, microwaves, toys
AutomotiveEngine control, ABS, airbag systems
CommunicationMobile phones, modems, routers
SecurityAccess control, alarm systems

Mnemonic: “I-MACS: Industrial-Medical-Automotive-Consumer-Security”

Question 5(b OR) [4 marks]
#

Interface Stepper motor with 8051 microcontroller.

Answer:

Circuit Diagram:

80PPPP511111....0123+5VIIIIUNNNNL1234N20OOOO0UUUU3TTTT12344S-tMweoiptrpoeerr
ComponentPurpose
ULN2003Driver IC with Darlington arrays
Port pinsP1.0-P1.3 for 4 motor phases
Power supplySeparate supply for motor

Code Structure:

; Clockwise Rotation Sequence
STEP_SEQ: DB 0000_1000B  ; Step 1
          DB 0000_1100B  ; Step 2
          DB 0000_0100B  ; Step 3
          DB 0000_0110B  ; Step 4

Mnemonic: “PDCS: Port-Driver-Current-Sequence”

Question 5(c OR) [7 marks]
#

Interface LCD with 8051 microcontroller.

Answer:

Circuit Diagram:

8PPPPPPPPPPP0222222223335...........101234567012DDDDDDDDRRE101234567S/V6Wcxc2GLNCDD
ConnectionPurpose
Data Pins (D0-D7)Connect to P2.0-P2.7
RSRegister Select (0=Command, 1=Data)
R/WRead/Write (0=Write, 1=Read)
EEnable signal (Active High)

Basic Commands:

0x01 - Clear Display
0x02 - Return Home
0x0C - Display ON, Cursor OFF
0x38 - 8-bit, 2 line, 5x7 dots
  • Initialization: Configure LCD for 8-bit mode, 2 lines
  • Writing: Send data with RS=1, control with RS=0
  • Timing: E pulse must meet timing requirements
  • Contrast: Adjust with potentiometer on VEE pin

Mnemonic: “DICE: Data-Instruction-Control-Enable”

Related

Microprocessor and Microcontroller (4341101) - Summer 2023 Solution
23 mins
Study-Material Solutions Microprocessor 4341101 2023 Summer
Electronic Circuits & Applications (4321103) - Winter 2023 Solution
16 mins
Study-Material Solutions Electronics 4321103 2023 Winter
Principles of Electronic Communication (4331104) - Winter 2023 Solution
20 mins
Study-Material Solutions Electronic-Communication 4331104 2023 Winter
Fundamentals of Electrical Engineering (4311101) - Winter 2023 Solution
12 mins
Study-Material Solutions Electrical-Engineering 4311101 2023 Winter
Digital Electronics (4321102) - Winter 2023 Solution
15 mins
Study-Material Solutions Digital-Electronics 4321102 2023 Winter
Electronic Circuits & Applications (4321103) - Summer 2023 Solution
19 mins
Study-Material Solutions Electronic-Circuits 4321103 2023 Summer