Skip to main content
  1. Resources/
  2. Study Materials/
  3. Information & Communication Technology Engineering/
  4. ICT Semester 3/
  5. Microprocessor & Microcontroller Systems (1333202)/

Microprocessor & Microcontroller Systems (1333202) - Winter 2023 Solution

21 mins· ·
Study-Material Solutions Microprocessor Microcontroller 1333202 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]
#

Define Microprocessor.

Answer:

A microprocessor is a single-chip CPU that contains all the arithmetic, logic, and control circuitry required to perform the functions of a digital computer’s central processing unit.

Table: Microprocessor Key Features

FeatureDescription
Single ChipComplete CPU on one integrated circuit
Processing UnitExecutes instructions and performs calculations
Control LogicManages system operations and data flow
  • Central Processing Unit: Core component that executes instructions
  • Integrated Circuit: All functions combined on single silicon chip
  • Programmable Device: Can execute different programs based on stored instructions

Mnemonic: “Single Chip CPU = Smart Computer Processor Unit”

Question 1(b) [4 marks]
#

Explain Flag register of microprocessor.

Answer:

The Flag register stores status information about the result of arithmetic and logical operations performed by the ALU.

Table: 8085 Flag Register Bits

FlagPositionPurpose
S (Sign)Bit 7Indicates sign of result (1=negative, 0=positive)
Z (Zero)Bit 6Set when result is zero
AC (Auxiliary Carry)Bit 4Carry from bit 3 to bit 4
P (Parity)Bit 2Even parity flag
CY (Carry)Bit 0Carry from MSB
  • Status Indicator: Shows condition of last operation result
  • Conditional Instructions: Used for branching and decision making
  • 5 Active Flags: Sign, Zero, Auxiliary Carry, Parity, and Carry flags

Mnemonic: “Flags Show Zero, Sign, Parity, Auxiliary, Carry”

Question 1(c) [7 marks]
#

Explain format of instruction of microprocessor with example.

Answer:

Microprocessor instructions consist of opcode and operand fields that specify the operation and data locations.

Table: 8085 Instruction Format Types

FormatSizeStructureExample
1-Byte8 bitsOpcode onlyMOV A,B
2-Byte16 bitsOpcode + 8-bit dataMVI A,05H
3-Byte24 bitsOpcode + 16-bit addressLDA 2000H

Diagram:

graph TD
    A[Instruction Format] --> B[Opcode Field]
    A --> C[Operand Field]
    B --> D[Operation Code<br/>Specifies Operation]
    C --> E[Data/Address<br/>Specifies Source/Destination]
  • Opcode Field: Defines the operation to be performed (ADD, MOV, JMP)
  • Operand Field: Contains data, register, or memory address information
  • Variable Length: Instructions can be 1, 2, or 3 bytes long
  • Addressing Modes: Different ways to specify operand location

Mnemonic: “Opcode Operations + Operand Objects = Complete Commands”

Question 1(c OR) [7 marks]
#

Explain function of ALU, Control Unit and CPU of Microprocessor.

Answer:

The CPU consists of three main functional units that work together to execute instructions.

Table: CPU Components and Functions

ComponentPrimary FunctionKey Operations
ALUArithmetic & Logic OperationsADD, SUB, AND, OR, XOR
Control UnitInstruction ControlFetch, Decode, Execute
CPUOverall ProcessingCoordinate all operations

Diagram:

graph LR
    A[CPU] --> B[ALU<br/>Arithmetic Logic Unit]
    A --> C[Control Unit]
    A --> D[Register Array]
    B --> E[Math Operations<br/>Logic Operations]
    C --> F[Instruction Control<br/>Signal Generation]
  • ALU Functions: Performs all arithmetic calculations and logical operations
  • Control Unit Tasks: Manages instruction execution cycle and generates control signals
  • CPU Coordination: Integrates ALU and Control Unit for complete processing

Mnemonic: “ALU Adds, Control Commands, CPU Coordinates”

Question 2(a) [3 marks]
#

Explain function of ALE signal with diagram.

Answer:

ALE (Address Latch Enable) signal is used to demultiplex the lower-order address and data lines.

Table: ALE Signal Functions

FunctionDescription
Address LatchingCaptures lower 8-bit address
DemultiplexingSeparates address from data
Timing ControlProvides timing reference

Diagram:

