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

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

24 મિનિટ· ·
અભ્યાસ-સાહિત્ય સોલ્યુશન માઇક્રોપ્રોસેસર માઇક્રોકંટ્રોલર 8085 8051 1333202 2024 સમર
મિલવ ડબગર
લેખક
મિલવ ડબગર
ઇલેક્ટ્રિકલ અને ઇલેક્ટ્રોનિક મેન્યુફેક્ચરિંગ ઉદ્યોગમાં અનુભવી લેક્ચરર. એમ્બેડેડ સિસ્ટમ્સ, ઈમેજ પ્રોસેસિંગ, ડેટા સાયન્સ, મેટલેબ, પાયથન, STM32માં કુશળ. એલ.ડી. કોલેજ ઓફ એન્જિનિયરિંગ - અમદાવાદથી કમ્યુનિકેશન સિસ્ટમ્સ એન્જિનિયરિંગમાં માસ્ટર્સ ડિગ્રી ધરાવતા મજબૂત શિક્ષણ વ્યાવસાયિક.
અનુક્રમણિકા

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

8051 માઇક્રોકંટ્રોલરના સામાન્ય ફીચર્સની યાદી બનાવો.

જવાબ:

ટેબલ: 8051 માઇક્રોકંટ્રોલરના સામાન્ય ફીચર્સ

ફીચરવર્ણન
On-chip Oscillatorબિલ્ટ-ઇન ક્લોક જનરેટર સર્કિટ
Program Memoryકોડ સ્ટોરેજ માટે 4KB આંતરિક ROM
Data Memory128 bytes આંતરિક RAM
I/O Ports4 દ્વિદિશીય 8-bit પોર્ટ્સ (P0-P3)
Timers/Countersબે 16-bit Timer/Counter યુનિટ્સ
Serial PortFull duplex UART કમ્યુનિકેશન
Interruptsપ્રાથમિકતા સાથે 5 interrupt સ્રોતો
SFRsકંટ્રોલ માટે Special Function Registers

મેમરી ટ્રીક: “On Program Data I/O Timers Serial Interrupts SFRs”

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

T-State, Machine Cycle, Instruction Cycle અને Opcode ની વ્યાખ્યા આપો.

જવાબ:

ટેબલ: માઇક્રોપ્રોસેસર ટાઇમિંગ વ્યાખ્યાઓ

શબ્દવ્યાખ્યાઅવધિ
T-Stateસિસ્ટમ ક્લોકનો એક સમયગાળોમૂળભૂત ટાઇમિંગ યુનિટ
Machine Cycleએક મેમરી ઓપરેશન પૂરું કરવાનો સમય3-6 T-states
Instruction Cycleinstruction fetch, decode અને execute કરવાનો સમય1-4 Machine cycles
Opcodeinstruction પ્રકાર દર્શાવતો operation કોડ1-3 bytes
  • T-State: માઇક્રોપ્રોસેસર ઓપરેશનનો સૌથી નાનો સમય એકમ
  • Machine Cycle: મેમરી એક્સેસ માટે અનેક T-states ધરાવે છે
  • Instruction Cycle: સંપૂર્ણ instruction execution નો સમય
  • Opcode: વિશિષ્ટ instruction ઓળખતો બાઇનરી કોડ

મેમરી ટ્રીક: “Time Machine Instruction Operation”

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

Von-Neumann અને Harvard Architecture ની સરખામણી કરો.

જવાબ:

ટેબલ: Von-Neumann vs Harvard Architecture સરખામણી

પરિમાણVon-NeumannHarvard
Memory Organizationકોડ અને ડેટા માટે એક જ મેમરીકોડ અને ડેટા માટે અલગ મેમરી
Bus Structureએક જ bus સિસ્ટમડ્યુઅલ bus સિસ્ટમ
Speedbus sharing થી ધીમીparallel access થી ઝડપી
Costઓછી કિંમતે અમલીકરણડ્યુઅલ મેમરી થી વધારે કિંમત
Flexibilityવધારે flexible મેમરી ઉપયોગઓછી flexibility, નિશ્ચિત allocation
Examples8085, x86 processors8051, DSP processors
graph TB
    subgraph "Von-Neumann Architecture"
        CPU1[CPU] <--> MEM1[Single Memory<br/>Code + Data]
    end
    
    subgraph "Harvard Architecture"
        CPU2[CPU] <--> PMEM[Program Memory]
        CPU2 <--> DMEM[Data Memory]
    end

મુખ્ય તફાવતો:

  • Memory Access: Von-Neumann sequential access, Harvard simultaneous access
  • Performance: embedded applications માટે Harvard ઝડપી છે
  • Applications: general computing માટે Von-Neumann, real-time systems માટે Harvard

મેમરી ટ્રીક: “Von-Single Harvard-Dual”

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

Microcomputer System ને block diagram સાથે સમજાવો.

જવાબ:

Microcomputer System ના ઘટકો:

