મુખ્ય સામગ્રી પર જાઓ
  1. સંસાધનો/
  2. અભ્યાસ સામગ્રી/
  3. ઇન્ફોર્મેશન અને કમ્યુનિકેશન ટેકનોલોજી એન્જિનિયરિંગ/
  4. આઈસીટી સેમેસ્ટર 3/
  5. માઇક્રોપ્રોસેસર અને માઇક્રોકંટ્રોલર સિસ્ટમ્સ (1333202)/

માઇક્રોપ્રોસેસર અને માઇક્રોકંટ્રોલર સિસ્ટમ્સ (1333202) - શિયાળો 2023 સોલ્યુશન

23 મિનિટ· ·
Study-Material Solutions Microprocessor Microcontroller 1333202 2023 Winter Gujarati
મિલવ ડબગર
લેખક
મિલવ ડબગર
ઇલેક્ટ્રિકલ અને ઇલેક્ટ્રોનિક મેન્યુફેક્ચરિંગ ઉદ્યોગમાં અનુભવી લેક્ચરર. એમ્બેડેડ સિસ્ટમ્સ, ઈમેજ પ્રોસેસિંગ, ડેટા સાયન્સ, મેટલેબ, પાયથન, STM32માં કુશળ. એલ.ડી. કોલેજ ઓફ એન્જિનિયરિંગ - અમદાવાદથી કમ્યુનિકેશન સિસ્ટમ્સ એન્જિનિયરિંગમાં માસ્ટર્સ ડિગ્રી ધરાવતા મજબૂત શિક્ષણ વ્યાવસાયિક.
અનુક્રમણિકા

પ્રશ્ન 1(અ) [3 ગુણ]
#

માઇક્રોપ્રોસેસર ની વ્યાખ્યા આપો.

જવાબ:

માઇક્રોપ્રોસેસર એ એક સિંગલ ચિપ CPU છે જેમાં digital computer ના central processing unit ના કાર્યો કરવા માટે જરૂરી બધા arithmetic, logic અને control circuits હોય છે.

કોષ્ટક: માઇક્રોપ્રોસેસર ની મુખ્ય વિશેષતાઓ

વિશેષતાવર્ણન
Single Chipએક integrated circuit પર સંપૂર્ણ CPU
Processing Unitinstructions execute કરે છે અને calculations કરે છે
Control Logicsystem operations અને data flow ને manage કરે છે
  • Central Processing Unit: મુખ્ય component જે instructions execute કરે છે
  • Integrated Circuit: બધા functions એક જ silicon chip પર combined
  • Programmable Device: stored instructions આધારે વિવિધ programs execute કરી શકે છે

મેમરી ટ્રીક: “Single Chip CPU = Smart Computer Processor Unit”

પ્રશ્ન 1(બ) [4 ગુણ]
#

માઇક્રોપ્રોસેસર ના ફ્લેગ રેજિસ્ટર ને સમજાવો.

જવાબ:

Flag register માં ALU દ્વારા કરવામાં આવેલા arithmetic અને logical operations ના result વિશે status information store થાય છે.

કોષ્ટક: 8085 Flag Register Bits

FlagPositionહેતુ
S (Sign)Bit 7Result નું sign દશાર્વે છે (1=negative, 0=positive)
Z (Zero)Bit 6Result zero હોય ત્યારે set થાય છે
AC (Auxiliary Carry)Bit 4Bit 3 થી bit 4 માં carry
P (Parity)Bit 2Even parity flag
CY (Carry)Bit 0MSB માંથી carry
  • Status Indicator: છેલ્લા operation result ની condition બતાવે છે
  • Conditional Instructions: Branching અને decision making માટે ઉપયોગ થાય છે
  • 5 Active Flags: Sign, Zero, Auxiliary Carry, Parity અને Carry flags

મેમરી ટ્રીક: “Flags Show Zero, Sign, Parity, Auxiliary, Carry”

પ્રશ્ન 1(ક) [7 ગુણ]
#

માઇક્રોપ્રોસેસર નું instruction format ઉદાહરણ સાથે સમજાવો.

જવાબ:

Microprocessor instructions માં opcode અને operand fields હોય છે જે operation અને data locations specify કરે છે.

કોષ્ટક: 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

ડાયાગ્રામ:

graph TD
    A[Instruction Format] --> B[Opcode Field]
    A --> C[Operand Field]
    B --> D[Operation Code<br/>Operation Specify કરે છે]
    C --> E[Data/Address<br/>Source/Destination Specify કરે છે]
  • Opcode Field: કયું operation કરવું છે તે define કરે છે (ADD, MOV, JMP)
  • Operand Field: Data, register અથવા memory address information હોય છે
  • Variable Length: Instructions 1, 2 અથવા 3 bytes ની હોઈ શકે છે
  • Addressing Modes: Operand location specify કરવાની વિવિધ રીતો

મેમરી ટ્રીક: “Opcode Operations + Operand Objects = Complete Commands”

પ્રશ્ન 1(ક OR) [7 ગુણ]
#

માઇક્રોપ્રોસેસરમાં ALU, Control Unit અને CPU સમજાવો.

જવાબ:

CPU માં ત્રણ મુખ્ય functional units છે જે instructions execute કરવા માટે સાથે મળીને કામ કરે છે.

કોષ્ટક: CPU Components અને Functions

ComponentPrimary FunctionKey Operations
ALUArithmetic & Logic OperationsADD, SUB, AND, OR, XOR
Control UnitInstruction ControlFetch, Decode, Execute
CPUOverall Processingબધા operations coordinate કરે છે

ડાયાગ્રામ:

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: બધા arithmetic calculations અને logical operations કરે છે
  • Control Unit Tasks: Instruction execution cycle manage કરે છે અને control signals generate કરે છે
  • CPU Coordination: Complete processing માટે ALU અને Control Unit ને integrate કરે છે

મેમરી ટ્રીક: “ALU Adds, Control Commands, CPU Coordinates”

પ્રશ્ન 2(અ) [3 ગુણ]
#

ALE signal નું કાર્ય સમજાવો.

જવાબ:

ALE (Address Latch Enable) signal નો ઉપયોગ lower-order address અને data lines ને demultiplex કરવા માટે થાય છે.

કોષ્ટક: ALE Signal Functions

Functionવર્ણન
Address LatchingLower 8-bit address capture કરે છે
DemultiplexingAddress ને data થી separate કરે છે
Timing ControlTiming reference પ્રદાન કરે છે

ડાયાગ્રામ:

A8D008-57ALEA0L7-a4At37c7h3(Address)
  • Active High Signal: T1 state દરમિયાન ALE high જાય છે
  • External Latching: Address hold કરવા માટે 74373 latch સાથે ઉપયોગ થાય છે
  • System Timing: External devices માટે reference પ્રદાન કરે છે

મેમરી ટ્રીક: “ALE Always Latches External Addresses”

પ્રશ્ન 2(બ) [4 ગુણ]
#

માઇક્રોપ્રોસેસર અને માઇક્રોકંટ્રોલર ની સરખામણી કરો

જવાબ:

કોષ્ટક: Microprocessor vs Microcontroller Comparison

ParameterMicroprocessorMicrocontroller
DesignGeneral purposeApplication specific
MemoryExternal RAM/ROMInternal RAM/ROM
I/O PortsExternal interfaceBuilt-in I/O ports
TimersExternalBuilt-in timers
Costવધુ system costઓછો system cost
Powerવધુ consumptionઓછો consumption
  • Integration Level: Microcontroller માં વધુ integrated components હોય છે
  • Application Focus: Microprocessor computing માટે, microcontroller control માટે
  • System Complexity: Microprocessor ને વધુ external components જોઈએ છે
  • Design Flexibility: Microprocessor વધુ expandability આપે છે

મેમરી ટ્રીક: “Microprocessor = More Power, Microcontroller = More Control”

પ્રશ્ન 2(ક) [7 ગુણ]
#

માઇક્રોપ્રોસેસરનો બ્લોક ડાયાગ્રામ દોરો અને સમજાવો.

જવાબ:

8085 microprocessor માં કેટલાક functional blocks છે જે સાથે મળીને કામ કરે છે.

ડાયાગ્રામ:

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]

કોષ્ટક: Block Functions

BlockFunction
ALUArithmetic અને logical operations
Register ArrayTemporary data storage (B,C,D,E,H,L)
Control UnitInstruction execution control
Address BufferAddress bus lines drive કરે છે
  • Data Path: Internal bus દ્વારા registers વચ્ચે information flow થાય છે
  • Control Signals: Timing અને control unit દ્વારા generate થાય છે
  • Bus Interface: External memory અને I/O devices સાથે connect કરે છે
  • Register Operations: Operands અને results માટે temporary storage

મેમરી ટ્રીક: “Blocks Build Better Processing Systems”

પ્રશ્ન 2(અ OR) [3 ગુણ]
#

માઇક્રોપ્રોસેસરના 16 bits registers સમજાવો.

જવાબ:

8085 માં 8-bit register pairs ને combine કરીને બનેલા ત્રણ 16-bit registers છે.

કોષ્ટક: 16-bit Registers

RegisterFormationPurpose
PCSingle 16-bitProgram Counter - next instruction address
SPSingle 16-bitStack Pointer - stack ના top નું address
HLH + L registersMemory pointer - data address
  • Program Counter: આપમેળે next instruction પર increment થાય છે
  • Stack Pointer: Stack પર last pushed data તરફ point કરે છે
  • HL Pair: Memory addressing માટે સૌથી વધુ વપરાતું

મેમરી ટ્રીક: “PC Points Program, SP Stacks Properly, HL Holds Location”

પ્રશ્ન 2(બ OR) [4 ગુણ]
#

માઇક્રોપ્રોસેસર માં lower order address અને data lines ને de-multiplexing કરવાનું સમજાવો.

જવાબ:

8085 pin count ઘટાડવા માટે lower 8-bit address ને data lines સાથે multiplex કરે છે.

કોષ્ટક: Multiplexed Lines

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

ડાયાગ્રામ:

8A0D805-AD7AAL7L0E4a-3tA7c73h
  • Time Division: સમાન lines પહેલા address પછી data carry કરે છે
  • External Latch: ALE high હોય ત્યારે 74373 address capture કરે છે
  • Signal Separation: અલગ address અને data buses બનાવે છે

મેમરી ટ્રીક: “ALE Always Latches External Address Elegantly”

પ્રશ્ન 2(ક OR) [7 ગુણ]
#

8085 નો pin diagram દોરો અને સમજાવો.

જવાબ:

8085 એ multiplexed address/data bus વાળું 40-pin microprocessor છે.

ડાયાગ્રામ:

XXRSSTRRRIIAAAAAAAAV12SOIRSSSNNDDDDDDDDsTDDATTTTT01234567sP765RA12345678911111111112012345678908085PinDiagr43333333333222222222a09876543210987654321mVHHCRRISRWASAAAAAAAAcOLLEEO1DRL011111198cLDKSA/**E543210DAEDMTY*

કોષ્ટક: Pin Groups

GroupPinsFunction
Address/DataAD0-AD7, A8-A15Memory addressing અને data transfer
ControlALE, RD*, WR*, IO/M*Bus control signals
InterruptsINTR, RST7-RST5, TRAPInterrupt handling
PowerVcc, VssPower supply connections
  • Multiplexed Bus: AD0-AD7 address અને data બંને carry કરે છે
  • Active Low Signals: * વાળા signals active low છે
  • Crystal Connections: Clock generation માટે X1, X2

મેમરી ટ્રીક: “Forty Pins Provide Perfect Processing Power”

પ્રશ્ન 3(અ) [3 ગુણ]
#

માઇક્રોકંટ્રોલર ની clock અને reset circuit નો diagram દોરો

જવાબ:

8051 ને proper operation માટે external clock અને reset circuits જોઈએ છે.

ડાયાગ્રામ:

CXRRlTeSoAsTcLek1t13G+1C20NC50iMpDiVKrHFrczcuu1iCi0trtµ:y3G:Fs0N-tpDGaFNlXDTAL2

કોષ્ટક: Circuit Components

ComponentValuePurpose
Crystal11.0592 MHzClock generation
Capacitors30pF દરેકCrystal stabilization
Reset Resistor10KΩReset માટે pull-up
Reset Capacitor10µFPower-on reset delay
  • Clock Frequency: Serial communication માટે સામાન્ય રીતે 11.0592 MHz
  • Reset Duration: ઓછામાં ઓછા 2 machine cycles માટે high હોવું જોઈએ
  • Power-on Reset: Power apply થાય ત્યારે automatic reset

મેમરી ટ્રીક: “Crystals Create Clock, Resistors Reset Reliably”

પ્રશ્ન 3(બ) [4 ગુણ]
#

માઇક્રોકંટ્રોલર ની આંતરીક RAM સમજાવો.

જવાબ:

8051 માં વિવિધ sections માં organize થયેલા 256 bytes નો internal RAM છે.

કોષ્ટક: 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)

ડાયાગ્રામ:

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: દરેકમાં 8 registers (R0-R7) વાળા ચાર banks
  • Bit Addressing: 20H-2FH area માં individual bits address કરી શકાય છે
  • Stack Area: સામાન્ય રીતે general purpose RAM area માં હોય છે
  • Direct Access: બધા locations direct addressing દ્વારા accessible છે

મેમરી ટ્રીક: “RAM Registers, Bits, General, Special Functions”

પ્રશ્ન 3(ક) [7 ગુણ]
#

8051 નો બ્લોક ડાયાગ્રામ સમજાવો.

જવાબ:

8051 microcontroller એક જ chip પર CPU, memory અને I/O integrate કરે છે.

ડાયાગ્રામ:

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]

કોષ્ટક: મુખ્ય Blocks

BlockFunction
CPUInstruction execution અને control
Memory4KB ROM + 256B RAM
Timersબે 16-bit timer/counters
I/O Portsચાર 8-bit bidirectional ports
Serial PortFull-duplex UART
Interrupts5-source interrupt system
  • Harvard Architecture: અલગ program અને data memory spaces
  • Built-in Peripherals: Timers, serial port, interrupts integrated
  • Expandable: External memory અને I/O add કરી શકાય છે
  • Control Applications: Embedded control tasks માટે optimized

મેમરી ટ્રીક: “Complete Control Chip Contains CPU, Memory, I/O”

પ્રશ્ન 3(અ OR) [3 ગુણ]
#

DPTR અને PC નું કાર્ય સમજાવો.

જવાબ:

DPTR અને PC એ memory addressing માટે 8051 માં મહત્વપૂર્ણ 16-bit registers છે.

કોષ્ટક: DPTR અને PC Functions

RegisterFull FormFunction
DPTRData PointerExternal data memory તરફ point કરે છે
PCProgram CounterNext instruction address તરફ point કરે છે
  • DPTR Usage: External RAM અને lookup tables access કરવા માટે
  • PC Function: Instruction fetch પછી આપમેળે increment થાય છે
  • 16-bit Addressing: બંને 64KB memory space address કરી શકે છે

મેમરી ટ્રીક: “DPTR Data Pointer, PC Program Counter”

પ્રશ્ન 3(બ OR) [4 ગુણ]
#

માઇક્રોકંટ્રોલરમાં timer ના અલગ અલગ modes સમજાવો.

જવાબ:

8051 માં ચાર અલગ operating modes સાથે બે timers છે.

કોષ્ટક: Timer Modes

ModeConfigurationPurpose
Mode 013-bit timer8048 સાથે compatible
Mode 116-bit timerMaximum count capability
Mode 28-bit auto-reloadConstant time intervals
Mode 3બે 8-bit timersTimer 0 split operation
  • Mode Selection: TMOD register bits દ્વારા control થાય છે
  • Timer 0/1: બંને timers modes 0, 1, 2 support કરે છે
  • Mode 3 Special: ફક્ત Timer 0 જ mode 3 માં operate કરી શકે છે
  • Applications: Delays, baud rate generation, event counting

મેમરી ટ્રીક: “Modes Make Timers Tremendously Versatile”

પ્રશ્ન 3(ક OR) [7 ગુણ]
#

માઇક્રોકંટ્રોલર ની interrupts સમજાવો.

જવાબ:

8051 માં external events handle કરવા માટે 5-source interrupt system છે.

કોષ્ટક: 8051 Interrupt Sources

InterruptVector AddressPriorityTrigger
Reset0000Hસૌથી વધુPower-on/External
External 00003HવધુINT0 pin
Timer 0000BHમધ્યમTimer 0 overflow
External 10013Hમધ્યમINT1 pin
Timer 1001BHઓછુંTimer 1 overflow
Serial0023Hસૌથી ઓછુંSerial communication

ડાયાગ્રામ:

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 individual interrupt enables control કરે છે
  • Priority Control: IP register interrupt priorities set કરે છે
  • Vector Addresses: દરેક interrupt નું fixed vector location છે
  • Nested Interrupts: વધુ priority ઓછી priority ને interrupt કરી શકે છે

મેમરી ટ્રીક: “Five Interrupt Sources Serve System Efficiently”

પ્રશ્ન 4(અ) [3 ગુણ]
#

8051 ની data transfer instruction ઉદાહરણ આપી સમજાવો.

જવાબ:

Data transfer instructions registers, memory અને I/O ports વચ્ચે data move કરે છે.

કોષ્ટક: Data Transfer Instructions

InstructionExampleFunction
MOVMOV A,#55HImmediate data ને accumulator માં move કરે છે
MOVXMOVX A,@DPTRExternal RAM ને accumulator માં move કરે છે
MOVCMOVC A,@A+PCCode memory ને accumulator માં move કરે છે
  • MOV Variants: Register to register, immediate to register
  • External Access: External RAM operations માટે MOVX
  • Code Access: Program memory tables read કરવા માટે MOVC

મેમરી ટ્રીક: “MOV Moves data, MOVX eXternal, MOVC Code”

પ્રશ્ન 4(બ) [4 ગુણ]
#

માઇક્રોકંટ્રોલરના addressing modes નું list બનાવી સમજાવો.

જવાબ:

8051 flexible data access માટે કેટલાક addressing modes support કરે છે.

કોષ્ટક: 8051 Addressing Modes

ModeExampleવર્ણન
ImmediateMOV A,#55HInstruction માં data specify કર્યો છે
RegisterMOV A,R0Register contents ઉપયોગ કરે છે
DirectMOV A,30HDirect memory address
IndirectMOV A,@R0Register માં stored address
IndexedMOVC A,@A+DPTRBase address plus offset
  • Immediate Mode: Instruction માં constant data included છે
  • Register Mode: Register file ઉપયોગ કરીને સૌથી ઝડપી execution
  • Direct Mode: કોઈપણ internal RAM location access કરે છે
  • Indirect Mode: Arrays માટે pointer-based addressing
  • Indexed Mode: Table lookup અને array access

મેમરી ટ્રીક: “Immediate, Register, Direct, Indirect, Indexed Addressing”

પ્રશ્ન 4(ક) [7 ગુણ]
#

8 data block ને શરુઆત ના address location 100h થી 200h માં copy કરવાનો program લખો.

જવાબ:

Assembly Program:

ORG 0000H           ; Start address
MOV R0,#100H        ; Source address pointer
MOV R1,#200H        ; Destination address pointer  
MOV R2,#08H         ; 8 bytes માટે counter

LOOP:
MOV A,@R0           ; Source માંથી data read કરો
MOV @R1,A           ; Destination માં data write કરો
INC R0              ; Source pointer increment કરો
INC R1              ; Destination pointer increment કરો
DJNZ R2,LOOP        ; Counter decrement કરો અને zero નથી તો jump

END                 ; Program નો end

કોષ્ટક: Register Usage

RegisterPurpose
R0Source address pointer (100H)
R1Destination address pointer (200H)
R2Loop counter (8 bytes)
ATemporary data storage
  • Indirect Addressing: Memory access માટે @R0 અને @R1
  • Loop Control: DJNZ instruction decrements અને tests કરે છે
  • Block Transfer: 8 consecutive bytes efficiently copy કરે છે

મેમરી ટ્રીક: “Read, Write, Increment, Decrement, Jump Loop”

પ્રશ્ન 4(અ OR) [3 ગુણ]
#

બે data bytes ને ઉમેરો અને result ને R0 register માં save કરો.

જવાબ:

Assembly Program:

ORG 0000H           ; Start address
MOV A,#25H          ; પ્રથમ byte load કરો
ADD A,#35H          ; બીજો byte add કરો
MOV R0,A            ; Result ને R0 માં store કરો
END                 ; Program end

કોષ્ટક: Operation Steps

StepInstructionResult
1MOV A,#25HA = 25H
2ADD A,#35HA = 5AH
3MOV R0,AR0 = 5AH
  • Addition Result: 25H + 35H = 5AH
  • Flag Effects: Result > FFH હોય તો carry flag set થાય છે

મેમરી ટ્રીક: “Move, Add, Move = Simple Addition”

પ્રશ્ન 4(બ OR) [4 ગુણ]
#

Indexed addressing mode ઉદાહરણ સાથે સમજાવો.

જવાબ:

Indexed addressing memory access માટે base address plus offset ઉપયોગ કરે છે.

કોષ્ટક: Indexed Addressing Details

Componentવર્ણનExample
Base AddressDPTR અથવા 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      ; Address 1005H માંથી read કરો
  • Table Access: Lookup tables અને arrays માટે આદર્શ
  • Program Memory: MOVC ફક્ત code memory માંથી જ read કરે છે
  • Dynamic Indexing: Execution દરમિયાન index બદલાઈ શકે છે

મેમરી ટ્રીક: “Base + Index = Dynamic Access”

પ્રશ્ન 4(ક OR) [7 ગુણ]
#

માઇક્રોકંટ્રોલરનું stack operation, PUSH અને POP instruction સમજાવો.

જવાબ:

Stack એ temporary data storage માટે ઉપયોગમાં લેવાતું LIFO memory structure છે.

કોષ્ટક: Stack Operations

OperationInstructionFunction
PUSHPUSH 30HStack પર data store કરે છે
POPPOP 30HStack માંથી data retrieve કરે છે
Stack PointerSP registerStack ના top તરફ point કરે છે

ડાયાગ્રામ:

SPSStUPtaSacHckk000O765mpHHHeemroart:yion:upwPSaUPrSdHg3000r0887oHHHHw::3o0l:HdPSOPP30000H765HHH:

Example Program:

MOV SP,#30H         ; Stack pointer initialize કરો
PUSH ACC            ; Accumulator save કરો
PUSH B              ; B register save કરો
POP B               ; B register restore કરો
POP ACC             ; Accumulator restore કરો
  • LIFO Structure: Last In, First Out data organization
  • SP Auto-increment: Stack pointer આપમેળે adjust થાય છે
  • Subroutine Calls: Stack return addresses save કરે છે
  • Register Preservation: Register contents save/restore કરે છે

મેમરી ટ્રીક: “PUSH Puts Up, Stack Holds, POP Pulls Out”

પ્રશ્ન 5(અ) [3 ગુણ]
#

Branching instruction ઉદાહરણ સાથે સમજાવો.

જવાબ:

Branching instructions conditions આધારે અથવા unconditionally program flow alter કરે છે.

કોષ્ટક: Branching Instructions

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

Example:

MOV A,#00H          ; Zero load કરો
JZ ZERO_FOUND       ; A zero છે તો jump કરો
LJMP CONTINUE       ; Continue તરફ jump કરો
ZERO_FOUND:
    MOV R0,#01H     ; Flag set કરો
CONTINUE:
    NOP             ; Execution continue કરો
  • Program Control: Execution sequence બદલે છે
  • Conditional Jumps: Flag register status આધારે
  • Address Range: કોઈપણ program memory location પર jump કરી શકે છે

મેમરી ટ્રીક: “Jump Changes Control Flow”

પ્રશ્ન 5(બ) [4 ગુણ]
#

માઇક્રોકંટ્રોલર સાથે 8 LEDs ને interface કરો અને તેને on અને off કરવા માટેનો program લખો.

જવાબ:

Circuit Diagram:

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

Program:

ORG 0000H
MAIN:
    MOV P1,#0FFH        ; બધા LEDs ON કરો
    CALL DELAY          ; Wait કરો
    MOV P1,#00H         ; બધા LEDs OFF કરો  
    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

કોષ્ટક: Components

ComponentValuePurpose
Resistor330ΩCurrent limiting
LEDs8 piecesVisual indicators
PortP18-bit output port
  • Current Limiting: Resistors LEDs ને overcurrent થી protect કરે છે
  • Port Configuration: LED control માટે P1 ને output port તરીકે ઉપયોગ
  • Delay Routine: Visible ON/OFF timing બનાવે છે

મેમરી ટ્રીક: “Port Controls LEDs with Resistance and Delay”

પ્રશ્ન 5(ક) [7 ગુણ]
#

માઇક્રોકંટ્રોલર સાથે LCD ને interface કરો અને “welcome” display કરવાનો program લખો.

જવાબ:

Circuit Connections:

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

Program:

ORG 0000H
    CALL LCD_INIT       ; LCD initialize કરો
    CALL DISPLAY_MSG    ; Message display કરો
    SJMP $              ; અહીં stop કરો

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         ; Display clear કરો
    CALL COMMAND
    MOV P2,#06H         ; Entry mode set
    CALL COMMAND
    RET

DISPLAY_MSG:
    MOV DPTR,#MESSAGE   ; Message તરફ point કરો
NEXT_CHAR:
    CLR A
    MOVC A,@A+DPTR      ; Character read કરો
    JZ DONE             ; Zero હોય તો string end
    CALL SEND_CHAR      ; LCD પર character send કરો
    INC DPTR            ; Next character
    SJMP NEXT_CHAR
DONE:
    RET

COMMAND:
    CLR P1.0            ; Command માટે RS = 0
    SETB P1.1           ; EN = 1
    CLR P1.1            ; EN = 0 (pulse)
    CALL DELAY
    RET

SEND_CHAR:
    MOV P2,A            ; Data lines પર character put કરો
    SETB P1.0           ; Data માટે RS = 1
    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       ; Null terminator સાથે message string
END

કોષ્ટક: 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 (write માટે ground સાથે tied)
  • 4-bit Mode: Pins save કરવા માટે ફક્ત upper 4 data lines ઉપયોગ કરે છે
  • Control Signals: RS command/data select કરે છે, EN timing pulse આપે છે
  • Character Display: દરેક character ASCII code તરીકે send થાય છે
  • Initialization: Proper operation માટે જરૂરી command sequence

મેમરી ટ્રીક: “LCD Displays Characters with Commands and Data”

પ્રશ્ન 5(અ OR) [3 ગુણ]
#

Logical instruction ઉદાહરણ સાથે સમજાવો.

જવાબ:

Logical instructions data પર bitwise operations કરે છે.

કોષ્ટક: 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 (upper bits mask કરો)
ORL A,#F0H          ; A = 11110101B (upper bits set કરો)
XRL A,#FFH          ; A = 00001010B (બધા bits complement કરો)
  • Bit Manipulation: Bits setting, clearing અને testing માટે ઉપયોગ થાય છે
  • Masking Operations: ANL unwanted bits clear કરે છે
  • Flag Effects: Result આધારે parity flag update થાય છે

મેમરી ટ્રીક: “AND Masks, OR Sets, XOR Toggles”

પ્રશ્ન 5(બ OR) [4 ગુણ]
#

માઇક્રોકંટ્રોલર સાથે 7 segment ને interface કરો.

જવાબ:

Circuit Diagram:

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

Program to Display 0-9:

ORG 0000H
    MOV DPTR,#DIGIT_TABLE   ; Lookup table તરફ point કરો
    MOV R0,#0               ; Digit 0 થી start કરો

MAIN_LOOP:
    MOV A,R0                ; Current digit get કરો
    MOVC A,@A+DPTR          ; 7-segment code get કરો
    MOV P1,A                ; 7-segment પર display કરો
    CALL DELAY              ; 1 second wait કરો
    INC R0                  ; Next digit
    CJNE R0,#10,MAIN_LOOP   ; 10 reached છે કે check કરો
    MOV R0,#0               ; 0 પર reset કરો
    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

કોષ્ટક: 7-Segment Codes

DigitHex CodeBinarySegments Lit
03FH00111111a,b,c,d,e,f
106H00000110b,c
25BH01011011a,b,g,e,d
  • Common Cathode: Port pin high હોય ત્યારે segments light થાય છે
  • Current Limiting: Resistors segment damage અટકાવે છે
  • Lookup Table: Segment patterns નું efficient storage

મેમરી ટ્રીક: “Seven Segments Show Digits Clearly”

પ્રશ્ન 5(ક OR) [7 ગુણ]
#

માઇક્રોકંટ્રોલર સાથે LM 35 ને interface કરો અને temperature controller નો block diagram સમજાવો.

જવાબ:

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      ; ADC માંથી temperature read કરો
    CALL DISPLAY_TEMP   ; Display પર temperature show કરો
    CALL TEMP_CONTROL   ; Heating/cooling control કરો
    CALL DELAY          ; Next reading પહેલાં wait કરો
    SJMP MAIN

READ_TEMP:
    CLR P2.0            ; ADC conversion start કરો
    SETB P2.0           ; Start માટે pulse
    JNB P2.1,$          ; Conversion complete થવાની wait કરો
    MOV A,P1            ; Temperature data read કરો
    RET

TEMP_CONTROL:
    CJNE A,#30,CHECK_HIGH   ; Setpoint (30°C) સાથે compare કરો
CHECK_HIGH:
    JC TEMP_LOW             ; A < 30 હોય તો temperature low છે
    SETB P3.0               ; Cooling (fan) ON કરો
    CLR P3.1                ; Heating OFF કરો
    RET
TEMP_LOW:
    CLR P3.0                ; Cooling OFF કરો
    SETB P3.1               ; Heating ON કરો
    RET
END

કોષ્ટક: System Components

ComponentFunction
LM35Temperature sensor (10mV/°C)
ADC0804Analog to digital converter
8051Main controller
RelayHigh power loads switch કરે છે
DisplayCurrent temperature show કરે છે
  • Temperature Sensing: LM35 દરેક degree Celsius માટે 10mV આપે છે
  • ADC Conversion: Analog voltage ને digital value માં convert કરે છે
  • Control Logic: Setpoint સાથે compare કરે છે અને relays control કરે છે
  • Feedback System: Continuous monitoring અને adjustment
  • Safety Features: Over-temperature protection શક્ય છે

મેમરી ટ્રીક: “Sense, Convert, Compare, Control Temperature Automatically”

સંબંધિત

માઇક્રોપ્રોસેસર અને માઇક્રોકન્ટ્રોલર (4341101) - વિન્ટર 2023 સોલ્યુશન
20 મિનિટ
Study-Material Solutions Microprocessor 4341101 2023 Winter Gujarati
Embedded System & Microcontroller Application (4351102) - Winter 2023 Solution (Gujarati)
Study-Material Solutions Embedded-System 4351102 2023 Winter Gujarati
માઇક્રોપ્રોસેસર અને માઇક્રોકન્ટ્રોલર (4341101) - સમર 2023 સોલ્યુશન
23 મિનિટ
Study-Material Solutions Microprocessor 4341101 2023 Summer Gujarati
માઇક્રોપ્રોસેસર અને માઇક્રોકન્ટ્રોલર (4341101) - વિન્ટર 2024 સોલ્યુશન
23 મિનિટ
Study-Material Solutions Microprocessor 4341101 2024 Winter Gujarati
ભૌતિકશાસ્ત્ર (4300005) - શિયાળુ 2023 સોલ્યુશન
Study-Material Solutions Physics 4300005 2023 Winter Gujarati
# OOPS & Python Programming (4351108) - Winter 2023 Solution (ગુજરાતી)
Study-Material Solutions Python Oop 4351108 2023 Winter