Microprocessor Exam Answer Key 2025
Microprocessor Exam Answer Key 2025
QP Code :
THAMIRABHARANI ENGINEERING COLLEGE
(An Autonomous Institution)
B. E. DEGREE END SEMESTER THEORY EXAMINATIONS, NOV. / DEC. 2025
Fourth Semester
Electrical And Electronics Engineering
EE3404 –MICROPROCESSOR AND MICROCONTROLLER
(Common To if applicable)
(Name of the Tables/Charts) Can be Permitted (if applicable)
Regulations - 2021
Duration : 3 Hrs Maximum : 100 Marks
Accumulator (A)
Flag Register
Temporary Register
The stack stores return addresses and temporary data during subroutine calls,
3. interrupts, PUSH/POP instructions. It helps preserve program execution sequence. 2 2
A look-up table (LUT) is a memory table that stores pre-computed values used to
4. 2 2
speed up calculations such as ASCII conversion, sine wave generation, code
translation, etc.
6. 3 2
Address lines
Timer3 (16-bit)
10. Port A 5 2
Port B
Port C
Port D
Port E
PART – B (ANSWER ALL QUESTIONS) (Marks 5*13 = 65)
[Link]. Questions BLT CO Marks
Block diagram explanation points:
ALU
Register array (A, B, C, D, E, H, L)
Address/Data bus
Interrupt control
11. a i 1
Or
b i Explain control signals: 1
ALE
RD̅
WR̅
IO/M̅
5. Implicit → CMA
Example
MVI A, 55H
Operation
Example
MOV A, B
Meaning: Copy the contents of register B into register A.
Operation
Example
LDA 2050H
Operation
Used when:
Example
LDAX B
Operation
Used for:
Array access
String operations
Pointer operations
Another example:
MOV A, M
Example
CMA
Internal Operation
ACC = NOT(ACC)
No operand required
Accumulator is implied
Other examples:
Here:
Example
MVI M, 25H
Internal operation:
3. Extract the high nibble (bits 7–4), move it to low nibble position
(bits 3–0). Convert that 4-bit value (0–15) into ASCII:
4. Extract the low nibble (bits 3–0) directly from val and convert
similarly.
Assumptions:
Input byte is stored at memory location 3000H.
Resulting ASCII bytes will be stored at 3001H (high digit) and
3002H (low digit).
Program
ORG 0000H
HLT
13. a i 3
8255 – Programmable Peripheral
Interface
The Intel 8255 PPI is a General-Purpose Programmable I/O device.
It provides 24 I/O lines arranged as three 8-bit ports:
Port A (PA0–PA7)
Port B (PB0–PB7)
Keyboards
Displays
ADC/DAC
Stepper motors
Printers
Relays
┌───────────────────────────┐
│ 8255 PPI │
│ │
│ ┌───────────────┐ │
PA7–PA0 ────►│ PORT A (8) │◄───── │
│ └───────────────┘ │
│ │
│ ┌───────────────┐ │
PB7–PB0 ────►│ PORT B (8) │◄───── │
│ └───────────────┘ │
│ │
│ ┌───────────────┐ │
PC7–PC0 ────►│ PORT C (8) │◄───── │
│ └───────────────┘ │
│ │
│ ┌────────────────────┐ │
DATA BUS ◄──►│ DATA BUS BUFFER │──│── CPU
│ └────────────────────┘ │
│ │
│ ┌────────────────────┐ │
A1,A0 ────►│ READ/WRITE LOGIC │ │
RD, WR, │ Chip Select, Reset │ │
CS, RESET │ │ │
│ └────────────────────┘ │
│ │
│ ┌────────────────────┐ │
│ │ CONTROL LOGIC │◄─┤─ CONTROL
WORD
│ └────────────────────┘ │
│ │
└───────────────────────────┘
Transfers data:
Signal Function
RD̅ Read data from selected port
WR̅ Write data into selected port
CS̅ Chip select (enable device)
A1–A0 Select port/register
✅ 3. Group Selection
Group A controls:
o Port A (PA0–PA7)
Group B controls:
o Port B (PB0–PB7)
✅ 4. Control Register
Mode of operation
Direction (input/output)
Handshaking pins
CPU
│
Port A → Output
Port B → Input
Port C → Individual bits
Characteristics
✔ No control signals
✔ Fastest mode
✔ Can configure each port separately
Used for:
Keyboard input
Printers
ADC/DAC
ACK (Acknowledge)
✅ MODE 2 (Bi-directional Data Transfer)
Only for Port A
True bidirectional communication
Used for:
Data buses
Multiprocessor communication
DMA-type transfers
Used to control:
o Individual relays
o LEDs
o Control lines
Group Summary
Group Ports Mode Supported
Group A Port A + PC upper Mode 0,1,2
Group B Port B + PC lower Mode 0,1
Applications of 8255
Interface keyboards
Control stepper motors
Drive LEDs
Sensor interfacing
Industrial automation
Final Summary
The 8255 PPI:
Or
b i 3
8279 – Keyboard/Display Controller
(Detailed Explanation)
The Intel 8279 is a programmable controller used to interface:
┌───────────────────────────┐
│ 8279 IC │
│ │
CLK ───────►│ Clock & Timing │
│ │
SL0–SL3 ───────► │ Scan Generator │
│ │
RL0–RL7 ◄─────── │ Return Lines │
│ │
│ ┌───────────────────┐ │
│ │ Keyboard Debounce │ │
│ │ & FIFO Buffer │ │
│ └───────────────────┘ │
│ │ │
│ IRQ◄──────────────│ CPU
│ │
DISP0–DISP3 ◄────── │ Display Addressing │
│ │
OUTA–OUTD ────────►│ Display Driver │
│ │
│ ┌───────────────────┐ │
│ │ Control Logic │ │
DB0–DB7 ◄────────► │ │ Data/Status │ │
│ └───────────────────┘ │
│ │
RD, WR, CS, A0 ──────►│ CPU Interface │
└───────────────────────────┘
🔷 1. Keyboard Interface
🔷 3. Display Interface
Drives 6 or 8 displays.
Displays automatically refreshed — no CPU burden.
🔷 4. Scan Generator
o Display digits
Frequency is programmable.
Modes:
Switches
Contact closures
Mechanical sensors
Display Formats
✅ Decoded Scan
7-segment decoding internal to 8279
Saves CPU work
✅ Encoded Scan
Sample format:
D7 D6 D5 D4 D3 D2 D1 D0
│ │ │ │ │ │ │ └── Operation bit
│ │ │ │ │ │ └──── Keyboard mode
│ │ │ │ │ └────── Display mode
│ │ │ │ └────────── Entry mode
│ │ │ └───────────── Scan mode
│ │ └─────────────── Clock divisor
│ └────────────────── Reset FIFO
└──────────────────── Global enable
Status Word
Includes:
Time-out
8 bytes deep
Keypress stored in sequence
o Key available
o FIFO full
Key Debounce Logic
Mechanical keys produce noise like:
New keypressed
FIFO overflow
Sensor change
┌───────┐
│ 8279 │
SL0–SL3 ───►│ │◄── RL0–RL7
│ │
OUTA–OUTD──►│ │──► Display segments
└───────┘
│
CPU Bus
Applications
8279 widely used in:
Digital calculators
Control panels
Industrial meters
ATMs
CNC machines
Conclusion
The Intel 8279 reduces CPU load by:
✔ handling key debouncing
✔ performing display refresh
✔ generating scanning patterns
✔ buffering keys
Location: A8H
┌─────────────────────────────────────────────┐
| EA | — | ET2 | ES | ET1 | EX1 | ET0 | EX0 |
└─────────────────────────────────────────────┘
MSB LSB
Bit Meaning
EA Global Enable (1 = interrupts allowed)
ET0 Enable Timer0 interrupt
EX0 Enable External0 interrupt
ET1 Enable Timer1 interrupt
EX1 Enable External1 interrupt
ES Enable Serial interrupt
Location: B8H
┌─────────────────────────────────────────────┐
| — | — | PT2 | PS | PT1 | PX1 | PT0 | PX0 |
└─────────────────────────────────────────────┘
Two-Level Priority
8051 supports:
1. Finish instruction
2. Push PC on stack
3. Jump to ISR
Structure:
✅ Level triggered
✅ Edge triggered
Address: 88H
┌─────────────────────────────────────────────┐
| TF1 | TR1 | TF0 | TR0 | IE1 | IT1 | IE0 | IT0 |
└─────────────────────────────────────────────┘
Bits:
Bit Meaning
IT1 External 1 edge/level mode
IE1 External 1 interrupt flag
IT0 External 0 edge/level mode
IE0 External 0 interrupt flag
Interrupt Nesting
Triggered by:
✔ 5 vectored interrupts
✔ Simultaneous enabling/disabling
✔ Priority levels
✔ Edge/Level triggering
✔ Automatic PC save/restore
✔ Supports nesting
Advantages of Interrupts
Conclusion
For a unipolar stepper motor, the coil center tap is connected to +V,
and the ends are driven by the microcontroller through a driver.
Because:
So we use:
┌─────────┐
│ 8051 │
│ │
P2.0 ─────│ │
P2.1 ─────│ I/O │
P2.2 ─────│ Port │───► Driver ───► Stepper
P2.3 ─────│ │ (ULN2003)
│ │ ↑
└─────────┘ │
│ +12V
Circuit Diagram
+12V
│
.│.
.│. Center Tap
│
┌────────┴────────┐
│ │
Coil A Coil B
| |
Q1 Q2
| |
P2.0 ────────► ULN2003 |
(driver)
| |
Coil C Coil D
│ │
Q3 Q4
│ │
P2.2 P2.3
Or simply label:
P2.0 → coil A
P2.1 → coil B
P2.2 → coil C
P2.3 → coil D
Step A B C D
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
Waveform to draw:
A: ─█───┬──────┬───────
B: ────█───┬────┬──────
C: ───────█───┬──┬─────
D: ─────────█──┬──┬────
Step A B C D
1 1 1 0 0
2 0 1 1 0
3 0 0 1 1
4 1 0 0 1
Operation Principle
Energizing coil A attracts rotor tooth → moves one step
Energizing coil B moves again, etc.
o Forward: A→B→C→D
o Reverse: D→C→B→A
Precise positioning
No feedback required
Excellent repeatability
;-----------------------
DELAY: MOV R2, #20H
D1: MOV R1, #FFH
D2: DJNZ R1, D2
DJNZ R2, D1
RET
END
Typical values:
1.8°
7.5°
15°
Robotics
CNC machines
Disk Drives
Antenna positioning
XY Plotters
Textile machines
ii 4
15. a i 5
PIC18 Series Microcontroller –
Functional Block Diagram
The PIC18 family (e.g., PIC18F452/4550) is an advanced 8-bit RISC
microcontroller designed by Microchip Technology.
It supports high-performance, low-power, and rich on-chip peripherals.
┌───────────────────────┐
│ CPU (ALU) │
│ Accumulator | WREG │
└─────────┬─────────────┘
│
┌─────────▼───────────┐
│ Instruction │
│ Decoder │
└─────────┬───────────┘
│
┌───────────────┐ │
┌─────────────────┐
│ Program Memory│◄───────┘ │ Data Memory
│
│ (Flash ROM) │ │ (RAM + SFR)
│
└──────┬────────┘
└─────────────────┘
│
┌─────────▼───────────┐
│ Stack (31 Levels) │
│ Return Address │
└─────────┬────────────┘
│
┌──────────────▼───────────────┐
│ Timers (T0,T1,T2) │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Capture/Compare/PWM (CCP) │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ A/D Converter (ADC) │
└──────────────┬───────────────┘
│
┌──────────────▼──────────────┐
│ USART (Serial UART) │
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ I2C / SPI (MSSP Module) │
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ Interrupt Controller │
└──────────────┬──────────────┘
│
┌──────▼───────┐
│ I/O Ports │
│ (PORTA–PORTE) │
└──────┬────────┘
│
External Pins
Consists of:
ALU
Instruction register
Typically 8 KB – 128 KB
✅ 3. Data Memory (RAM)
Includes:
✅ 4. Stack (31-level)
Used for:
Interrupt nesting
Hardware controlled.
✅ 5. Oscillator Module
Provides system clock.
Supports:
Internal RC oscillator
External crystal
✅ 6. Timer Modules
PIC18 usually has:
Timer0: 8/16-bit
Timer1: 16-bit
Used for:
✅ Time delays
✅ Event counting
✅ Frequency measurement
✅ 7. Capture/Compare/PWM (CCP)
Capture mode
Captures timer value on external event
Compare mode
PWM mode
10-bit resolution
Full-duplex
Used for:
PC communication
GSM/GPS modules
I2C
SPI
EEPROMs
RTC
Displays
Sensors
Multiple vectors
Priority levels (High/Low)
Sources:
External interrupts
UART interrupt
Timer interrupt
ADC interrupt
Pins are:
Bidirectional
TTL level
I/O ports
Interrupt pins
ADC inputs
Serial TX/RX
Power Features
PIC18 supports:
Idle mode
Sleep mode
Low-power oscillator
Examples:
SFR Purpose
TRISx Port direction
PORTx I/O data
INTCON Interrupt control
TMRx Timer registers
ADCON ADC control
Advantages of PIC18
Applications
Medical devices
Smart meters
Robotics
Communication devices
Or
b i 5
I/O Port Structure of PIC18
Microcontroller
PIC18 microcontrollers support up to 5 bidirectional I/O ports:
PORTA
PORTB
PORTC
PORTD
PORTE
Important points:
Registers used
PORTx Register
LATx Register
TRISx Register
Direction control
Read-Modify-Write Issue
Example:
UART TX/RX
CCP1/CCP2 PWM output
SPI SCK/SDI/SDO
PORTA Features
Supports:
Vref pins
ADCON0
ADCON1
ADCON2
CMCON (Comparator)
while(1)
{
LATBbits.LATB0 = 1; // LED ON
__delay_ms(500);
LATBbits.LATB0 = 0; // LED OFF
__delay_ms(500);
}
while(1)
{
if(PORTAbits.RA0 == 1)
LATBbits.LATB0 = 1;
else
LATBbits.LATB0 = 0;
}
TTL compatible
Schmitt trigger
Ensures:
Noise immunity
Stable logic levels
Weak Pull-ups
~25 mA each
Keypad interfaces
LED/7-segment displays
System Concept
Port Initialization
Working Principle
5. Increment count.
6. Repeat.
;----------------------------------
DELAY: MVI D, FFH
D1: MVI E, FFH
D2: DCR E
JNZ D2
DCR D
JNZ D1
RET
;----------------------------------
Explanation of Code
✅ MVI A,00H
✅ OUT 02H
✅ MVI C,10H
Delay Routine
LED output:
Port Address
Port-A 00H
Port-B 01H
Port-C 02H
Control 03H
It demonstrates:
Timing control
Applications
Advantages
Precautions
Conclusion
Or
b i
Interfacing of DAC with 8051 /
8085 to Generate Analog Waveform
Digital-to-Analog Converter (DAC) is an important peripheral that
converts digital (binary) data from the microprocessor / microcontroller
into corresponding analog voltage or current.
Basic Principle
Where:
D → digital value
n → number of bits (DAC0808 → 8-bit)
Why Latch?
Output Stage
Vout = - Iout × Rf
Rf typically = 10 kΩ
Port Address
Port-A 00H
Control 03H
Waveform Generation
✅ Ramp Waveform
/ / / /
/ / / /
/ / / /
✅ Triangular Wave
✅ Staircase Wave
Working Explanation
Precautions
Applications
✅ Function generators
✅ Speech synthesis
✅ Motor speed control
✅ Robotics
✅ Signal conditioning
Conclusion
🧩 Basic Principle
DAC converts binary input into proportional analog output:
Where:
D → digital value