graph TB
    subgraph "Microcomputer System"
        CPU[Central Processing Unit<br/>- Control Unit<br/>- ALU<br/>- Registers] 
        MEM[Memory Unit<br/>- RAM<br/>- ROM]
        IO[Input/Output Unit<br/>- Keyboard<br/>- Display<br/>- Ports]
        SYS[System Bus<br/>- Address Bus<br/>- Data Bus<br/>- Control Bus]
        
        CPU <--> SYS
        MEM <--> SYS
        IO <--> SYS
    end

ટેબલ: Microcomputer System ના ઘટકો

ઘટકકાર્યઉદાહરણો
CPUકેન્દ્રીય પ્રોસેસિંગ અને નિયંત્રણ8085, 8086
Memoryપ્રોગ્રામ અને ડેટા સ્ટોરેજRAM, ROM, EPROM
I/O Unitબાહ્ય દુનિયા સાથે interfaceKeyboard, Display
System Busડેટા ટ્રાન્સફર માર્ગAddress, Data, Control
  • CPU: instructions execute કરે છે અને સિસ્ટમ ઓપરેશન control કરે છે
  • Memory: પ્રોસેસિંગ માટે programs અને data store કરે છે
  • I/O: બાહ્ય devices સાથે કમ્યુનિકેશન પૂરું પાડે છે
  • Bus: ડેટા ટ્રાન્સફર માટે બધા components ને જોડે છે

મેમરી ટ્રીક: “CPU Memory I/O Bus”

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

8085 Microprocessor માં Bus organization દોરો.

જવાબ:

A1MSd6eydB-msrubotesirestyms8C0P8U5D8eDB-Iaub/itsiOcates

ટેબલ: 8085 Bus Organization

Bus પ્રકારWidthકાર્ય
Address Bus16-bitમેમરી addressing (64KB)
Data Bus8-bitડેટા ટ્રાન્સફર
Control BusMultipleકંટ્રોલ સિગ્નલ્સ

મેમરી ટ્રીક: “Address Data Control”

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

8085 માં ઉપયોગમાં લેવાતા Flags ની સૂચી બનાવો અને દરેક flag નું કાર્ય સમજાવો.

જવાબ:

ટેબલ: 8085 Flags Register

FlagનામBit Positionકાર્ય
SSignD7પરિણામ નકારાત્મક હોય તો set
ZZeroD6પરિણામ શૂન્ય હોય તો set
ACAuxiliary CarryD4bit 3 થી 4 માં carry હોય તો set
PParityD2પરિણામમાં even parity હોય તો set
CYCarryD0carry/borrow થાય તો set
D7SD6ZD5D4ACD3D2PD1D0CY
  • Sign Flag: નકારાત્મક પરિણામ દર્શાવે છે (MSB = 1)
  • Zero Flag: arithmetic પરિણામ શૂન્ય થાય ત્યારે set થાય છે
  • Auxiliary Carry: BCD arithmetic operations માટે ઉપયોગ થાય છે
  • Parity Flag: પરિણામમાં 1’s ની સમ સંખ્યા તપાસે છે
  • Carry Flag: arithmetic operations માં overflow દર્શાવે છે

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

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

8085 નો Block Diagram દોરો અને સમજાવો.

જવાબ:

graph TB
    subgraph "8085 Microprocessor"
        ALU[Arithmetic Logic Unit<br/>8-bit operations]
        ACC[Accumulator<br/>Register A]
        REG[General Purpose<br/>Registers B,C,D,E,H,L]
        PC[Program Counter<br/>16-bit]
        SP[Stack Pointer<br/>16-bit]
        FLAGS[Flag Register<br/>5 flags]
        CU[Control Unit<br/>Instruction decode]
        
        ALU <--> ACC
        REG <--> ALU
        PC --> CU
        CU --> ALU
        FLAGS <--> ALU
    end
    
    EXT["External Buses<br/>Address(16), Data(8), Control"]
    8085 <--> EXT

ટેબલ: 8085 Block Components

Blockકાર્યSize
ALUArithmetic અને logical operations8-bit
Accumulatoroperations માટે પ્રાથમિક register8-bit
Registersડેટા સ્ટોરેજ (B,C,D,E,H,L)દરેક 8-bit
Program Counterઆગલી instruction તરફ point કરે છે16-bit
Stack Pointerstack ના top તરફ point કરે છે16-bit
Control UnitInstruction decode અને control-
  • Data Flow: PC દ્વારા instructions fetch, CU દ્વારા decode, ALU માં execute
  • Register Operations: Accumulator ALU સાથે કાર્ય કરે છે, બીજા registers ડેટા store કરે છે
  • Address Generation: PC અને SP 16-bit addresses આપે છે
  • Control Signals: CU timing અને control signals generate કરે છે

મેમરી ટ્રીક: “ALU Accumulator Registers Program Stack Control”

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

Microprocessor માં Instruction Fetching, Decoding અને Execution Operation સમજાવો.

જવાબ:

sequenceDiagram
    participant PC as Program Counter
    participant MEM as Memory
    participant IR as Instruction Register
    participant CU as Control Unit
    participant ALU as ALU
    
    PC->>MEM: Send address
    MEM->>IR: Fetch instruction
    IR->>CU: Send opcode
    CU->>ALU: Generate control signals
    ALU->>ALU: Execute operation

