MICROPROCESSORS
100504Module 2: The 8051 Architecture
Q1a. Which among the below mentioned functions does not belong to the category of alternate functions usually performed by Port 3 (Pins 10-17)? (i) External interrupts (ii) Internal interrupts (iii) Serial ports (iv) Read/Write control signals20202m
Module 2: The 8051 Architecture
View this question on its own page →Which among the below mentioned functions does not belong to the category of alternate functions usually performed by Port 3 (Pins 10-17)?
(i) External interrupts
(ii) Internal interrupts
(iii) Serial ports
(iv) Read/Write control signalsWorked SolutionAnswer: (ii) Internal interrupts
Explanation: Port 3 (P3.0–P3.7, pins 10–17) in 8051 has alternate functions:
- P3.0 = RxD (serial input), P3.1 = TxD (serial output) → serial ports
- P3.2 = INT0, P3.3 = INT1\ → external interrupts
- P3.4 = T0, P3.5 = T1 (timer inputs)
- P3.6 = WR, P3.7 = RD\ → external memory read/write strobes
There is no alternate function for "internal interrupts" on Port 3. All other options are valid Port-3 alternate functions. Hence (ii) does not belong.
Q1a. The Program Counter (PC) in 8051 is how many bits? (i) 8-bit (ii) 16-bit (iii) 12-bit (iv) 32-bit20242m
Module 2: The 8051 Architecture
View this question on its own page →The Program Counter (PC) in 8051 is how many bits?
(i) 8-bit
(ii) 16-bit
(iii) 12-bit
(iv) 32-bitWorked SolutionAnswer: (ii) 16-bit
Explanation: The Program Counter (PC) in 8051 is a 16-bit register. It holds the address of the next instruction to be fetched. Because 8051 can address up to 64K bytes of program memory (0000H–FFFFH), PC must be 16 bits wide. It is automatically incremented after each fetch and is affected by jumps, calls, and branches.
Q1a. Which output control signal is activated after every six oscillator periods while fetching the external program memory and almost remains high during internal program execution? (i) ALE (ii) \overline{PSEN} (iii) \overline{EA} (iv) All of the above20212m
Module 2: The 8051 Architecture
View this question on its own page →Which output control signal is activated after every six oscillator periods while fetching the external program memory and almost remains high during internal program execution?
(i) ALE
(ii)
(iii)
(iv) All of the aboveWorked SolutionAnswer: (ii) \overline{PSEN}
Explanation: \overline{PSEN} (Program Store Enable) is the 8051 control output that:
- Pulses low once every 6 oscillator periods (once per machine cycle) when fetching code from external program memory.
- Stays high (inactive, because it is active-low) almost continuously when execution is from internal program memory, going low only if an external access is needed.
- ALE also pulses every 6 osc periods but is not specific to external code fetch and pulses even during internal execution (except when disabled). \overline{EA} is an input, not an output. Hence the description matches \overline{PSEN}.
Q1b. Why are the resonators not preferred for an oscillator circuit of 8051? (i) Because they do not avail for 12 MHz higher order frequencies (ii) Because they are unstable as compared to quartz crystals (iii) Because cost reduction due to its utility is almost negligible in comparison to total cost of microcontroller board (iv) All of the above20202m
Module 2: The 8051 Architecture
View this question on its own page →Why are the resonators not preferred for an oscillator circuit of 8051?
(i) Because they do not avail for 12 MHz higher order frequencies
(ii) Because they are unstable as compared to quartz crystals
(iii) Because cost reduction due to its utility is almost negligible in comparison to total cost of microcontroller board
(iv) All of the aboveWorked SolutionAnswer: (iv) All of the above
Explanation: Crystal oscillators (quartz) are preferred over ceramic resonators for 8051 because:
- Ceramic resonators are available with lower frequency accuracy and do not reliably offer 12 MHz and higher frequencies with required stability.
- Resonators are less stable over temperature and aging compared to quartz crystals, causing baud-rate and timing errors.
- The cost saving of a resonator vs crystal is negligible compared to overall MCU board cost, so there is no compelling cost advantage.
Hence all statements are true, resonators are not preferred.
Q1b. Total bit addressable area in RAM of 8051 microcontroller is ____? (i) 8 bytes (ii) 4 bytes (iii) 16 bytes (iv) 32 bytes20222m
Module 2: The 8051 Architecture
View this question on its own page →Total bit addressable area in RAM of 8051 microcontroller is ____?
(i) 8 bytes
(ii) 4 bytes
(iii) 16 bytes
(iv) 32 bytesWorked SolutionAnswer: (iii) 16 bytes
Explanation: In 8051 internal RAM (00H–7FH), the region 20H–2FH (16 bytes × 8 bits = 128 bits) is bit-addressable. Bits are addressed as 00H–7FH in bit address space. Additionally, most SFRs with addresses ending in 0H or 8H are bit-addressable, but the question asks about RAM area, which is 16 bytes. Some textbooks note 16 bytes = 128 bits.
Q1b. Which company developed the 8051 microcontroller? (i) Intel (ii) AMD (iii) IBM (iv) Motorola20252m
Module 2: The 8051 Architecture
View this question on its own page →Which company developed the 8051 microcontroller?
(i) Intel
(ii) AMD
(iii) IBM
(iv) MotorolaWorked SolutionAnswer: (i) Intel
Explanation: The 8051 microcontroller family was developed by Intel in 1980 (MCS-51). Intel's original 8051 had 4K ROM, 128 bytes RAM, 32 I/O lines, two 16-bit timers, and serial port. Later variants by Atmel, Philips/NXP, etc., are second-sourced. AMD, IBM, Motorola did not develop 8051.
Q1b. In 8051, which register is used to enable or disable interrupts? (i) IE (ii) IP (iii) TCON (iv) PCON20242m
Module 2: The 8051 Architecture
View this question on its own page →In 8051, which register is used to enable or disable interrupts?
(i) IE
(ii) IP
(iii) TCON
(iv) PCONWorked SolutionAnswer: (i) IE
Explanation: IE = Interrupt Enable register (address A8H) in 8051. Bit EA (IE.7) is the global enable; bits ES, ET1, EX1, ET0, EX0 individually enable/disable serial, Timer1, External1, Timer0, External0 interrupts. IP = Interrupt Priority, TCON controls interrupt flags and timer run, PCON is power control. So IE enables/disables interrupts.
Q1c. The Stack Pointer points to (i) Program memory (ii) Top of stack (iii) Data memory (iv) I/O port20252m
Module 2: The 8051 Architecture
View this question on its own page →The Stack Pointer points to
(i) Program memory
(ii) Top of stack
(iii) Data memory
(iv) I/O portWorked SolutionAnswer: (ii) Top of stack
Explanation: Stack Pointer (SP) is an 8-bit register (address 81H) that holds the address of the top of stack - the last pushed byte in internal RAM. On PUSH, SP increments then stores; on POP, data retrieved then SP decrements. After reset SP=07H, so stack grows from 08H upwards.
Q1d. Which port has dual functionality in 8051? (i) Port 0 (ii) Port 2 (iii) Port 1 (iv) Port 320252m
Module 2: The 8051 Architecture
View this question on its own page →Which port has dual functionality in 8051?
(i) Port 0
(ii) Port 2
(iii) Port 1
(iv) Port 3Worked SolutionAnswer: (iv) Port 3 (also Port 0 and Port 2 have dual function, but most dual is Port 3)
Explanation: All ports except Port 1 have dual functions:
- Port 0: I/O + AD0-AD7 multiplexed address/data + external memory
- Port 2: I/O + A8-A15 high address
- Port 3: I/O + alternate functions (RxD, TxD, INT0/1, T0/T1, WR, RD)
Port 1 is quasi-bidirectional I/O only. Among options, Port 3 is the classic "dual functionality" with 8 alternate functions, and in a single-choice question the expected answer is Port 3 (if multiple, Port 0 & 2 also have dual, but Port 3 is the most prominent). If forced to one: Port 3.
Q1d. The default start value of Stack Pointer after reset in 8051 is: (i) 00H (ii) 10H (iii) FFH (iv) 07H20242m
Module 2: The 8051 Architecture
View this question on its own page →The default start value of Stack Pointer after reset in 8051 is:
(i) 00H
(ii) 10H
(iii) FFH
(iv) 07HWorked SolutionAnswer: (iv) 07H
Explanation: After reset, SP = 07H in 8051. Therefore the first PUSH increments SP to 08H (first stack location, which is also the start of the user RAM above register banks 0-3). Many textbooks initialise SP to 60H to avoid overlap, but default reset value is 07H.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q1d. Which flag allows to carry out the signed as well as unsigned addition and subtraction operations? (i) CY (ii) OV (iii) AC (iv) FO20202m
Module 2: The 8051 Architecture
View this question on its own page →Which flag allows to carry out the signed as well as unsigned addition and subtraction operations?
(i) CY
(ii) OV
(iii) AC
(iv) FOWorked SolutionAnswer: (ii) OV
Explanation: OV (Overflow) flag in PSW (PSW.2) indicates signed overflow (carry into sign bit XOR carry out). To correctly detect signed addition/subtraction results, OV is examined along with CY for unsigned. CY alone handles unsigned carry/borrow. AC is auxiliary carry for BCD, FO is user flag (PSW.5). So OV allows both signed and unsigned operations to be distinguished (e.g., ADD vs ADDC with overflow check).**
Q1e. Which type of memory in 8051 is bit-addressable? (i) Entire RAM (ii) Register bank (iii) 16 bytes of internal RAM from 20H to 2FH (iv) Entire ROM20242m
Module 2: The 8051 Architecture
View this question on its own page →Which type of memory in 8051 is bit-addressable?
(i) Entire RAM
(ii) Register bank
(iii) 16 bytes of internal RAM from 20H to 2FH
(iv) Entire ROMWorked SolutionAnswer: (iii) 16 bytes of internal RAM from 20H to 2FH
Explanation: Bit-addressable RAM in 8051 is exactly 16 bytes at 20H–2FH (128 bit addresses 00H–7FH). Certain SFRs (80H, 88H, 90H ... F0H) are also bit-addressable, but the RAM bit-addressable area is 20H–2FH. Entire RAM (00H–FFH) is not bit-addressable.
Q1f. A timing diagram shows: (i) Logical output of program (ii) Voltage transitions with respect to time (iii) Machine code of instruction (iv) Bus architecture20242m
Module 2: The 8051 Architecture
View this question on its own page →A timing diagram shows:
(i) Logical output of program
(ii) Voltage transitions with respect to time
(iii) Machine code of instruction
(iv) Bus architectureWorked SolutionAnswer: (ii) Voltage transitions with respect to time
Explanation: A timing diagram plots logic levels (high/low) vs time, showing propagation delays, setup/hold times, bus cycles, clock phases, and signal transitions (e.g., ALE, PSEN, RD/WR). It does not show program logic or machine code directly.
Q1f. Which operation is performed by stack pointer during its incremental phase? (i) Push (ii) Pop (iii) Return (iv) All of the above20212m
Module 2: The 8051 Architecture
View this question on its own page →Which operation is performed by stack pointer during its incremental phase?
(i) Push
(ii) Pop
(iii) Return
(iv) All of the aboveWorked SolutionAnswer: (i) Push
Explanation: In 8051, stack grows upward. PUSH increments SP first, then stores byte: SP←SP+1; [SP]←src. POP decrements after read: dst←[SP]; SP←SP-1. So incremental phase corresponds to PUSH. RET/POP decrement SP.
Q1f. Which register usually stores the output generated by ALU in several arithmetic and logical operations? (i) Accumulator (ii) Special function register (iii) Timer register (iv) Stack pointer20202m
Module 2: The 8051 Architecture
View this question on its own page →Which register usually stores the output generated by ALU in several arithmetic and logical operations?
(i) Accumulator
(ii) Special function register
(iii) Timer register
(iv) Stack pointerWorked SolutionAnswer: (i) Accumulator
Explanation: Accumulator (ACC, A register, address E0H) is the primary working register for ALU in 8051 and 8085. Most arithmetic-logic operations take one operand from A and store result back into A. SFR, Timer, SP do not hold ALU results.
Q1f. The 8051 has how many I/O ports? (i) 1 (ii) 4 (iii) 2 (iv) 520252m
Module 2: The 8051 Architecture
View this question on its own page →The 8051 has how many I/O ports?
(i) 1
(ii) 4
(iii) 2
(iv) 5Worked SolutionAnswer: (ii) 4
Explanation: 8051 has 4 parallel 8-bit I/O ports: Port 0 (P0), Port 1 (P1), Port 2 (P2), Port 3 (P3) → 32 I/O lines total. Each can be used as input/output, with alternate functions on P0, P2, P3.
Q1f. The number of pins in 8051 microcontroller is? (i) 64 (ii) 44 (iii) 40 (iv) 10020232m
Module 2: The 8051 Architecture
View this question on its own page →The number of pins in 8051 microcontroller is?
(i) 64
(ii) 44
(iii) 40
(iv) 100Worked SolutionAnswer: (iii) 40
Explanation: Standard 8051 (DIP-40) has 40 pins: 32 I/O (P0-P3), 2 crystal (XTAL1/2), RST, EA/VPP, ALE/PROG, PSEN, VCC, VSS. Other packages (PLCC-44, TQFP-44 with 44 pins) exist, but classic 8051 is 40-pin DIP.
Q1g. What is the function of ALE signal in 8051? (i) Latches lower address byte (ii) Enables timers (iii) Selects internal memory (iv) Controls interrupt20242m
Module 2: The 8051 Architecture
View this question on its own page →What is the function of ALE signal in 8051?
(i) Latches lower address byte
(ii) Enables timers
(iii) Selects internal memory
(iv) Controls interruptWorked SolutionAnswer: (i) Latches lower address byte
Explanation: ALE = Address Latch Enable. In multiplexed mode (Port 0 = AD0-AD7), ALE pulses high to enable external latch (74LS373) to capture low-order address byte (A0-A7) at beginning of machine cycle; data then appears on same port. It does not enable timers, select internal memory, or control interrupts.
Q1g. Which version of MCS-51 requires the necessary connection of external clock source to XTAL2 in addition to the XTAL1 connectivity to ground level? (i) HMOS (ii) CHMOS (iii) CMOS (iv) All of the above20212m
Module 2: The 8051 Architecture
View this question on its own page →Which version of MCS-51 requires the necessary connection of external clock source to XTAL2 in addition to the XTAL1 connectivity to ground level?
(i) HMOS
(ii) CHMOS
(iii) CMOS
(iv) All of the aboveWorked SolutionAnswer: (i) HMOS
Explanation: HMOS version of MCS-51 (e.g., 8051 original) requires an external clock source to be connected to XTAL2 with XTAL1 grounded when driven externally. CHMOS/CMOS versions (80C51) use XTAL1 as clock input and leave XTAL2 floating. Hence HMOS is the version described.
Q1h. The Abbreviation for ALE is: (i) Address Latch Enable (ii) Address Light External (iii) Address Latch Eternal (iv) None of the above20222m
Module 2: The 8051 Architecture
View this question on its own page →The Abbreviation for ALE is:
(i) Address Latch Enable
(ii) Address Light External
(iii) Address Latch Eternal
(iv) None of the aboveWorked SolutionAnswer: (i) Address Latch Enable
Explanation: ALE stands for Address Latch Enable - the 8051 output that controls external latch for demultiplexing low address from Port 0.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q1h. The number of hardware interrupts in 8051 is? (i) 2 (ii) 3 (iii) 4 (iv) 520232m
Module 2: The 8051 Architecture
View this question on its own page →The number of hardware interrupts in 8051 is?
(i) 2
(ii) 3
(iii) 4
(iv) 5Worked SolutionAnswer: (iv) 5
Explanation: 8051 has 5 interrupt sources (interrupt vector addresses):
- INT0 (0003H) external
- Timer 0 overflow TF0 (000BH)
- INT1 (0013H) external
- Timer 1 overflow TF1 (001BH)
- Serial RI+TI (0023H)
Some derivatives add extra, but classic 8051 has 5; 2 are external hardware interrupts.
Q1h. What kind of triggering configuration of external interrupt intimate(s) the signal to stay low until the generation of subsequent interrupt? (i) Edge-triggering (ii) Level triggering (iii) Both (i) and (ii) (iv) None of the above20212m
Module 2: The 8051 Architecture
View this question on its own page →What kind of triggering configuration of external interrupt intimate(s) the signal to stay low until the generation of subsequent interrupt?
(i) Edge-triggering
(ii) Level triggering
(iii) Both (i) and (ii)
(iv) None of the aboveWorked SolutionAnswer: (ii) Level triggering
Explanation: External interrupts INT0/INT1 can be edge-triggered (IT0/IT1=1, falling edge) or level-triggered (IT0/IT1=0, low level). Level-triggered requires the signal to stay low until the interrupt is serviced and the external source releases it; otherwise repeated interrupts or missed flag clearing occur. Edge-triggered needs only a falling edge.
Q2a. Demonstrate the Special Function Registers in 8051.20247m
Module 2: The 8051 Architecture
View this question on its own page →Demonstrate the Special Function Registers in 8051.
Worked SolutionSpecial Function Registers (SFRs) in 8051
SFRs occupy internal RAM 80H–FFH (only addresses ending 0H/8H bit-addressable, total 21-26 SFRs). Key SFRs:
SFR Address Purpose ACC (A) E0H Accumulator, ALU results B F0H Multiply/divide, storage PSW D0H Flags: CY, AC, FO, RS1,RS0, OV, P SP 81H Stack Pointer DPL/DPH 82H/83H Data Pointer 16-bit for external access P0-P3 80H,90H,A0H,B0H I/O ports IE A8H Interrupt Enable (EA, ES, ET1,EX1,ET0,EX0) IP B8H Interrupt Priority TCON 88H Timer control (TF1,TR1,TF0,TR0,IE1,IT1,IE0,IT0) TMOD 89H Timer mode (GATE,C/T,M1,M0) TH0/TL0, TH1/TL1 8AH-8DH Timer counts SCON 98H Serial control (SM0,SM1,SM2,REN,TB8,RB8,TI,RI) SBUF 99H Serial buffer (TX/RX) PCON 87H Power control (SMOD, IDL, PD) Bit-addressable SFRs (marked *) allow SETB/CLR. Maps allow direct bit manipulation for control. Example: SETB TR1 starts Timer1; JNB TF0 loop etc.
Q2b. Explain the functions and programming associated to Interrupt Controller block in 8051.20247m
Module 2: The 8051 Architecture
View this question on its own page →Explain the functions and programming associated to Interrupt Controller block in 8051.
Worked SolutionInterrupt Controller in 8051 – Functions & Programming
Sources (5): INT0 (0003H), Timer0 (000BH), INT1 (0013H), Timer1 (001BH), Serial (0023H). Priority via IP register, enable via IE.
Registers:
- IE (A8H): EA (global) | - | - | ES | ET1 | EX1 | ET0 | EX0 ; set to enable.
- IP (B8H): PS | PT1 | PX1 | PT0 | PX0 – 1=high priority.
- TCON (88H): IT1,IT0 (edge/level), IE1/IE0 (flags), TF1/TF0, TR1/TR0.
Programming:
MOV IE,#10000101B ; EA=1, ES=0, ET1=1, EX1=0, ET0=1, EX0=1 -> enable INT0, T0, T1 MOV IP,#00000001B ; PX0 high priority SETB IT0 ; edge triggered INT0Working: When interrupt occurs, flag set, if enabled & priority allows, CPU finishes current instruction, pushes PC, vectors to ISR address, clears flag (TI/RI not auto-cleared), RETI pops PC and restores. Nested interrupts allowed via high priority.
Example ISR stub:
ORG 0003H ; LJMP EXT0_ISR.Q3a. Discuss the Functions associated to all I/O Port pins in 8051.20247m
Module 2: The 8051 Architecture
View this question on its own page →Discuss the Functions associated to all I/O Port pins in 8051.
Worked SolutionI/O Port Pins Functions in 8051
8051 has 4×8-bit ports (32 lines), each bidirectional with internal pull-ups except P0 open-drain for external memory.
- Port 0 (P0.0-P0.7, pins 32-39): Quasi I/O when internal memory used; Alternate: AD0-AD7 multiplexed address/data bus for external program/data memory. Needs external pull-ups when used as I/O.
- Port 1 (P1.0-P1.7, pins 1-8): Dedicated I/O only (quasi-bidirectional, pull-ups), no alternate. Often for LED, keypad, etc. Some derivatives add alternate (T2, etc.).
- Port 2 (P2.0-P2.7, pins 21-28): I/O plus A8-A15 high address byte for external memory (when P0 low byte latched). Maintains high address during data phase.
- Port 3 (P3.0-P3.7, pins 10-17): I/O plus 8 alternates: P3.0 RxD (serial in), P3.1 TxD (serial out), P3.2 INT0, P3.3 INT1, P3.4 T0, P3.5 T1, P3.6 WR, P3.7 RD. Alternate enabled via SFR bits (SCON, TCON, IE).
Each port SFR (80H,90H,A0H,B0H) latch; reading drives pin state. Writing 1 makes pin input (floating with pull-up) for reading external.
Q3a. Draw and explain the internal block diagram of the 8051 microcontroller.20257m
Module 2: The 8051 Architecture
View this question on its own page →Draw and explain the internal block diagram of the 8051 microcontroller.
Worked Solution8051 Internal Block Diagram – Description
Major blocks:
- CPU: 8-bit ALU + Accumulator + B + PSW flags + Temp registers.
- Program Memory (4KB ROM) + Data Memory (128B RAM) Harvard, separate buses. RAM: 00-1FH 4 banks, 20-2FH bit-addressable, 30-7FH general, 80-FFH SFRs.
- Instruction Register & Decoder, Timing & Control, Oscillator (XTAL1/2): 12-clock machine cycle, generates ALE, \overline{PSEN}, RD, WR.
- Interrupt Controller: 5 sources as before → priority encoder.
- Timer/Counter 0 &1: 16-bit, TMOD/TCON/TH/TL.
- Serial Port: UART with SCON/SBUF, baud via Timer1.
- I/O Ports P0-P3: latches + drivers + pin logic.
- Special Function Registers, DPTR (16-bit), PC (16), SP (8), buses: internal 8-bit data, 16-bit address via P0/P2.
Data flow: Oscillator drives control → fetches via PC→ROM→IR→decode → ALU/SFR/port/timer ops → ports/timers/serial run in parallel. Program and data fetch can overlap via separate buses. Textual diagram sufficient; enumerate connections: ALE→latch, PSEN→ROM, RD/WR→RAM/peripherals.
Sketch: Center CPU, top program ROM via bus, bottom RAM+SFRs, left ports, right oscillator+interrupt+timer+serial.
Q3b. Describe the role of Program Counter and timing circuits in 8051.20257m
Module 2: The 8051 Architecture
View this question on its own page →Describe the role of Program Counter and timing circuits in 8051.
Worked SolutionRole of Program Counter (PC) and Timing Circuits in 8051
PC (16-bit): Holds address of next instruction byte to fetch. After reset 0000H. Auto-increments per fetch, loaded by jumps/calls/interrupts/RET. Enables sequential execution and branching; width allows 64K program space.
Timing Circuits: Internal oscillator (XTAL1/2 + crystal, 2 inverters) generates clock, divided by 12 to produce machine cycle (6 states S1-S6 ×2 phases). Generates ALE (latching), \overline{PSEN} (fetch), RD/WR, and TIMER clock (Fosc/12). Provides state timing (T-states) for fetch-decode-execute, baud generation, timer increments. Also handles reset timing, power-on delay, and idle/power-down modes via PCON. Without precise timing, instruction sequencing, bus multiplexing, and serial communication fail.
Q4a. How many 16-bit registers are available in 8051? Explain their functions.20217m
Module 2: The 8051 Architecture
View this question on its own page →How many 16-bit registers are available in 8051? Explain their functions.
Worked Solution16-bit Registers in 8051
8051 has two main 16-bit registers: DPTR (Data Pointer) and PC (Program Counter). SP is 8-bit but points to 8-bit addresses. Some count also Timer0/1 (THx:TLx) as 16-bit counters.
- DPTR (DPL 82H + DPH 83H): 16-bit pointer for external data/code access (
MOVX A,@DPTR,MOVC A,@A+DPTR). Can be incremented (INC DPTR) and used as two 8-bit registers. - PC (16-bit): Holds next fetch address, invisible to direct move but affected by LJMP, etc.
- Timer0 & Timer1: Each 16-bit (TH0:TL0, TH1:TL1) for timing/counting, baud generation.
If counting broadly, 4×16-bit including timers.
Functions: Addressing 64K external memory, sequencing code, timing, stack is 8-bit but extended via DPTR manipulation.
- DPTR (DPL 82H + DPH 83H): 16-bit pointer for external data/code access (
Q4a. Explain the oscillator circuit and timing of the 8051 microcontrollers.20247m
Module 2: The 8051 Architecture
View this question on its own page →Explain the oscillator circuit and timing of the 8051 microcontrollers.
Worked SolutionOscillator Circuit & Timing in 8051
Oscillator: Crystal between XTAL1 (19) and XTAL2 (18) with 33pF caps to GND, plus internal inverter amplifier. Typically 11.0592 MHz (baud friendly) or 12 MHz (1µs cycle). Generates clock divided by 12 → machine cycle. Can also inject external clock to XTAL1 with XTAL2 floating (CMOS) or XTAL2 for HMOS.
Timing: One machine cycle = 12 oscillator periods = 6 states S1-S6 ×2 phases P1/P2. Most instructions 1-4 machine cycles: e.g., MOV A,Rn 1 cycle (1.085µs @11.0592M), MUL AB 4 cycles. ALE pulses at 1/6 Fosc, \overline{PSEN} active low during external fetch. Timer increments each machine cycle. Baud = (2^SMOD/32)*(Fosc/12/(256-TH1)). Reset requires 2 machine cycles high on RST.
Q4a. Explain the Special Function Registers used in 8051.20257m
Module 2: The 8051 Architecture
View this question on its own page →Explain the Special Function Registers used in 8051.
Worked SolutionSFRs Used in 8051 (Detailed as Q117)
List with addresses and function:
ACC E0H, B F0H, PSW D0H (CY,AC,F0,RS1,RS0,OV,P), SP 81H, DPL 82H, DPH 83H, P0 80H, P1 90H, P2 A0H, P3 B0H, IE A8H (EA, ES, ET1, EX1, ET0, EX0), IP B8H, TCON 88H, TMOD 89H, TL0 8AH, TL1 8BH, TH0 8CH, TH1 8DH, SCON 98H, SBUF 99H, PCON 87H.Bit-addressable SFRs end with 0/8H. Usage: SETB TR1, JB TF0, MOV A,P0 etc. Controls all peripherals.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q4b. Explain the various external interrupt signals in 8051.20207m
Module 2: The 8051 Architecture
View this question on its own page →Explain the various external interrupt signals in 8051.
Worked SolutionExternal Interrupt Signals in 8051
- \overline{INT0} (P3.2) & \overline{INT1} (P3.3): Active-low inputs. Trigger mode selectable via IT0/IT1 in TCON: ITx=0 level-triggered (low holds interrupt), ITx=1 edge-triggered (falling edge). Flags IE0/IE1 set; auto-cleared for edge after ISR.
- Vector addresses: INT0=0003H, INT1=0013H.
- Enable: EX0/EX1 in IE, global EA.
- Priority: PX0/PX1 in IP.
- Usage: Connect external device with pull-up, drive low pulse >1 machine cycle for edge; hold low until serviced for level.
Also serial and timer interrupts are internal but often listed.
Q5. Illustrate the pin diagram of 8051 with the help of a suitable diagram and explain the utility of the pins available in 8051.202414m
Module 2: The 8051 Architecture
View this question on its own page →Illustrate the pin diagram of 8051 with the help of a suitable diagram and explain the utility of the pins available in 8051.
Worked SolutionPin Diagram of 8051 – Utility
DIP-40: Pin 40 VCC (+5V), 20 GND, 18-19 XTAL2/XTAL1 (crystal), 9 RST (reset), 29 \overline{PSEN} (ext program enable), 30 ALE/\overline{PROG}, 31 \overline{EA}/VPP, 10-17 P3.0-7, 1-8 P1.0-7, 21-28 P2.0-7, 32-39 P0.0-7.
Utility:
- P0: AD0-7 multiplexed, needs latch.
- P2: A8-15.
- P3 alternates: RxD/TxD/INT0/INT1/T0/T1/WR/RD.
- Control: ALE latches address, PSEN reads ext ROM, EA selects int/ext program, RST reset high.
- Power/clock: VCC, GND, XTAL for oscillator.
Diagram description: rectangle with pins labelled clockwise; textual suffices.
Operation: With \overline{EA}=1 internal ROM used up to 4K then external; \overline{EA}=0 all external.
Q5a. Describe the memory organization in 8051 microcontroller.20237m
Module 2: The 8051 Architecture
View this question on its own page →Describe the memory organization in 8051 microcontroller.
Worked SolutionMemory Organization in 8051
Separate Harvard spaces: Program (64K, \overline{PSEN}) and Data (64K, \overline{RD}/\overline{WR}), plus Internal Data.
Internal Data (256B):
- 00H-1FH: 4 register banks (R0-R7) selectable by RS1,RS0 in PSW.
- 20H-2FH: 16 bytes bit-addressable (128 bits).
- 30H-7FH: General purpose RAM.
- 80H-FFH: SFRs (only direct addressing; 80H,88H...F0H bit-addressable).
External: Up to 64K program ROM (via \overline{PSEN}+ALE latch) and 64K data RAM (MOVX). \overline{EA}=0 forces external program from 0000H; =1 uses internal 0000-0FFFH then external beyond.
Access: MOV for internal direct/indirect, MOVX for external data, MOVC for program table.
Q5b. Explain the functions of SP and PC registers in 8051 microcontroller.20237m
Module 2: The 8051 Architecture
View this question on its own page →Explain the functions of SP and PC registers in 8051 microcontroller.
Worked SolutionFunctions of SP and PC
Stack Pointer (SP, 81H, 8-bit): Points to top of stack in internal RAM. PUSH increments then writes, POP reads then decrements. SP=07H after reset → first push to 08H. Manages calls, interrupts, context save. Can relocate: MOV SP,#60H.
Program Counter (PC, 16-bit): Holds address of next instruction byte. Automatically increments on fetch; loaded by LJMP/AJMP/SJMP/CALL/RET/interrupt vectoring. Determines execution flow. Invisible directly but accessed via
MOVC,PUSH PCvia CALL.Together they control sequence (PC) and LIFO storage (SP) for subroutines/interrupts.
Q6a. List the special function register associated with (i) Interrupts (ii) I/O ports (iii) Timers/Counters20217m
Module 2: The 8051 Architecture
View this question on its own page →List the special function register associated with
(i) Interrupts
(ii) I/O ports
(iii) Timers/CountersWorked SolutionSFRs for Interrupts, I/O, Timers
- Interrupts: IE A8H (enable: EA,ES,ET1,EX1,ET0,EX0), IP B8H (priority: PS,PT1,PX1,PT0,PX0), TCON 88H (flags IE1/IE0, IT1/IT0, TF1/TR1,TF0/TR0), SCON 98H (TI/RI for serial interrupt).
- I/O Ports: P0 80H, P1 90H, P2 A0H, P3 B0H – latches + alternate control via SCON/TCON.
- Timers/Counters: TMOD 89H (mode/GATE/C/T/M1M0 for both), TCON 88H (TF/TR/IE/IT), TH0/TL0 8CH/8AH, TH1/TL1 8DH/8BH, PCON 87H (T2 extra in 8052: T2CON etc.).
Set via MOV IE,#... ; MOV TMOD,#... ; MOV P1,#... etc.
Q6a. What do you mean by general purpose registers? Explain the various flags and status register in 8051.20227m
Module 2: The 8051 Architecture
View this question on its own page →What do you mean by general purpose registers? Explain the various flags and status register in 8051.
Worked SolutionGeneral Purpose Registers & Flags/PSW in 8051
GPRs: Registers R0-R7 in 4 banks (00-07H,08-0FH,10-17H,18-1FH) selectable by RS1,RS0 (PSW.4-3). Plus Accumulator A, B, DPTR.
PSW (D0H) flags: CY (PSW.7) carry/borrow, AC (PSW.6) auxiliary carry for BCD, FO (PSW.5) user flag, RS1/RS0 (bank select), OV (PSW.2) signed overflow, P (PSW.0) parity (1 if odd parity in A).
SFRs: 21 SFRs as Q117. Categories: Ports, Timer (TMOD/TCON/THx/TLx), Serial (SCON/SBUF), Interrupt (IE/IP), Power (PCON), Control (PSW,SP,DPTR,ACC,B). Status register = PSW + SFRs.
Q6a. Explain the oscillator circuit and timing of the 8051 microcontroller.20206m
Module 2: The 8051 Architecture
View this question on its own page →Explain the oscillator circuit and timing of the 8051 microcontroller.
Worked SolutionOscillator Circuit & Timing – see Q121
Crystal between XTAL1/2 with internal inverter, 30pF caps. Generates Fosc, divided by 12 for machine cycle (6 states ×2). ALE 1/6 Fosc, PSEN, timers, baud derived. 12MHz →1µs MC; 11.0592MHz →1.085µs ideal for baud. Reset needs 2 cycles high.
Q6b. Explain the functions of the following pins: (i) ALE (ii) \overline{PSEN} (iii) \overline{EA} (iv) RST20208m
Module 2: The 8051 Architecture
View this question on its own page →Explain the functions of the following pins:
(i) ALE
(ii)
(iii)
(iv) RSTWorked SolutionFunctions of ALE, \overline{PSEN}, \overline{EA}, RST
- ALE (30): Address Latch Enable – active-high pulse at 1/6 Fosc to latch low address A0-A7 from P0 into external latch (74LS373). Demultiplexes address/data. Also used as \overline{PROG} for Flash programming.
- \overline{PSEN} (29): Program Store Enable – active-low output, reads external program memory (ROM) when CPU fetches outside internal. Connects to OE of external EPROM/Flash. Inactive high when executing internal.
- \overline{EA}/VPP (31): External Access – input. EA=1 → fetch internal first (0000-0FFFH) then external after; EA=0 → all fetches external, 0H vectors external. Also VPP 21V for EPROM programming.
- RST (9): Reset – active-high input, hold >2 machine cycles (>1µs) to reset PC=0000H, SP=07H, ports high, etc. Needs RC (10µF+8.2k) power-on.
Q6b. Explain the internal memory organization of the microcontroller 8051.20247m
Module 2: The 8051 Architecture
View this question on its own page →Explain the internal memory organization of the microcontroller 8051.
Worked SolutionInternal Memory Organization – see Q96
128B RAM: 00-1FH 4 banks, 20-2FH bit-addressable 16B, 30-7FH general, 80-FFH SFRs. 4KB ROM 0000-0FFFH internal program, beyond external via PSEN. Harvard separate data 64K via MOVX.
Q6b. Explain the concept of memory banks and further comment on the structure of the internal RAM of 8051.20217m
Module 2: The 8051 Architecture
View this question on its own page →Explain the concept of memory banks and further comment on the structure of the internal RAM of 8051.
Worked SolutionMemory Banks & Internal RAM Structure (8051)
Register Banks: 4 banks × 8 registers R0-R7 mapped 00-1FH: Bank0 00-07H, Bank1 08-0FH, Bank2 10-17H, Bank3 18-1FH. Selected by RS1 RS0 (PSW.4-3). Fast context switch for interrupts without PUSH.
Internal RAM 128B (00-7FH) or 256B (8052 00-FFH):
- 00-1FH banks (32B)
- 20-2FH bit-addressable 16B (128 bits, bit addr 00-7FH) for flags/semaphores.
- 30-7FH general scratch.
- 80-FFH SFRs (separate space, direct address only). In 8052, 80-FFH upper RAM accessible via indirect (@R0) vs SFR via direct.
Stack typically relocated to 30H+ to avoid bank collision; SP=07H default shares with bank1.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q7a. Explain the alternate functions of port 0, port 2 and port 3.20206m
Module 2: The 8051 Architecture
View this question on its own page →Explain the alternate functions of port 0, port 2 and port 3.
Worked SolutionAlternate Functions of Port 0, Port 2, Port 3
- Port 0 (AD0-AD7): Normal quasi-I/O with pull-ups, but when external memory accessed, becomes multiplexed low address/data bus latched by ALE. Open-drain, needs external pull-up for input.
- Port 2 (A8-A15): Quasi I/O; alternately high address byte for external memory (stable during data phase). Does not need latch.
- Port 3 (8 alternates as Q1): P3.0 RxD, P3.1 TxD, P3.2 INT0, P3.3 INT1, P3.4 T0, P3.5 T1, P3.6 WR\ (data write strobe), P3.7 RD\ (data read). Selected when corresponding SFR bit enables function; else acts as I/O.
Q7b. Explain how bit addressing is distinguished from byte addressing in the 8051 microcontroller.20208m
Module 2: The 8051 Architecture
View this question on its own page →Explain how bit addressing is distinguished from byte addressing in the 8051 microcontroller.
Worked SolutionBit vs Byte Addressing in 8051
- Byte addressing: Access entire 8-bit byte via direct or indirect address (00-7FH RAM, 80-FFH SFRs, etc.) e.g.,
MOV A,30Hloads 8 bits; address granularity is byte. - Bit addressing: Access single bit individually via bit address. 8051 has 211 bit addresses: 128 in RAM 20H-2FH (bits 00H-7FH where bit address = byte_address_offset×8 + bit) and 87 in SFRs ending 0/8H (e.g., PSW.7=CY, P1.0). Instructions:
SETB bit,CLR bit,MOV C,bit,JB bit,rel. Bit address distinguishes via 8-bit bit address encoding vs byte direct. ExampleSETB 00Hsets RAM 20H.0,SETB P1.0vsMOV P1,#01Hbyte.
- Byte addressing: Access entire 8-bit byte via direct or indirect address (00-7FH RAM, 80-FFH SFRs, etc.) e.g.,
Q7b. Explain the PSW flags and SFR's (Special function registers) of 8051 microcontroller and also write the type of SFR's.20227m
Module 2: The 8051 Architecture
View this question on its own page →Explain the PSW flags and SFR's (Special function registers) of 8051 microcontroller and also write the type of SFR's.
Worked SolutionPSW Flags & SFR Types
PSW flags (D0H, bit-addressable): CY (7) carry, AC (6) aux carry, F0(5) user, RS1(4) RS0(3) bank select, OV(2) overflow, - (1) reserved, P(0) parity. Flags updated by arithmetic/logic: ADD affects CY,AC,OV,P etc.
SFR Types:
- Port SFRs: P0,P1,P2,P3
- Timer SFRs: TMOD,TCON,TH0,TL0,TH1,TL1
- Serial SFRs: SCON,SBUF,PCON
- Interrupt SFRs: IE,IP
- Control SFRs: PSW,SP,ACC,B,DPL,DPH
- Power/Misc: PCON
21 core SFRs in 80-FFH, accessed by direct addressing only, 11 bit-addressable. Control whole MCU.
Q7b. What is the difference between over-flow and carry flag? Explain with an example.20217m
Module 2: The 8051 Architecture
View this question on its own page →What is the difference between over-flow and carry flag? Explain with an example.
Worked SolutionCarry (CY) vs Overflow (OV) – Difference with Example
- CY (PSW.7): Unsigned overflow – carry out of bit7. 1 if result exceeds 255 (addition) or borrow in subtraction. For unsigned numbers.
- OV (PSW.2): Signed overflow – carry into sign bit XOR carry out. 1 if signed result exceeds -128..127. For signed 2's complement.
Example:
MOV A,#0FFH; ADD A,#01H→ A=00H, CY=1 (unsigned overflow 255+1), AC=1, OV=0 (signed -1+1=0 no overflow). CY indicates unsigned wrap.MOV A,#7FH; ADD A,#01H→ A=80H, CY=0 (no unsigned overflow), OV=1 (signed 127+1 = -128 overflow). This shows signed overflow without carry.
Check: OV = CY6 XOR CY7.
Q8a. Explain the special function registers associated with the I/O Ports. How to configure an I/O port as an input pin?20237m
Module 2: The 8051 Architecture
View this question on its own page →Explain the special function registers associated with the I/O Ports. How to configure an I/O port as an input pin?
Worked SolutionSFRs Associated with I/O Ports & Input Configuration
- Port Latches: P0 (80H), P1 (90H), P2 (A0H), P3 (B0H) – each bit latch + driver with pull-up (P0 open-drain).
Input Configuration: 8051 ports are quasi-bidirectional. To configure pin as input:
- Write 1 to latch:
MOV P1,#0FFHorSETB P1.3makes FET off, pull-up holds high, external can drive low/high. - Read pin:
MOV A,P1reads pin state (not latch). If alternative function enabled, direction auto.
Example:
MOV P1,#0FFH ; P1 input MOV A,P1 ; read ANL A,#01H JNZ NOT_PRESSEDAlternative functions selected via SFR controls (SCon, TCon etc.) override I/O.
Q8b. What are the special function registers associated with the interrupt module of 8051?20237m
Module 2: The 8051 Architecture
View this question on its own page →What are the special function registers associated with the interrupt module of 8051?
Worked SolutionSFRs Associated with Interrupt Module (as Q46/118)
IE A8H (enable bits EA,ES,ET1,EX1,ET0,EX0), IP B8H (priority PS,PT1,PX1,PT0,PX0), TCON 88H (IE1/IT1,IE0/IT0,TF1/TR1,TF0/TR0), SCON 98H (TI/RI). For 8052, additional T2CON etc. Vectors at 0003H-0023H.
Q9a. Write short notes on: Interrupts20227m
Module 2: The 8051 Architecture
View this question on its own page →Write short notes on: Interrupts
Worked SolutionShort Notes: Interrupts (8051)
- Sources 5 (INT0, T0, INT1, T1, Serial), vectors 0003-0023H, priority fixed via hardware polling but overridden by IP.
- Enable via IE (EA global), request flags in TCON/SCON, trigger modes via ITx.
- Response: finish instruction →push PC→vector →ISR→RETI pops.
- Latency 3-8 cycles, nested allowed.
- Applications: external events, timing, communication.
Q9b. Write short notes on: I/O Ports20227m
Module 2: The 8051 Architecture
View this question on its own page →Write short notes on: I/O Ports
Worked SolutionShort Notes: I/O Ports – see Q119/21
4×8-bit ports P0-P3 quasi-bidirectional, P0 AD multiplexed, P2 high address, P3 alternates (RxD/TxD/INT/Timer/WR/RD), P1 pure I/O. Write 1 for input. Each port SFR latch+driver.
Q9b. Explain the address bus, data bus, and control bus in the 8051 architecture.20253.5m
Module 2: The 8051 Architecture
View this question on its own page →Explain the address bus, data bus, and control bus in the 8051 architecture.
Worked SolutionAddress, Data, Control Bus in 8051
- Address Bus (16-bit, unidirectional): A15-A8 via P2 (high) stable, A7-A0 via P0 multiplexed→latch. Selects 64K program/data.
- Data Bus (8-bit, bidirectional): D7-D0 via P0 after ALE, carries data CPU↔memory/peripherals. Shared with address time-multiplexed.
- Control Bus: ALE (latch), \overline{PSEN} (program read), \overline{RD}/\overline{WR} (P3.7/6 data read/write), \overline{EA}, RST, INTx. Generated by timing & control unit from clock. Manage direction and timing.
Q9b. Write short notes on: Stack & Stack Pointer20247m
Module 2: The 8051 Architecture
View this question on its own page →Write short notes on: Stack & Stack Pointer
Worked SolutionShort Notes: Stack & Stack Pointer
- Stack: LIFO area in internal RAM (default 08H upward), holds return addresses, register context, data via PUSH/POP.
- SP (81H): Points to top. Reset 07H. PUSH → SP++ then store; POP → load then SP--. Relocate: MOV SP,#60H to avoid overlap with register banks/bit area. Depth limited by RAM (max 128-7FH). Overflow collides SFRs.