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 2024 Solution

23 mins· ·
Study-Material Solutions Microprocessor 4341101 2024 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]
#

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 1(b) [4 marks]
#

Explain the functions of ALU.

Answer:

FunctionDescription
Arithmetic OperationsAddition, subtraction, increment, decrement
Logical OperationsAND, OR, XOR, NOT, comparison
Data MovementTransfer between registers and memory
Flag SettingUpdate status flags based on operation results

Diagram:

IDnaptuatS(tZa,AtLuCUs,FSl,agPs)ODuattpaut

Mnemonic: “ALFS: Arithmetic Logic Flags Status”

Question 1(c) [7 marks]
#

Define: Memory, Operand, Instruction Cycle, Opcode, CU, Machine Cycle, CISC

Answer:

TermDefinition
MemoryStorage unit that holds data and instructions
OperandData value or address used in an operation
Instruction CycleComplete process of fetching and executing an instruction
OpcodeOperation code that specifies the instruction type
CUControl Unit that coordinates processor operations
Machine CycleBasic operation cycle consisting of T-states
CISCComplex Instruction Set Computer with rich instruction set
  • Memory: Organized array of storage cells with unique addresses
  • Operand: Data elements that instructions operate upon
  • Instruction Cycle: Fetch-decode-execute sequence for each instruction
  • Opcode: Binary code that tells processor what operation to perform

Diagram:

InsFtertucchtionCycleD:ecodeExecute

Mnemonic: “MO-ICO-MC: Memory-Operand-Instruction-Control-Operation-Machine-Complex”

Question 1(c OR) [7 marks]
#

i) Define: Microprocessor. ii) Compare Von-Neumann and Harvard architecture.

Answer:

i) Microprocessor Definition:

An integrated circuit containing the CPU functionality of a computer,
capable of fetching, decoding, and executing instructions with ALU and
control circuitry on a single chip.

ii) Von-Neumann vs Harvard Architecture:

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 2(a) [3 marks]
#

Explain various Registers of 8085 microprocessor.

Answer:

RegisterSizeFunction
Accumulator (A)8-bitMain register for arithmetic & logic
General Purpose (B,C,D,E,H,L)8-bitTemporary data storage
Program Counter (PC)16-bitAddress of next instruction
Stack Pointer (SP)16-bitPoints to top of stack
Flag Register8-bitStatus flags (Z,S,P,CY,AC)

Mnemonic: “AGSF: Accumulator-General-Stack-Flags”

Question 2(b) [4 marks]
#

Explain Fetching, Decoding and Execution of Instruction.

Answer:

PhaseActivityHardware Involved
FetchingGet instruction from memory address in PCPC, Address bus, Memory
DecodingIdentify operation type and operandsInstruction Register, Control Unit
ExecutionPerform specified operationALU, Registers, Data bus

Diagram:

FetchNextInstrDuecctoidoenCycleExecute
  • Fetching: PC sends address to memory, instruction loaded into IR
  • Decoding: Control unit interprets instruction opcode and addressing mode
  • Execution: ALU performs arithmetic/logic, data moves between registers/memory

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

Question 2(c) [7 marks]
#

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

Answer:

BlockFunction
ALUArithmetic & logical operations
Register ArrayTemporary data storage
Instruction Register & DecoderHold & interpret instructions
Control & Timing UnitGenerate control signals
Address BufferInterface with address bus
Data BufferInterface with data bus
Serial I/OCommunication with SID/SOD
Interrupt ControlHandle interrupt requests

Diagram:

IARBAN&DECSDDGCTDRAICUREETSM.CSATUOSEDLRDBRAEEBUTGRUFAEOIFFRRSFERTERAHERYR8L0|8<5--M-I>C|ROCPOIRNNOTTCRESEORESLRRSUIOA&PARLTLUTICIMO/INONTGROULNIT|
  • Core Components: ALU and registers form processing core
  • Control Path: Instructions flow through register, decoder, control unit
  • Data Path: Data moves through buffers to/from external buses
  • Timing: Synchronizes all operations via internal clock

Mnemonic: “RAID: Registers-ALU-Instructions-Decoders”

Question 2(a OR) [3 marks]
#

Compare Microprocessor & Microcontroller.

Answer:

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

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