ટેબલ: Instruction Cycle Phases

PhaseOperationDuration
Fetchમેમરીમાંથી instruction મેળવો1 machine cycle
DecodeInstruction opcode નું અર્થઘટનExecute નો ભાગ
Executeજરૂરી operation કરો1-3 machine cycles

મેમરી ટ્રીક: “Fetch Decode Execute”

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

8085 માં Lower order Address અને Data lines નું Demultiplexing શું છે? આકૃતિની મદદથી સમજાવો.

જવાબ:

AA7d-dAArD70e87A4s0-LLs8AES5D307D37D-aDt0aMAALuddalddttrrcieehpsslssIe/CxDLeaadttachEnable

Demultiplexing Process:

  • ALE Signal: address અને data ના વિભાજનને control કરે છે
  • Latch IC: ALE high હોય ત્યારે 74LS373 address store કરે છે
  • Timing: પહેલા address આવે છે, પછી same lines પર data આવે છે

ટેબલ: Demultiplexing Components

Componentકાર્યTiming
ALEAddress Latch Enable signalT1 દરમિયાન high
74LS373Octal latch ICA7-A0 store કરે છે
AD7-AD0Multiplexed linesપહેલા Address પછી Data

મેમરી ટ્રીક: “Address Latch Enable Demultiplexes Lines”

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

8085 નો Pin Diagram દોરો અને સમજાવો.

જવાબ:

XXRSSTRRRIIAAAAAAAAV12SOIRSSSNNDDDDDDDDSTDDATTTTT01234567SP765RA12345678911111111112012345678908085PINDIAGR43333333333222222222A09876543210987654321MVHHCRRISRWASAAAAAAAACOLLEEO1DRL011111198CLDKSA/E543210DAEDMTYIN

ટેબલ: 8085 Pin કાર્યો

Pin Groupકાર્યCount
Address BusA8-A15 (ઉચ્ચ ક્રમ)8 pins
Address/DataAD0-AD7 (Multiplexed)8 pins
Control SignalsALE, RD, WR, IO/M4 pins
InterruptsTRAP, RST7.5, RST6.5, RST5.5, INTR5 pins
PowerVCC, VSS2 pins
ClockX1, X2, CLK3 pins
  • Address Lines: 16-bit addressing ક્ષમતા (64KB)
  • Data Lines: 8-bit ડેટા ટ્રાન્સફર
  • Control Lines: મેમરી અને I/O ઓપરેશન કંટ્રોલ
  • Interrupt Lines: હાર્ડવેર interrupt handling

મેમરી ટ્રીક: “Address Data Control Interrupt Power Clock”

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

8051 નો IP SFR દોરો અને દરેક bit નું કાર્ય સમજાવો.

જવાબ:

IMPSDB7RegDi6steDr5(IDnP4tTe2rDr3uPpStD2PPrTi1Do1riPtXDyL10)SB-PXA0ddressB8H

ટેબલ: IP Register Bit કાર્યો

Bitનામકાર્ય
D4PT2Timer 2 interrupt priority
D3PSSerial port interrupt priority
D2PT1Timer 1 interrupt priority
D1PX1External interrupt 1 priority
D0PX0External interrupt 0 priority
  • Priority Levels: 1 = High priority, 0 = Low priority
  • Default: બધા interrupts low priority (00H)
  • Usage: High priority interrupt માટે bit 1 કરો

મેમરી ટ્રીક: “Timer2 Serial Timer1 External1 External0”

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

8051 માટે Timer/Counter Logic diagram દોરો અને સમજાવો.

જવાબ:

graph TB
    subgraph "Timer/Counter Logic"
        OSC[System Clock<br/>÷12] --> MUX1{Timer/Counter<br/>Mode Select}
        T0PIN[T0 Pin<br/>External] --> MUX1
        MUX1 --> TH0[TH0 Register<br/>High Byte]
        TH0 --> TL0[TL0 Register<br/>Low Byte]
        TL0 --> OVF[Overflow<br/>Flag TF0]
        
        TMOD[TMOD Register<br/>Mode Control] --> MUX1
        TCON[TCON Register<br/>Control Bits] --> MUX1
    end

ટેબલ: Timer Components

Componentકાર્યSize
TH0/TL0Timer 0 high/low byte registersદરેક 8-bit
TMODTimer mode register8-bit
TCONTimer control register8-bit
TF0Timer 0 overflow flag1-bit
  • Clock Source: આંતરિક (system clock/12) અથવા બાહ્ય (T0 pin)
  • Operation: લોડ કરેલા મૂલ્યથી FFH સુધી count કરે છે
  • Overflow: TF0 flag set કરે છે અને interrupt generate કરે છે
  • Modes: 4 અલગ અલગ timer modes ઉપલબ્ધ છે

મેમરી ટ્રીક: “Timer High-Low Mode Control Flag”

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

8051 નો Block Diagram દોરો અને સમજાવો.

જવાબ:

graph TB
    subgraph "8051 Microcontroller"
        CPU[8-bit CPU<br/>ALU + Control]
        ROM[Program Memory<br/>4KB ROM]
        RAM[Data Memory<br/>128B RAM]
        
        T0[Timer 0<br/>16-bit]
        T1[Timer 1<br/>16-bit]
        UART[Serial Port<br/>Full Duplex]
        
        P0[Port 0<br/>8-bit I/O]
        P1[Port 1<br/>8-bit I/O]
        P2[Port 2<br/>8-bit I/O]
        P3[Port 3<br/>8-bit I/O]
        
        INT[Interrupt<br/>System]
        OSC[Oscillator<br/>Clock Gen]
        
        CPU <--> ROM
        CPU <--> RAM
        CPU <--> T0
        CPU <--> T1
        CPU <--> UART
        CPU <--> P0
        CPU <--> P1
        CPU <--> P2
        CPU <--> P3
        CPU <--> INT
        OSC --> CPU
    end

ટેબલ: 8051 Block Components

Blockકાર્યવિશેષતા
CPUકેન્દ્રીય પ્રોસેસિંગ યુનિટ8-bit processor
Program Memoryકોડ સ્ટોરેજ4KB આંતરિક ROM
Data Memoryવેરિયેબલ સ્ટોરેજ128 bytes RAM
I/O Portsબાહ્ય interface4 ports (32 I/O lines)
Timersટાઇમિંગ ઓપરેશન્સ2 × 16-bit timers
Serial Portકમ્યુનિકેશનFull duplex UART
InterruptsEvent handling5 interrupt sources
  • Architecture: program/data મેમરી માટે અલગ Harvard architecture
  • I/O Capability: 32 દ્વિદિશીય I/O lines
  • On-chip Features: Timers, serial port, interrupt system
  • Memory: ડેટા માટે Von-Neumann, પ્રોગ્રામ માટે Harvard

મેમરી ટ્રીક: “CPU Program Data I/O Timer Serial Interrupt”

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

8051 નો PCON SFR દોરો અને દરેક bit નું કાર્ય સમજાવો.

જવાબ:

PMCSSDOBM7NODR|De6gisDt5erD(4Pow|DeG3rF1C|DoG2nFt0r|Do1lP)D|D-LI0SDABLd|dress87H

ટેબલ: PCON Register Bit કાર્યો

Bitનામકાર્ય
D7SMODSerial port mode modifier
D3GF1General purpose flag bit 1
D2GF0General purpose flag bit 0
D1PDPower down mode control
D0IDLIdle mode control
  • SMOD: set થાય ત્યારે serial port baud rate બમણો કરે છે
  • GF1, GF0: યુઝર-ડિફાઇન્ડ flag bits
  • PD: power-down mode સક્રિય કરે છે
  • IDL: idle mode સક્રિય કરે છે

મેમરી ટ્રીક: “Serial General Power Idle”

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

8051 Serial communication Mode 1 માં, XTAL=11.0592 MHz માટે, 9600 અને 4800 baud rate મેળવવા માટે TH1 ની કિંમત શોધો.

જવાબ:

Mode 1 Baud Rate માટે સૂત્ર:

Baud Rate = (2^SMOD/32) × (Timer1 Overflow Rate)
Timer1 Overflow Rate = XTAL/(12 × (256 - TH1))

9600 Baud Rate માટે:

9600 = (1/32) × (11059200/(12 × (256 - TH1)))
9600 = 28800/(256 - TH1)
256 - TH1 = 3
TH1 = 253 = FDH

4800 Baud Rate માટે:

4800 = (1/32) × (11059200/(12 × (256 - TH1)))
4800 = 28800/(256 - TH1)
256 - TH1 = 6
TH1 = 250 = FAH

ટેબલ: Baud Rates માટે TH1 મૂલ્યો

Baud RateTH1 મૂલ્ય (Hex)TH1 મૂલ્ય (Decimal)
9600FDH253
4800FAH250

મેમરી ટ્રીક: “Higher Baud Higher TH1”

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

8051 માં LCALL અને LJMP instructions માં શું ફરક છે?

જવાબ:

ટેબલ: LCALL vs LJMP સરખામણી

પરિમાણLCALLLJMP
FunctionLong subroutine callLong jump
Stack UsageReturn address push કરે છેકોઈ stack operation નથી
ReturnRET instruction જરૂરીફક્ત direct jump
Bytes3 bytes3 bytes
Address Range16-bit (64KB)16-bit (64KB)
PC ActionSave પછી loadસીધું load
  • LCALL: subroutine call કરે છે, return address stack પર save કરે છે
  • LJMP: specified address પર unconditional jump
  • Stack Impact: LCALL 2 stack bytes વાપરે છે, LJMP કોઈ વાપરતું નથી
  • Usage: functions માટે LCALL, program flow control માટે LJMP

મેમરી ટ્રીક: “Call Saves Jump Goes”

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

Timer0 વાપરીને port 1.0 પર square wave generate કરવા માટે 8051 Assembly Language Program લખો.

જવાબ:

ORG 0000H           ; શરૂઆતી address
LJMP MAIN           ; મુખ્ય પ્રોગ્રામ પર jump

