SRI RAMAKRISHNA ENGINEERING COLLEGE
[Educational Service: SNR Sons Charitable Trust]
[Autonomous Institution, Reaccredited by NAAC with ‘A+’ Grade]
[Approved by AICTE and Permanently Affiliated to Anna University, Chennai]
[ISO 9001:2015 Certified and all eligible programmes Accredited by NBA]
VATTAMALAIPALAYAM, N.G.G.O. COLONY POST, COIMBATORE – 641 022.
Assignment Test
Date 23.04.2025 Department II
Semester IV Class/section II - A/B
Maximum marks 20 Time 30 Minutes
Course Code & Title: 20EC223 Digital Circuits and Microcontroller Lab
Course Outcomes Addressed:
CO4: Explain the internal architecture, addressing modes and the instruction sets of 8051.
1. Explain how the square wave frequency is determined from the given 8051
assembly program using Timer 1, and calculate the resulting frequency at pin
P1.5 when the XTAL is 11.0592 MHz and the timer is loaded with the value
7634H.
1. TIMER VALUES
Program
MOV TMOD, #10H ; Select Timer 1, Mode 1 (16-bit timer mode)
AGAIN: MOV TL1, #34H ; Load low byte of timer (TL1 = 0x34)
MOV TH1, #76H ; Load high byte of timer (TH1 = 0x76 → total =
0x7634)
SETB TR1 ; Start Timer 1
WAIT: JNB TF1, WAIT ; Wait until Timer 1 overflows (TF1 = 1)
CLR TR1 ; Stop Timer 1
CPL P1.5 ; Toggle P1.5 (next half cycle of square wave)
CLR TF1 ; Clear Timer 1 overflow flag
SJMP AGAIN ; Repeat
2. Explain how the 8051 microcontroller uses the INT1 external interrupt to
control an LED connected to pin P1.3 based on the falling edge of a pulse at
P3.3.
PROGRAM:
ORG 0000H
LJMP MAIN
; ------------------------
; ISR for External Interrupt INT1 (P3.3)
; ------------------------
ORG 0013H
SETB P1.3 ; Turn ON LED at P1.3
MOV R3, #255 ; Load delay count
BACK: DJNZ R3, BACK ; Delay loop
CLR P1.3 ; Turn OFF LED
RETI ; Return from interrupt
; ------------------------
; Main Program
; ------------------------
ORG 0030H
MAIN: SETB TCON.2 ; Set INT1 as edge triggered (IT1 = 1)
MOV IE, #10000100B ; Enable INT1 (EX1) and global interrupt (EA)
HERE: SJMP HERE ; Stay in infinite loop