Question 2(b OR) [4 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-AD78085DataBusLAaLtEchA0-A7AdMdermeosrsyMemory
  • Multiplexing: AD0-AD7 pins carry address and data at different times
  • ALE Signal: Address Latch Enable controls when address is captured
  • 8-bit Latch: Holds lower address bits during entire machine cycle
  • Timing: Address valid only during high state of ALE pulse

Mnemonic: “ALAD: ALE Latches Address before Data”

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 Pins: A8-A15 (8) and multiplexed AD0-AD7 (8) for 16-bit addressing
  • Control Pins: Generate timing and control signals for peripheral devices
  • Interrupt Pins: Hardware interrupt handling with priority levels
  • Clock: X1, X2 for crystal connection, CLK for synchronization
  • Power: Vcc (+5V) and Vss (Ground) for power supply

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

Question 3(a) [3 marks]
#

Explain interrupts of 8051 microcontroller.

Answer:

InterruptVectorPrioritySource
External 00003H1 (IP.0)Pin INT0 (P3.2)
Timer 0000BH2 (IP.1)Timer 0 overflow
External 10013H3 (IP.2)Pin INT1 (P3.3)
Timer 1001BH4 (IP.3)Timer 1 overflow
Serial0023H5 (IP.4)Serial port events

Diagram:

IITTSNNIIETTMMR01EEIRRA01L8051Inpcitraneindroirrbvuieiptdtieusznaealadblrlyeaendd/disabled

Mnemonic: “ETTES: External-Timer-Timer-External-Serial”

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
XTALCrystal oscillator connections
ControlRST, EA, ALE, PSEN

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

Question 3(c) [7 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:

8S0p5RRRRBSeS(a1eeeeiccFnrggggtriRoeIiiii-aastnssssatlutttttdcaseeeeedhFlerrrrrruldnePn)aBBBBsacblaaaasdtynnnnaitRkkkkboeAlnsM0123eR(e10011238g8F20808000i0F8HHHHHHHsHHtbeyrtse:s):
  • Register Banks: Four banks of 8 registers (R0-R7) selectable by PSW
  • Bit-addressable: 16 bytes (128 bits) individually addressable as bits
  • General Purpose: User variables and stack space
  • SFRs: Control and status registers at higher addresses

Mnemonic: “RBBS: Registers Bits Buffer Special”

Question 3(a OR) [3 marks]
#

List SFRs with their addresses.

Answer:

SFRAddressFunction
P080HPort 0
SP81HStack Pointer
DPL82HData Pointer Low
DPH83HData Pointer High
PCON87HPower Control
TCON88HTimer Control
TMOD89HTimer Mode
P190HPort 1
SCON98HSerial Control
P2A0HPort 2
IEA8HInterrupt Enable
P3B0HPort 3
IPB8HInterrupt Priority
PSWD0HProgram Status Word
ACCE0HAccumulator
BF0HB Register

Mnemonic: “PDPT-SP: Ports-Data-Program-Timers-Serial-Prioritized”

Question 3(b OR) [4 marks]
#

Explain Timers/Counters logic diagram of 8051 microcontroller.

Answer:

Timer/Counter Diagram:

TTCILR/NxxTTxCLM8Rooo-engdbgtieiirctsoCtloenrtrolLogic8R(-eTbgHiixts)tGeArTEInterrupt
ComponentFunction
TLx, THxTimer low and high byte registers
C/TSelects Timer (0) or Counter (1) mode
GATEExternal enable control
TRxTimer run control bit
Mode ControlSelects one of four operation modes
  • Timer: Uses internal clock, counts machine cycles
  • Counter: Counts external events on T0/T1 pins
  • Control Bits: Set in TMOD and TCON registers
  • Modes: Different timer configurations (13/16/8-bit)

Mnemonic: “TCG: Timer-Counter-Gate”

Question 3(c OR) [7 marks]
#

Explain block diagram of 8051 microcontroller.

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 add two bytes of data and store result in R4 register.

Answer:

      MOV  A, #25H    ; Load first value (25H) into accumulator
      MOV  R3, #18H   ; Load second value (18H) into R3
      ADD  A, R3      ; Add R3 to accumulator
      MOV  R4, A      ; Store result in R4 register

Key Steps:

  • Load first operand into Accumulator
  • Load second operand into register R3
  • Perform addition using ADD instruction
  • Store result from Accumulator to R4

Mnemonic: “LLAS: Load-Load-Add-Store”

Question 4(b) [4 marks]
#

Write an 8051 Assembly Language Program to OR the contents of Port-1 and Port-2 then put the result in external RAM location 0200H.

Answer:

      MOV  A, P1      ; Load contents of Port-1 into accumulator
      ORL  A, P2      ; OR Port-2 contents with accumulator
      MOV  DPTR, #0200H ; Load DPTR with external RAM address
      MOVX @DPTR, A    ; Store result in external RAM location 0200H

Key Steps:

  • Read Port-1 into Accumulator
  • Perform OR operation with Port-2
  • Set up Data Pointer (DPTR) for external RAM
  • Write result to external memory

Mnemonic: “PORT: Port-OR-Register-Transfer”

Question 4(c) [7 marks]
#

List Addressing Modes of 8051 Microcontroller and explain them with at least one 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]
#

Explain following instructions: (i) DJNZ (ii) POP (iii) CJNE.

Answer:

InstructionSyntaxOperation
DJNZDJNZ Rn, relDecrement register, Jump if Not Zero
POPPOP directPop data from stack to direct address
CJNECJNE A, #data, relCompare and Jump if Not Equal

Examples and Explanation:

  • DJNZ R7, LOOP: Decrements R7 and jumps to LOOP if R7≠0

    • Used for loop counters and delays
  • POP 30H: Copies data from stack to address 30H

    • Increments SP after data retrieval
  • CJNE A, #25H, NOTEQUAL: Compares A with 25H, jumps if not equal

    • Also sets Carry flag if A < data

Mnemonic: “DPC: Decrement-Pop-Compare”

Question 4(b OR) [4 marks]
#

For 8051 Microcontroller with a crystal frequency of 12 MHz, generate a delay of 4ms.

Answer:

; Crystal frequency = 12 MHz
; Machine cycle = 1 μs
; Required delay = 4 ms = 4000 machine cycles

      MOV  R7, #16    ; Outer loop counter (16 x 250 = 4000)
DELAY1: MOV  R6, #250  ; Inner loop counter 
DELAY2: NOP            ; 1 machine cycle
        NOP            ; 1 machine cycle
        DJNZ R6, DELAY2 ; 2 machine cycles (250 x 4 = 1000 cycles)
        DJNZ R7, DELAY1 ; 16 x 250 = 4000 cycles total
        RET            ; Return from subroutine

Calculation:

  • Each inner loop: 4 cycles × 250 iterations = 1000
  • Outer loop: 16 iterations × 1000 cycles = 16,000 cycles
  • At 12MHz, 1 machine cycle = 1μs
  • Total delay = 4ms (4000 cycles)

Mnemonic: “LNDD: Load-NOP-Decrement-Decrement”

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 with Explanation:

  1. ANL A, #0FH: Masks high nibble (A = A AND 0FH)

    • Before: A = 95H, After: A = 05H
  2. ORL 20H, A: Sets bits in memory (20H = 20H OR A)

    • Before: 20H = 55H, A = 0AH, After: 20H = 5FH
  3. XRL A, #55H: Toggles specific bits (A = A XOR 55H)

    • Before: A = AAH, After: A = FFH
  4. CLR C: Clears carry flag (C = 0)

    • Used before subtraction operations
  5. CPL A: Inverts all bits (A = NOT A)

    • Before: A = 55H, After: A = AAH
  6. RL A: Rotates accumulator left one bit

    • Before: A = 85H (10000101), After: A = 0BH (00001011)
  7. RR A: Rotates accumulator right one bit

    • Before: A = 85H (10000101), After: A = C2H (11000010)

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

Question 5(a) [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) [4 marks]
#

Interface Push button Switch and LED with 8051 microcontroller.

Answer:

Circuit Diagram:

PP11..07--V-V-cRcR-cc+((-13-03-K0-)Ω-)|P>u|s-h--B-u-t-toLnEDGNGDND

Program:

AGAIN:  JB    P1.0, LED_OFF  ; If P1.0=1 (not pressed), LED off
        SETB  P1.7           ; If P1.0=0 (pressed), LED on
        SJMP  AGAIN          ; Repeat
LED_OFF:CLR   P1.7           ; Turn LED off
        SJMP  AGAIN          ; Repeat
ComponentConnectionPurpose
Push ButtonP1.0 (input)User input, active-low
Pull-up Resistor10K to VccPrevents floating input
LEDP1.7 (output)Visual indicator
Current-limiting Resistor330ΩProtects LED

Mnemonic: “PLIC: Push-LED-Input-Control”

Question 5(c) [7 marks]
#

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

Answer:

Circuit Diagram:

8PPPPPPPPPPP0222222223335...........101234567012DDDDDDDDRRE101234567S/V6Wcxc2GLNCDD

Program:

ORG 0000H               ; Start address
    
; Initialize LCD
    MOV A, #38H         ; 8-bit, 2 lines, 5x7 dots
    ACALL COMMAND       ; Send command
    MOV A, #0EH         ; Display ON, cursor ON
    ACALL COMMAND       ; Send command
    MOV A, #01H         ; Clear display
    ACALL COMMAND       ; Send command
    MOV A, #06H         ; Increment cursor
    ACALL COMMAND       ; Send command
    MOV A, #80H         ; First line, first position
    ACALL COMMAND       ; Send command
    
; Display "HELLO"
    MOV A, #'H'         ; Load 'H'
    ACALL DISPLAY       ; Display it
    MOV A, #'E'         ; Load 'E'
    ACALL DISPLAY       ; Display it
    MOV A, #'L'         ; Load 'L'
    ACALL DISPLAY       ; Display it
    MOV A, #'L'         ; Load 'L'
    ACALL DISPLAY       ; Display it
    MOV A, #'O'         ; Load 'O'
    ACALL DISPLAY       ; Display it
    
    SJMP $              ; Stay here
    
; Command subroutine
COMMAND:
    MOV P2, A           ; Put command on data bus
    CLR P3.0            ; RS=0 for command
    CLR P3.1            ; R/W=0 for write
    SETB P3.2           ; E=1
    ACALL DELAY         ; Wait
    CLR P3.2            ; E=0
    RET                 ; Return
    
; Display subroutine
DISPLAY:
    MOV P2, A           ; Put data on data bus
    SETB P3.0           ; RS=1 for data
    CLR P3.1            ; R/W=0 for write
    SETB P3.2           ; E=1
    ACALL DELAY         ; Wait
    CLR P3.2            ; E=0
    RET                 ; Return
    
; Delay subroutine
DELAY:
    MOV R7, #50         ; Load counter
DELAY_LOOP:
    DJNZ R7, DELAY_LOOP ; Loop until R7=0
    RET                 ; Return
    
END                     ; End of program
ComponentConnectionPurpose
Data PinsP2.0-P2.7Transfer data/commands
RS (Register Select)P3.0Select command (0) or data (1)
R/W (Read/Write)P3.1Select write (0) or read (1)
E (Enable)P3.2Latch data on falling edge
  • Initialization: Configure LCD for 8-bit, 2 lines, cursor options
  • Data Transfer: Commands sent with RS=0, characters with RS=1
  • Characters: ASCII values sent one by one to display text
  • Timing: Delay routine ensures proper signal timing

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

Question 5(a OR) [3 marks]
#

Draw Interfacing of LM35 with 8051 microcontroller.

Answer:

Circuit Diagram:

+G5LONVMUD-3T--5-------VGAiN8DnDD0C050I-18CRWND0SDRT74++PPPPP11110.....01230-P0.7
ComponentFunction
LM35Temperature sensor (10mV/°C)
ADC0804Analog-to-Digital Converter
8051Microcontroller to read temperature

Key Points:

  • LM35 produces analog voltage proportional to temperature
  • ADC0804 converts analog voltage to digital value
  • 8051 controls ADC and reads temperature data
  • Resolution: 10mV/°C → ~0.2°C resolution with 8-bit ADC

Mnemonic: “TAC: Temperature-Analog-Convert”

Question 5(b OR) [4 marks]
#

Interface Stepper motor with 8051 microcontroller.

Answer:

Circuit Diagram:

80PPPP511111....0123+5VIIIIUNNNNL1234N20OOOO0UUUU3TTTT12344S-tMweoiptrpoeerr

Program:

      ORG 0000H

; Stepper Motor Sequence for Clockwise Rotation
SEQ:  DB 00001000B  ; Step 1
      DB 00001100B  ; Step 2
      DB 00000100B  ; Step 3
      DB 00000110B  ; Step 4
      DB 00000010B  ; Step 5
      DB 00000011B  ; Step 6
      DB 00000001B  ; Step 7
      DB 00001001B  ; Step 8

MAIN: MOV R0, #00H  ; Initialize sequence pointer
      
STEP: MOV A, R0     ; Get current sequence number
      ANL A, #07H   ; Keep within 0-7 range (8 steps)
      MOV DPTR, #SEQ ; Point to sequence table
      MOVC A, @A+DPTR ; Get sequence pattern
      MOV P1, A     ; Output to stepper motor
      
      ACALL DELAY   ; Wait between steps
      
      INC R0        ; Next sequence
      SJMP STEP     ; Repeat
      
DELAY: MOV R6, #250 ; Delay loop
LOOP:  MOV R7, #250
LOOP2: DJNZ R7, LOOP2
       DJNZ R6, LOOP
       RET
       
      END
ComponentPurpose
ULN2003Driver IC with Darlington arrays
Port pinsP1.0-P1.3 for 4 motor phases
Power supplySeparate supply for motor

Key Points:

  • Stepper motor requires specific sequence of pulses for rotation
  • ULN2003 provides current amplification for motor coils
  • 8-step sequence provides smoother rotation
  • Delay between steps controls rotation speed

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

Question 5(c OR) [7 marks]
#

Interface ADC0804 with 8051 microcontroller.

Answer:

Circuit Diagram:

VCRWIA0rSDRNn-e---Ta5f---RlV/----o2----g----->>>>>Input--->AD8C0058104PP03..02-P0.7|

Program:

ORG 0000H

START:  CLR P1.0      ; CS = 0 (Chip Select active)
        CLR P1.1      ; RD = 0 
        CLR P1.2      ; WR = 0
        SETB P1.2     ; WR = 1 (Start conversion)
        
WAIT:   JB P1.3, WAIT ; Wait for conversion (INTR = 0)
        
        CLR P1.1      ; RD = 0 (Read data)
        MOV A, P0     ; Read converted data into A
        MOV 30H, A    ; Store result in RAM
        
        SETB P1.0     ; CS = 1 (Chip deselect)
        
PROCESS:
        ; Process the data (e.g., display, compare, etc.)
        ; ...
        
        ACALL DELAY   ; Wait before next conversion
        SJMP START    ; Repeat
        
DELAY:  MOV R7, #200  ; Delay routine
DLOOP:  DJNZ R7, DLOOP
        RET
        
END
Connection8051 PinADC0804 Pin
Data BusP0.0-P0.7D0-D7
CSP1.0CS
RDP1.1RD
WRP1.2WR
INTRP1.3INTR

ADC0804 Features:

  • 8-bit resolution (256 steps)
  • 0-5V input range
  • Single-channel operation
  • ~100μs conversion time
  • Interface protocol:
    1. Activate CS, pulse WR to start conversion
    2. Wait for INTR to go low (conversion complete)
    3. Activate RD to read data
    4. Deactivate CS when done

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

Related

Microprocessor and Microcontroller (4341101) - Winter 2023 Solution
19 mins
Study-Material Solutions Microprocessor 4341101 2023 Winter
Electronic Circuits & Applications (4321103) - Winter 2024 Solution
18 mins
Study-Material Solutions Electronic-Circuits 4321103 2024 Winter
Python Programming (1323203) - Winter 2024 Solution
22 mins
Study-Material Solutions Python-Programming 1323203 2024 Winter
Fundamentals of Electrical Engineering (4311101) - Winter 2024 Solution
11 mins
Study-Material Solutions Electrical-Engineering 4311101 2024 Winter
Microprocessor and Microcontroller (4341101) - Summer 2023 Solution
23 mins
Study-Material Solutions Microprocessor 4341101 2023 Summer
Communication Engineering (1333201) - Winter 2023 Solution
24 mins
Study-Material Solutions Communication-Engineering 1333201 2023 Winter