ORG 0030H           ; મુખ્ય પ્રોગ્રામ શરૂઆત
MAIN:
    MOV TMOD, #01H  ; Timer0 mode1 (16-bit)
    MOV TH0, #HIGH(-50000)  ; High byte લોડ કરો
    MOV TL0, #LOW(-50000)   ; Low byte લોડ કરો
    SETB TR0        ; Timer0 શરૂ કરો

LOOP:
    JNB TF0, LOOP   ; Overflow માટે રાહ જુઓ
    CLR TF0         ; Overflow flag clear કરો
    CPL P1.0        ; P1.0 toggle કરો
    MOV TH0, #HIGH(-50000)  ; Timer reload કરો
    MOV TL0, #LOW(-50000)   ; Timer reload કરો
    SJMP LOOP       ; પુનરાવર્તન

END

પ્રોગ્રામ સમજાવટ:

  • Timer Setup: Mode 1 (16-bit timer)
  • Count Value: વિશિષ્ટ delay માટે -50000
  • Square Wave: દરેક overflow પર P1.0 toggle કરો
  • Continuous: Loop square wave જાળવે છે

મેમરી ટ્રીક: “Mode Load Start Wait Toggle Reload”

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

8051 ની કોઈપણ ત્રણ Logical અને ચાર Data Transfer Instructions ઉદાહરણ સાથે સમજાવો.

જવાબ:

ટેબલ: Logical Instructions

Instructionકાર્યઉદાહરણપરિણામ
ANLLogical ANDANL A, #0FHA = A AND 0FH
ORLLogical ORORL A, #F0HA = A OR F0H
XRLLogical XORXRL A, #FFHA = A XOR FFH

ટેબલ: Data Transfer Instructions

Instructionકાર્યઉદાહરણઓપરેશન
MOVડેટા move કરોMOV A, #50HA માં 50H લોડ કરો
MOVXExternal moveMOVX A, @DPTRExternal memory થી લોડ કરો
PUSHStack પર pushPUSH ACCAccumulator stack પર push
POPStack થી popPOP ACCStack થી accumulator માં pop

વિગતવાર ઉદાહરણો:

; Logical Instructions
ANL A, #0FH     ; Upper nibble mask કરો
ORL P1, #80H    ; Port1 નો bit 7 set કરો
XRL A, #FFH     ; Accumulator complement કરો

; Data Transfer Instructions
MOV R0, #30H    ; Immediate data લોડ કરો
MOVX @DPTR, A   ; External memory માં store કરો
PUSH B          ; B register save કરો
POP PSW         ; Status word restore કરો

મેમરી ટ્રીક: “AND OR XOR Move External Push Pop”

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

Instructions સમજાવો: (i) RRC A (ii) POP (iii) CLR PSW.7

જવાબ:

ટેબલ: Instruction સમજાવટો

Instructionકાર્યઓપરેશનઉદાહરણ
RRC ACarry દ્વારા જમણે rotateA→C, C→A(MSB)A=85H,C=0 → A=42H,C=1
POPStack થી popSP→Register, SP-1POP ACC
CLR PSW.7PSW નો bit 7 clearPSW.7 = 0CY flag clear
RRC:AO:pAeAr=a=t[i[CoDn7:DD76DD65DD54DD43DD32DD21DD10]]CC==[[DC0]]
  • RRC A: Accumulator ને carry flag દ્વારા જમણે rotate કરે છે
  • POP: Top stack element ને specified register માં remove કરે છે
  • CLR PSW.7: Carry flag clear કરે છે (Program Status Word નો bit 7)

મેમરી ટ્રીક: “Rotate Pop Clear”

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

30H લોકેશનમાં સેટોર ડેટાને 31H લોકેશનમાં સ્ટોર ડેટાવડે ભાગાકાર કરી શેષને 40h અને ભાગફળને 41h મેમરી લોકેશનમાં સ્ટોર કરવા માટે 8051 નો Assembly Language Program લખો.

જવાબ:

ORG 0000H           ; પ્રોગ્રામ શરૂઆત
LJMP MAIN

ORG 0030H
MAIN:
    MOV A, 30H      ; Dividend લોડ કરો
    MOV B, 31H      ; Divisor લોડ કરો
    DIV AB          ; A ને B વડે ભાગો
    MOV 41H, A      ; Quotient સ્ટોર કરો
    MOV 40H, B      ; Remainder સ્ટોર કરો
    SJMP $          ; અહીં રોકો

END

પ્રોગ્રામ સ્ટેપ્સ:

  1. ડેટા લોડ: Dividend અને divisor ને A અને B માં move કરો
  2. Division: DIV AB instruction વાપરો
  3. પરિણામ સ્ટોર: A માં quotient, B માં remainder
  4. Save: પરિણામો specified મેમરી લોકેશન્સમાં સ્ટોર કરો

ટેબલ: DIV AB Instruction

પહેલાંપછી
A = DividendA = Quotient
B = DivisorB = Remainder

મેમરી ટ્રીક: “Load Divide Store”

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

8051 Microcontroller ના Addressing Modes ની યાદી બનાવો અને દરેકને ઉદાહરણ સાથે સમજાવો.