A8D008-57ALEA0L7-a4At37c7h3(Address)
  • Active High Signal: ALE goes high during T1 state
  • External Latching: Used with 74373 latch to hold address
  • System Timing: Provides reference for external devices

Mnemonic: “ALE Always Latches External Addresses”

Question 2(b) [4 marks]
#

Compare microprocessor and microcontroller

Answer:

Table: Microprocessor vs Microcontroller Comparison

ParameterMicroprocessorMicrocontroller
DesignGeneral purposeApplication specific
MemoryExternal RAM/ROMInternal RAM/ROM
I/O PortsExternal interfaceBuilt-in I/O ports
TimersExternalBuilt-in timers
CostHigher system costLower system cost
PowerHigher consumptionLower consumption
  • Integration Level: Microcontroller has more integrated components
  • Application Focus: Microprocessor for computing, microcontroller for control
  • System Complexity: Microprocessor needs more external components
  • Design Flexibility: Microprocessor offers more expandability

Mnemonic: “Microprocessor = More Power, Microcontroller = More Control”

Question 2(c) [7 marks]
#

Draw & explain block diagram of microprocessor.

Answer:

The 8085 microprocessor consists of several functional blocks that work together.

Diagram:

graph TB
    A[Accumulator] --> B[ALU]
    C[Temp Register] --> B
    B --> D[Flag Register]
    E[Instruction Register] --> F[Instruction Decoder]
    F --> G[Timing & Control Unit]
    H[Program Counter] --> I[Address Buffer]
    J[Stack Pointer] --> I
    K[Register Array<br/>B,C,D,E,H,L] 
    I --> L[Address Bus A8-A15]
    M[Address/Data Buffer] --> N[Address/Data Bus AD0-AD7]

Table: Block Functions

BlockFunction
ALUArithmetic and logical operations
Register ArrayTemporary data storage (B,C,D,E,H,L)
Control UnitInstruction execution control
Address BufferDrive address bus lines
  • Data Path: Information flows between registers through internal bus
  • Control Signals: Generated by timing and control unit
  • Bus Interface: Connects to external memory and I/O devices
  • Register Operations: Temporary storage for operands and results

Mnemonic: “Blocks Build Better Processing Systems”

Question 2(a OR) [3 marks]
#

Explain 16 bits registers of microprocessor.

Answer:

The 8085 has three 16-bit registers formed by combining 8-bit register pairs.

Table: 16-bit Registers

RegisterFormationPurpose
PCSingle 16-bitProgram Counter - next instruction address
SPSingle 16-bitStack Pointer - top of stack address
HLH + L registersMemory pointer - data address
  • Program Counter: Automatically increments to next instruction
  • Stack Pointer: Points to last pushed data on stack
  • HL Pair: Most frequently used for memory addressing

Mnemonic: “PC Points Program, SP Stacks Properly, HL Holds Location”

Question 2(b OR) [4 marks]
#

Explain de-multiplexing lower order address and data lines with diagram of microprocessor.

Answer:

The 8085 multiplexes lower 8-bit address with data lines to reduce pin count.

Table: Multiplexed Lines

LinesT1 StateT2-T4 States
AD0-AD7Lower Address A0-A7Data D0-D7
ALE SignalHighLow

Diagram:

8A0D805-AD7AAL7L0E4a-3tA7c73h
  • Time Division: Same lines carry address then data
  • External Latch: 74373 captures address when ALE is high
  • Signal Separation: Creates separate address and data buses

Mnemonic: “ALE Always Latches External Address Elegantly”

Question 2(c OR) [7 marks]
#

Draw and explain pin diagram of 8085.

Answer:

The 8085 is a 40-pin microprocessor with multiplexed address/data bus.

Diagram:

XXRSSTRRRIIAAAAAAAAV12SOIRSSSNNDDDDDDDDsTDDATTTTT01234567sP765RA12345678911111111112012345678908085PinDiagr43333333333222222222a09876543210987654321mVHHCRRISRWASAAAAAAAAcOLLEEO1DRL011111198cLDKSA/**E543210DAEDMTY*

Table: Pin Groups

GroupPinsFunction
Address/DataAD0-AD7, A8-A15Memory addressing and data transfer
ControlALE, RD*, WR*, IO/M*Bus control signals
InterruptsINTR, RST7-RST5, TRAPInterrupt handling
PowerVcc, VssPower supply connections
  • Multiplexed Bus: AD0-AD7 carry both address and data
  • Active Low Signals: Signals with * are active low
  • Crystal Connections: X1, X2 for clock generation

Mnemonic: “Forty Pins Provide Perfect Processing Power”

Question 3(a) [3 marks]
#

Draw clock and reset circuit of microcontroller

Answer:

The 8051 requires external clock and reset circuits for proper operation.

Diagram:

CXRRlTeSoAsTcLek1t13G+1C20NC50iMpDiVKrHFrczcuu1iCi0trtµ:y3G:Fs0N-tpDGaFNlXDTAL2

Table: Circuit Components

ComponentValuePurpose
Crystal11.0592 MHzClock generation
Capacitors30pF eachCrystal stabilization
Reset Resistor10KΩPull-up for reset
Reset Capacitor10µFPower-on reset delay
  • Clock Frequency: Commonly 11.0592 MHz for serial communication
  • Reset Duration: Must be high for at least 2 machine cycles
  • Power-on Reset: Automatic reset when power is applied

Mnemonic: “Crystals Create Clock, Resistors Reset Reliably”

Question 3(b) [4 marks]
#

Explain internal RAM of 8051.

Answer:

The 8051 contains 256 bytes of internal RAM organized in different sections.

Table: Internal RAM Organization

Address RangeSizePurpose
00H-1FH32 bytesRegister Banks (4 banks × 8 registers)
20H-2FH16 bytesBit-addressable area
30H-7FH80 bytesGeneral purpose RAM
80H-FFH128 bytesSpecial Function Registers (SFRs)

Diagram:

graph TD
    A[Internal RAM 256 Bytes] --> B[Bank 0-3<br/>00H-1FH]
    A --> C[Bit Addressable<br/>20H-2FH]  
    A --> D[General Purpose<br/>30H-7FH]
    A --> E[SFRs<br/>80H-FFH]
  • Register Banks: Four banks of 8 registers each (R0-R7)
  • Bit Addressing: Individual bits can be addressed in 20H-2FH area
  • Stack Area: Usually located in general purpose RAM area
  • Direct Access: All locations accessible through direct addressing

Mnemonic: “RAM Registers, Bits, General, Special Functions”

Question 3(c) [7 marks]
#

Explain block diagram of 8051.

Answer:

The 8051 microcontroller integrates CPU, memory, and I/O on a single chip.

Diagram:

graph TB
    A[CPU Core] --> B[ALU]
    A --> C[Accumulator]
    A --> D[B Register]
    E[Program Memory<br/>4KB ROM] --> F[Program Counter]
    G[Data Memory<br/>256B RAM] --> H[Data Pointer DPTR]
    I[Timer/Counter] --> J[Timer 0/1]
    K[Serial Port] --> L[UART]
    M[Interrupt System] --> N[5 Interrupt Sources]
    O[I/O Ports] --> P[P0, P1, P2, P3]
    Q[Oscillator] --> R[Clock Circuit]

Table: Major Blocks

BlockFunction
CPUInstruction execution and control
Memory4KB ROM + 256B RAM
TimersTwo 16-bit timer/counters
I/O PortsFour 8-bit bidirectional ports
Serial PortFull-duplex UART
Interrupts5-source interrupt system
  • Harvard Architecture: Separate program and data memory spaces
  • Built-in Peripherals: Timers, serial port, interrupts integrated
  • Expandable: External memory and I/O can be added
  • Control Applications: Optimized for embedded control tasks

Mnemonic: “Complete Control Chip Contains CPU, Memory, I/O”

Question 3(a OR) [3 marks]
#

Explain function of DPTR and PC.

Answer:

DPTR and PC are important 16-bit registers in 8051 for memory addressing.

Table: DPTR and PC Functions

RegisterFull FormFunction
DPTRData PointerPoints to external data memory
PCProgram CounterPoints to next instruction address
  • DPTR Usage: Accessing external RAM and lookup tables
  • PC Function: Automatically increments after instruction fetch
  • 16-bit Addressing: Both can address 64KB memory space

Mnemonic: “DPTR Data Pointer, PC Program Counter”

Question 3(b OR) [4 marks]
#

Explain different timer modes of microcontroller.

Answer:

The 8051 has two timers with four different operating modes.

Table: Timer Modes

ModeConfigurationPurpose
Mode 013-bit timerCompatible with 8048
Mode 116-bit timerMaximum count capability
Mode 28-bit auto-reloadConstant time intervals
Mode 3Two 8-bit timersTimer 0 split operation
  • Mode Selection: Controlled by TMOD register bits
  • Timer 0/1: Both timers support modes 0, 1, 2
  • Mode 3 Special: Only Timer 0 can operate in mode 3
  • Applications: Delays, baud rate generation, event counting

Mnemonic: “Modes Make Timers Tremendously Versatile”

Question 3(c OR) [7 marks]
#

Explain interrupts of microcontroller.

Answer:

The 8051 has a 5-source interrupt system for handling external events.

Table: 8051 Interrupt Sources

InterruptVector AddressPriorityTrigger
Reset0000HHighestPower-on/External
External 00003HHighINT0 pin
Timer 0000BHMediumTimer 0 overflow
External 10013HMediumINT1 pin
Timer 1001BHLowTimer 1 overflow
Serial0023HLowestSerial communication

Diagram:

graph TD
    A[Interrupt System] --> B[External INT0]
    A --> C[Timer 0 Overflow]
    A --> D[External INT1] 
    A --> E[Timer 1 Overflow]
    A --> F[Serial Port]
    G[Interrupt Control] --> H[IE Register]
    G --> I[IP Register]
  • Interrupt Enable: IE register controls individual interrupt enables
  • Priority Control: IP register sets interrupt priorities
  • Vector Addresses: Each interrupt has fixed vector location
  • Nested Interrupts: Higher priority can interrupt lower priority

Mnemonic: “Five Interrupt Sources Serve System Efficiently”

Question 4(a) [3 marks]
#

Explain data transfer instruction with example for 8051.

Answer:

Data transfer instructions move data between registers, memory, and I/O ports.

Table: Data Transfer Instructions

InstructionExampleFunction
MOVMOV A,#55HMove immediate data to accumulator
MOVXMOVX A,@DPTRMove external RAM to accumulator
MOVCMOVC A,@A+PCMove code memory to accumulator
  • MOV Variants: Register to register, immediate to register
  • External Access: MOVX for external RAM operations
  • Code Access: MOVC for reading program memory tables

Mnemonic: “MOV Moves data, MOVX eXternal, MOVC Code”

Question 4(b) [4 marks]
#

List and explain different addressing modes of microcontroller.

Answer:

The 8051 supports several addressing modes for flexible data access.

Table: 8051 Addressing Modes

ModeExampleDescription
ImmediateMOV A,#55HData specified in instruction
RegisterMOV A,R0Use register contents
DirectMOV A,30HDirect memory address
IndirectMOV A,@R0Address stored in register
IndexedMOVC A,@A+DPTRBase address plus offset
  • Immediate Mode: Constant data included in instruction
  • Register Mode: Fastest execution using register file
  • Direct Mode: Access any internal RAM location
  • Indirect Mode: Pointer-based addressing for arrays
  • Indexed Mode: Table lookup and array access

Mnemonic: “Immediate, Register, Direct, Indirect, Indexed Addressing”

Question 4(c) [7 marks]
#

Write a program to copy block of 8 data starting from location 100h to 200h.

Answer:

Assembly Program:

ORG 0000H           ; Start address
MOV R0,#100H        ; Source address pointer
MOV R1,#200H        ; Destination address pointer  
MOV R2,#08H         ; Counter for 8 bytes

LOOP:
MOV A,@R0           ; Read data from source
MOV @R1,A           ; Write data to destination
INC R0              ; Increment source pointer
INC R1              ; Increment destination pointer
DJNZ R2,LOOP        ; Decrement counter and jump if not zero

END                 ; End of program

Table: Register Usage

RegisterPurpose
R0Source address pointer (100H)
R1Destination address pointer (200H)
R2Loop counter (8 bytes)
ATemporary data storage
  • Indirect Addressing: @R0 and @R1 for memory access
  • Loop Control: DJNZ instruction decrements and tests
  • Block Transfer: Copies 8 consecutive bytes efficiently

Mnemonic: “Read, Write, Increment, Decrement, Jump Loop”

Question 4(a OR) [3 marks]
#

Write a program to add two bytes of data and store result in R0 register.

Answer:

Assembly Program:

ORG 0000H           ; Start address
MOV A,#25H          ; Load first byte
ADD A,#35H          ; Add second byte
MOV R0,A            ; Store result in R0
END                 ; End program

Table: Operation Steps

StepInstructionResult
1MOV A,#25HA = 25H
2ADD A,#35HA = 5AH
3MOV R0,AR0 = 5AH
  • Addition Result: 25H + 35H = 5AH
  • Flag Effects: Carry flag set if result > FFH

Mnemonic: “Move, Add, Move = Simple Addition”

Question 4(b OR) [4 marks]
#

Explain indexed addressing mode with example.

Answer:

Indexed addressing uses a base address plus an offset for memory access.

Table: Indexed Addressing Details

ComponentDescriptionExample
Base AddressDPTR or PC registerDPTR = 1000H
IndexAccumulator contentsA = 05H
Effective AddressBase + Index1000H + 05H = 1005H

Example:

MOV DPTR,#1000H     ; Base address
MOV A,#05H          ; Index value
MOVC A,@A+DPTR      ; Read from address 1005H
  • Table Access: Ideal for lookup tables and arrays
  • Program Memory: MOVC reads from code memory only
  • Dynamic Indexing: Index can change during execution

Mnemonic: “Base + Index = Dynamic Access”

Question 4(c OR) [7 marks]
#

Explain stack operation of microcontroller, PUSH and POP instruction.

Answer:

The stack is a LIFO memory structure used for temporary data storage.

Table: Stack Operations

OperationInstructionFunction
PUSHPUSH 30HStore data on stack
POPPOP 30HRetrieve data from stack
Stack PointerSP registerPoints to top of stack

Diagram:

SBSStePtafacockrke000O765gpPHHHreUorSwaHst:iuopnw:arAdftieSnrPmPeUmS000oH887rHHHy3::0H3o:0lHdAfteSrPPOP0007653HHH0H:

Example Program:

MOV SP,#30H         ; Initialize stack pointer
PUSH ACC            ; Save accumulator
PUSH B              ; Save B register
POP B               ; Restore B register
POP ACC             ; Restore accumulator
  • LIFO Structure: Last In, First Out data organization
  • SP Auto-increment: Stack pointer automatically adjusts
  • Subroutine Calls: Stack saves return addresses
  • Register Preservation: Save/restore register contents

Mnemonic: “PUSH Puts Up, Stack Holds, POP Pulls Out”

Question 5(a) [3 marks]
#

Explain branching instruction with example.

Answer:

Branching instructions alter program flow based on conditions or unconditionally.

Table: Branching Instructions

TypeInstructionExample
UnconditionalLJMP addressLJMP 2000H
ConditionalJZ addressJZ ZERO_LABEL
Call/ReturnLCALL addressLCALL SUBROUTINE

Example:

MOV A,#00H          ; Load zero
JZ ZERO_FOUND       ; Jump if A is zero
LJMP CONTINUE       ; Jump to continue
ZERO_FOUND:
    MOV R0,#01H     ; Set flag
CONTINUE:
    NOP             ; Continue execution
  • Program Control: Changes execution sequence
  • Conditional Jumps: Based on flag register status
  • Address Range: Can jump to any program memory location

Mnemonic: “Jump Changes Control Flow”

Question 5(b) [4 marks]
#

Interface 8 leds with microcontroller and write a program to turn on and off.

Answer:

Circuit Diagram:

8PPPPPPPP0111111115........101234567--------[[[[[[[[3333333333333333L00000000EΩΩΩΩΩΩΩΩD]]]]]]]]s--------------------------------LLLLLLLLEEEEEEEEDDDDDDDD12345678--------------------------------++++++++55555555VVVVVVVV

Program:

ORG 0000H
MAIN:
    MOV P1,#0FFH        ; Turn ON all LEDs
    CALL DELAY          ; Wait
    MOV P1,#00H         ; Turn OFF all LEDs  
    CALL DELAY          ; Wait
    SJMP MAIN           ; Repeat

DELAY:
    MOV R0,#0FFH        ; Outer loop counter
LOOP1:
    MOV R1,#0FFH        ; Inner loop counter  
LOOP2:
    DJNZ R1,LOOP2       ; Inner delay loop
    DJNZ R0,LOOP1       ; Outer delay loop
    RET                 ; Return
END

Table: Components

ComponentValuePurpose
Resistor330ΩCurrent limiting
LEDs8 piecesVisual indicators
PortP18-bit output port
  • Current Limiting: Resistors protect LEDs from overcurrent
  • Port Configuration: P1 used as output port for LED control
  • Delay Routine: Creates visible ON/OFF timing

Mnemonic: “Port Controls LEDs with Resistance and Delay”

Question 5(c) [7 marks]
#

Interface LCD with microcontroller and write a program to display “welcome”.

Answer:

Circuit Connections:

8PPPPPPG0222211N5......D101230116x2DDDDRER4567SN/LWC((DRE(enWgaribisltteee)rmoSdeel)ect)

Program:

ORG 0000H
    CALL LCD_INIT       ; Initialize LCD
    CALL DISPLAY_MSG    ; Display message
    SJMP $              ; Stop here

LCD_INIT:
    MOV P2,#38H         ; Function set: 8-bit, 2-line
    CALL COMMAND
    MOV P2,#0EH         ; Display ON, Cursor ON
    CALL COMMAND  
    MOV P2,#01H         ; Clear display
    CALL COMMAND
    MOV P2,#06H         ; Entry mode set
    CALL COMMAND
    RET

DISPLAY_MSG:
    MOV DPTR,#MESSAGE   ; Point to message
NEXT_CHAR:
    CLR A
    MOVC A,@A+DPTR      ; Read character
    JZ DONE             ; If zero, end of string
    CALL SEND_CHAR      ; Send character to LCD
    INC DPTR            ; Next character
    SJMP NEXT_CHAR
DONE:
    RET

COMMAND:
    CLR P1.0            ; RS = 0 for command
    SETB P1.1           ; EN = 1
    CLR P1.1            ; EN = 0 (pulse)
    CALL DELAY
    RET

SEND_CHAR:
    MOV P2,A            ; Put character on data lines
    SETB P1.0           ; RS = 1 for data
    SETB P1.1           ; EN = 1
    CLR P1.1            ; EN = 0 (pulse)
    CALL DELAY
    RET

DELAY:
    MOV R0,#50          ; Delay routine
DELAY_LOOP:
    MOV R1,#255
DELAY_INNER:
    DJNZ R1,DELAY_INNER
    DJNZ R0,DELAY_LOOP
    RET

MESSAGE:
    DB "WELCOME",0       ; Message string with null terminator
END

Table: LCD Interface Pins

8051 PinLCD PinFunction
P2.0-P2.3D4-D74-bit data lines
P1.0RSRegister select (0=command, 1=data)
P1.1ENEnable pulse
GNDR/WRead/Write (tied to ground for write)
  • 4-bit Mode: Uses only upper 4 data lines to save pins
  • Control Signals: RS selects command/data, EN provides timing pulse
  • Character Display: Each character sent as ASCII code
  • Initialization: Required command sequence for proper operation

Mnemonic: “LCD Displays Characters with Commands and Data”

Question 5(a OR) [3 marks]
#

Explain logical instruction with example.

Answer:

Logical instructions perform bitwise operations on data.

Table: Logical Instructions

InstructionExampleFunction
ANLANL A,#0FHBitwise AND operation
ORLORL A,#F0HBitwise OR operation
XRLXRL A,#FFHBitwise XOR operation

Example:

MOV A,#55H          ; A = 01010101B
ANL A,#0FH          ; A = 00000101B (mask upper bits)
ORL A,#F0H          ; A = 11110101B (set upper bits)
XRL A,#FFH          ; A = 00001010B (complement all bits)
  • Bit Manipulation: Used for setting, clearing, and testing bits
  • Masking Operations: ANL clears unwanted bits
  • Flag Effects: Updates parity flag based on result

Mnemonic: “AND Masks, OR Sets, XOR Toggles”

Question 5(b OR) [4 marks]
#

Interface 7 segment with microcontroller.

Answer:

Circuit Diagram:

8PPPPPPPP0111111115........101234567--------[[[[[[[[333333333333333300000000ΩΩΩΩΩΩΩΩ7]]]]]]]]---------S--------e--------g--------mabcdefgdepnt(dDeicsipmlaalypoint)

Program to Display 0-9:

ORG 0000H
    MOV DPTR,#DIGIT_TABLE   ; Point to lookup table
    MOV R0,#0               ; Start with digit 0

MAIN_LOOP:
    MOV A,R0                ; Get current digit
    MOVC A,@A+DPTR          ; Get 7-segment code
    MOV P1,A                ; Display on 7-segment
    CALL DELAY              ; Wait 1 second
    INC R0                  ; Next digit
    CJNE R0,#10,MAIN_LOOP   ; Check if reached 10
    MOV R0,#0               ; Reset to 0
    SJMP MAIN_LOOP          ; Repeat

DIGIT_TABLE:
    DB 3FH, 06H, 5BH, 4FH, 66H    ; 0,1,2,3,4
    DB 6DH, 7DH, 07H, 7FH, 6FH    ; 5,6,7,8,9
END

Table: 7-Segment Codes

DigitHex CodeBinarySegments Lit
03FH00111111a,b,c,d,e,f
106H00000110b,c
25BH01011011a,b,g,e,d
  • Common Cathode: Segments light when port pin is high
  • Current Limiting: Resistors prevent segment damage
  • Lookup Table: Efficient storage of segment patterns

Mnemonic: “Seven Segments Show Digits Clearly”

Question 5(c OR) [7 marks]
#

Interface LM 35 with microcontroller and explain block diagram of temperature controller.

Answer:

Circuit Diagram:

L+R8M5e03Vl55a1yTPeC3mGo.pNn0eDtrraotlu:-rL([eMVU3oLS5uNet2n)0s0o3rG]N-ID-n-t-erRfA(eaDVlcCiae0ny:8)04LoadHeate8(r0P/51F1)an)

Temperature Controller Block Diagram:

graph LR
    A[LM35 Sensor] --> B[ADC0804]
    B --> C[8051 Controller]
    C --> D[Display Unit]
    C --> E[Relay Driver]
    E --> F[Heater/Cooler]
    F --> G[Controlled Environment]
    G --> A

Control Program:

ORG 0000H
MAIN:
    CALL READ_TEMP      ; Read temperature from ADC
    CALL DISPLAY_TEMP   ; Show temperature on display
    CALL TEMP_CONTROL   ; Control heating/cooling
    CALL DELAY          ; Wait before next reading
    SJMP MAIN

READ_TEMP:
    CLR P2.0            ; Start ADC conversion
    SETB P2.0           ; Pulse to start
    JNB P2.1,$          ; Wait for conversion complete
    MOV A,P1            ; Read temperature data
    RET

TEMP_CONTROL:
    CJNE A,#30,CHECK_HIGH   ; Compare with setpoint (30°C)
CHECK_HIGH:
    JC TEMP_LOW             ; If A < 30, temperature is low
    SETB P3.0               ; Turn ON cooling (fan)
    CLR P3.1                ; Turn OFF heating
    RET
TEMP_LOW:
    CLR P3.0                ; Turn OFF cooling
    SETB P3.1               ; Turn ON heating
    RET
END

Table: System Components

ComponentFunction
LM35Temperature sensor (10mV/°C)
ADC0804Analog to digital converter
8051Main controller
RelaySwitch high power loads
DisplayShow current temperature
  • Temperature Sensing: LM35 provides 10mV per degree Celsius
  • ADC Conversion: Converts analog voltage to digital value
  • Control Logic: Compares with setpoint and controls relays
  • Feedback System: Continuous monitoring and adjustment
  • Safety Features: Over-temperature protection possible

Mnemonic: “Sense, Convert, Compare, Control Temperature Automatically”

Related

Microprocessor and Microcontroller (4341101) - Winter 2023 Solution
19 mins
Study-Material Solutions Microprocessor 4341101 2023 Winter
Linux Operating System (4331602) - Winter 2023 Solution
Study-Material Solutions Linux Operating-System 4331602 2023 Winter
Microprocessor and Microcontroller (4341101) - Winter 2024 Solution
23 mins
Study-Material Solutions Microprocessor 4341101 2024 Winter
Communication Engineering (1333201) - Winter 2023 Solution
24 mins
Study-Material Solutions Communication-Engineering 1333201 2023 Winter
Data Structure with Python (4331601) - Winter 2023 Solution
Study-Material Solutions Data-Structure Python 4331601 2023 Winter
Mobile & Wireless Communication (4351104) - Winter 2023 Solution
Study-Material Solutions Mobile-Communication 4351104 2023 Winter