0% found this document useful (0 votes)
4 views3 pages

Assignment Test

The square wave frequency is determined by the timer settings in the 8051 assembly program, where Timer 1 is configured in mode 1 and loaded with the value 7634H. With an XTAL of 11.0592 MHz, the resulting frequency at pin P1.5 can be calculated to be approximately 1.2 kHz. Additionally, the program uses the INT1 external interrupt to control an LED connected to pin P1.3, turning it on with a delay when a falling edge pulse is detected at P3.3.

Uploaded by

Sri Dhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Assignment Test

The square wave frequency is determined by the timer settings in the 8051 assembly program, where Timer 1 is configured in mode 1 and loaded with the value 7634H. With an XTAL of 11.0592 MHz, the resulting frequency at pin P1.5 can be calculated to be approximately 1.2 kHz. Additionally, the program uses the INT1 external interrupt to control an LED connected to pin P1.3, turning it on with a delay when a falling edge pulse is detected at P3.3.

Uploaded by

Sri Dhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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

You might also like