જવાબ:

ટેબલ: 8051 Addressing Modes

Modeવર્ણનઉદાહરણસમજાવટ
ImmediateInstruction માં ડેટાMOV A, #50HA માં 50H લોડ કરો
RegisterRegister વાપરોMOV A, R0R0 નો content A માં move કરો
Directમેમરી address સ્પષ્ટMOV A, 30HAddress 30H થી લોડ કરો
IndirectRegister માં addressMOV A, @R0R0 માં આવેલા address થી લોડ કરો
IndexedBase + offsetMOVC A, @A+DPTRA = content of (A+DPTR)
RelativePC + offsetSJMP HEREPC સાપેક્ષ jump
BitBit addressSETB P1.0Port 1 નો bit 0 set કરો

વિગતવાર ઉદાહરણો:

; Immediate Addressing
MOV A, #25H         ; તુરંત મૂલ્ય 25H લોડ કરો

; Register Addressing  
MOV A, R7           ; Register R7 ને A માં move કરો

; Direct Addressing
MOV A, 40H          ; મેમરી લોકેશન 40H થી લોડ કરો

; Indirect Addressing
MOV R0, #50H        ; R0 address 50H તરફ point કરે છે
MOV A, @R0          ; R0 દ્વારા પોઇન્ટ કરેલા address થી લોડ કરો

; Indexed Addressing
MOV DPTR, #TABLE    ; Lookup table તરફ point કરો
MOVC A, @A+DPTR     ; Table[A] થી લોડ કરો

; Relative Addressing
SJMP NEXT           ; Label NEXT પર jump કરો

; Bit Addressing
SETB P2.5           ; Port 2 નો bit 5 set કરો

મેમરી ટ્રીક: “Immediate Register Direct Indirect Indexed Relative Bit”

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

8051 microcontroller સાથે Relay ઇન્ટરફેસિંગ દોરો.

જવાબ:

8R0e5lN12NRC+aO.PBeoVyP2NCliCoK5alCCr4yoNt7(nC1tP2aiCVcno)tRBTl1sLearl2ossaeVaiencdsstRtioeCosrlortanoynrection

ટેબલ: Interface Components

Componentકાર્યમૂલ્ય
TransistorCurrent amplifierBC547 NPN
ResistorBase current limiter2.2KΩ
RelayElectromagnetic switch12V DC
DiodeBack EMF protection1N4007
  • Operation: Port pin HIGH → Transistor ON → Relay energized
  • Protection: Diode back EMF damage અટકાવે છે
  • Isolation: Relay electrical isolation પૂરું પાડે છે

મેમરી ટ્રીક: “Transistor Resistor Relay Diode”

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

8051 microcontroller સાથે 7-Segment display ઇન્ટરફેસ કરો અને “1” પ્રિન્ટ કરવાનો પ્રોગ્રામ લખો.

જવાબ:

PPPPPPPP11111111........0123456787ffee0-agd5Sagd1eagd--------gagdP[[[[[[[[mbbcco33333333er33333333ndt00000000tpΩΩΩΩΩΩΩΩ1]]]]]]]]D--------i--------s--------p--------laabcdefgdyp

“1” Display કરવાનો પ્રોગ્રામ:

ORG 0000H
LJMP MAIN

ORG 0030H
MAIN:
    MOV P1, #06H    ; "1" display કરો (segments b,c ON)
    SJMP $          ; અહીં રોકો

; "1" માટે Pattern: 00000110 = 06H
; ફક્ત segments b અને c ON છે

END

ટેબલ: 7-Segment Display Components

Componentકાર્યમૂલ્ય
Current Limiting ResistorLED segments ને protect કરે છે330Ω
Port ConnectionDigital output controlPort 1
Display PatternSegment controlBinary pattern

મેમરી ટ્રીક: “Current Limit Segment Pattern”

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

8051 microcontroller સાથે DAC 0808 ઇન્ટરફેસ કરો અને Square wave generate કરવાનો પ્રોગ્રામ લખો.

જવાબ:

PPPPPPPPPo22222222r........t0123456780251DDDDDDDD01234567DAC08II0ORVVG8UECENTFCED--[[(11+-G0055NOKKVVDpΩΩ)))-O]]Au--mt--pp--uBtufferVout

Square Wave Generate કરવાનો પ્રોગ્રામ:

ORG 0000H
LJMP MAIN

ORG 0030H
MAIN:
    MOV A, #00H     ; Minimum મૂલ્ય (0V)
    MOV P2, A       ; DAC પર output
    CALL DELAY      ; રાહ જુઓ
    
    MOV A, #0FFH    ; Maximum મૂલ્ય (લગભગ 5V)
    MOV P2, A       ; DAC પર output
    CALL DELAY      ; રાહ જુઓ
    
    SJMP MAIN       ; Square wave માટે પુનરાવર્તન

DELAY:
    MOV R0, #200    ; Delay counter
LOOP1:
    MOV R1, #250    ; Inner loop counter
LOOP2:
    DJNZ R1, LOOP2  ; Inner delay loop
    DJNZ R0, LOOP1  ; Outer delay loop
    RET

END

ટેબલ: DAC Interface Specifications

પરિમાણમૂલ્યકાર્ય
Resolution8-bit256 output levels
Reference Voltage5VFull scale output
Output Range0-5VAnalog voltage range
Interface TypeParallel8-bit data bus

Square Wave Generation:

  • Low Level: 00H લગભગ 0V output પેદા કરે છે
  • High Level: FFH લગભગ 5V output પેદા કરે છે
  • Frequency: Delay routine ના duration દ્વારા નક્કી થાય છે
  • Output: DAC output પર સ્વચ્છ analog square wave

મેમરી ટ્રીક: “Digital Analog Convert Square”

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

8051 microcontroller સાથે Push button Switch નું Interface.

જવાબ:

+1SG50WNVKDPPuulPsl1h-.u0Bpu(tR8te0os5ni1sStPwooirrttchPin)

ટેબલ: Push Button Interface Components

Componentમૂલ્યકાર્ય
Pull-up Resistor10KΩSwitch ખુલ્લું હોય ત્યારે logic HIGH સુનિશ્ચિત કરે છે
Push ButtonSPST MomentaryUser input device
Logic LevelsHIGH=1, LOW=0Switch ખુલ્લું=1, દબાવ્યું=0

Sample Program:

CHECK_SWITCH:
    JB P1.0, SW_RELEASED    ; Switch દબાવ્યું નથી તો jump
    ; Switch દબાવેલું હોય ત્યારનો code અહીં
    CALL SWITCH_PRESSED
    SJMP CHECK_SWITCH

SW_RELEASED:
    ; Switch દબાવ્યું નથી ત્યારનો code અહીં
    SJMP CHECK_SWITCH

SWITCH_PRESSED:
    ; Switch દબાવેલું હોય ત્યારે action
    RET

Operation:

  • Switch ખુલ્લું: Pull-up resistor pin ને HIGH (logic 1) બનાવે છે
  • Switch દબાવ્યું: Pin GND સાથે જોડાય છે, LOW (logic 0) બને છે
  • Debouncing: વિશ્વસનીય operation માટે software debouncing જરૂરી હોઈ શકે છે

મેમરી ટ્રીક: “Pull-up Switch Ground”

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

8051 microcontroller સાથે DC Motor ઇન્ટરફેસ કરો.

જવાબ:

805T11NIM+N1PPDoV4PKN1CtC0o2oC0r2r7t(1P2iCVno)BBP(l1F((aaoDl2rMPsswaeVeo1eeercet.rltDwo0RioChr)eTnresrgMeiatolsnotitsnonoi)rgrstDoirod)e

Motor Control Program:

MOTOR_ON:
    SETB P1.0       ; Motor ON કરો
    RET

MOTOR_OFF:
    CLR P1.0        ; Motor OFF કરો
    RET

MOTOR_SPEED_CONTROL:
    ; Speed control માટે PWM
    SETB P1.0       ; Motor ON
    CALL DELAY_ON   ; ON time duration
    CLR P1.0        ; Motor OFF  
    CALL DELAY_OFF  ; OFF time duration
    RET

DELAY_ON:
    MOV R0, #100    ; ON time delay
    DJNZ R0, $
    RET

DELAY_OFF:
    MOV R0, #50     ; OFF time delay  
    DJNZ R0, $
    RET

ટેબલ: DC Motor Interface Components

Componentકાર્યવિશેષતા
Power TransistorCurrent amplificationTIP122 (Darlington pair)
Base ResistorCurrent limiting1KΩ
Freewheeling DiodeBack EMF protection1N4007
DC MotorLoad device12V DC Motor

Operation Principle:

  • Motor ON: Port pin HIGH → Transistor saturated → Motor ચાલે છે
  • Motor OFF: Port pin LOW → Transistor cut-off → Motor અટકે છે
  • Speed Control: PWM technique motor ને average power બદલે છે
  • Protection: Diode transistor ને back EMF થી બચાવે છે

મેમરી ટ્રીક: “Transistor Resistor Diode Motor”

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

8051 microcontroller સાથે LCD ઇન્ટરફેસ કરો અને “Hello” display કરવાનો પ્રોગ્રામ લખો.

જવાબ:

PPPPPo2222r....t012380251DDDD456716x2LCDDiVVVRERsCD0SN/pCDWlay(((+GCG5NoPPNVDn33D))t..)r01astAdj)

સંપૂર્ણ LCD Interface Program:

ORG 0000H
LJMP MAIN

ORG 0030H
MAIN:
    CALL LCD_INIT       ; LCD initialize કરો
    MOV DPTR, #MESSAGE  ; Message string તરફ point કરો
    CALL DISPLAY_STRING ; Message display કરો
    SJMP $              ; Execution અટકાવો

LCD_INIT:
    CALL DELAY_15MS     ; Power on પછી 15ms રાહ જુઓ
    MOV A, #38H         ; Function set: 8-bit mode, 2 lines, 5x7 matrix
    CALL COMMAND_WRITE
    MOV A, #0EH         ; Display on, cursor on, blink off
    CALL COMMAND_WRITE
    MOV A, #01H         ; Display clear કરો
    CALL COMMAND_WRITE
    MOV A, #06H         ; Entry mode: cursor increment, no shift
    CALL COMMAND_WRITE
    RET

COMMAND_WRITE:
    MOV P2, A           ; Data lines (D4-D7) પર command મોકલો
    CLR P3.0            ; Command માટે RS = 0
    SETB P3.1           ; Enable pulse high
    CALL DELAY_1MS
    CLR P3.1            ; Enable pulse low
    CALL DELAY_1MS
    RET

DATA_WRITE:
    MOV P2, A           ; Data lines (D4-D7) પર data મોકલો
    SETB P3.0           ; Data માટે RS = 1
    SETB P3.1           ; Enable pulse high
    CALL DELAY_1MS
    CLR P3.1            ; Enable pulse low
    CALL DELAY_1MS
    RET

DISPLAY_STRING:
    CLR A
    MOVC A, @A+DPTR     ; String માંથી character મેળવો
    JZ STRING_END       ; Zero હોય તો string નો અંત
    CALL DATA_WRITE     ; Character display કરો
    INC DPTR            ; આગલા character તરફ point કરો
    SJMP DISPLAY_STRING ; અંત સુધી ચાલુ રાખો

STRING_END:
    RET

MESSAGE: DB "HELLO", 0  ; Null terminator સાથે message string

DELAY_1MS:
    MOV R0, #4          ; Outer loop counter
DEL1: 
    MOV R1, #250        ; Inner loop counter  
DEL2: 
    DJNZ R1, DEL2       ; Inner delay loop
    DJNZ R0, DEL1       ; Outer delay loop
    RET

DELAY_15MS:
    MOV R2, #15         ; 15ms delay counter
DEL15: 
    CALL DELAY_1MS      ; 1ms delay call કરો
    DJNZ R2, DEL15      ; 15 વખત repeat કરો
    RET

END

ટેબલ: LCD Control Signals

SignalPinકાર્ય
RSP3.0Register Select (0=Command, 1=Data)
ENP3.1Data latch માટે enable pulse
R/WGNDRead/Write (write માટે GND સાથે tied)
D4-D7P2.0-P2.34-bit data bus (upper nibble)

ટેબલ: મહત્વપૂર્ણ LCD Commands

CommandHex Codeકાર્ય
Function Set38H8-bit mode, 2 lines, 5x7 matrix
Display Control0EHDisplay ON, cursor ON, blink OFF
Clear Display01Hસંપૂર્ણ display clear કરો
Entry Mode06HCursor increment, no display shift

LCD Display Process:

  1. Initialization: LCD parameters configure કરો અને display clear કરો
  2. Command Mode: RS=0 સાથે commands મોકલો
  3. Data Mode: RS=1 સાથે characters મોકલો
  4. Enable Pulse: EN signal સાથે data/command latch કરો
  5. String Display: Null terminator સુધી message characters માં loop કરો

Character Display Steps:

  • Data mode માટે RS=1 set કરો
  • Data bus પર character code મૂકો
  • Enable pulse generate કરો (HIGH થી LOW)
  • LCD ને process કરવા માટે રાહ જુઓ (1ms delay)
  • આગલા character માટે repeat કરો

મેમરી ટ્રીક: “Initialize Command Data Enable Display”

સંબંધિત

સાયબર સિક્યુરિટી અને ડિજિટલ ફોરેન્સિક્સ (4361601) - ઉનાળુ 2024 સોલ્યુશન
અભ્યાસ-સામગ્રી સોલ્યુશન સાયબર-સિક્યુરિટી 4361601 2024 ઉનાળુ
પાયથોન પ્રોગ્રામિંગ (1323203) - સમર 2023 સોલ્યુશન
21 મિનિટ
અભ્યાસ-સામગ્રી સોલ્યુશન પાયથોન-પ્રોગ્રામિંગ 1323203 2023 સમર
પ્રોગ્રામિંગ ઇન C (4331105) - સમર 2023 સોલ્યુશન
અભ્યાસ-સામગ્રી સોલ્યુશન સી-પ્રોગ્રામિંગ 4331105 2023 સમર
કન્ઝ્યુમર ઇલેક્ટ્રોનિક્સ એન્ડ મેઇન્ટેનન્સ (4341107) - સમર 2023 સોલ્યુશન
19 મિનિટ
અભ્યાસ-સામગ્રી સોલ્યુશન કન્ઝ્યુમર-ઇલેક્ટ્રોનિક્સ 4341107 2023 સમર
ઑબ્જેક્ટ ઓરિએન્ટેડ પ્રોગ્રામિંગ વિથ જાવા (4341602) - સમર 2023 સોલ્યુશન
અભ્યાસ-સામગ્રી સોલ્યુશન જાવા Oop 4341602 2023 સમર
ડિજિટલ કોમ્યુનિકેશન (4341102) - સમર 2023 સોલ્યુશન
20 મિનિટ
અભ્યાસ-સામગ્રી સોલ્યુશન ડિજિટલ-કોમ્યુનિકેશન 4341102 2023 સમર