0% found this document useful (0 votes)
82 views5 pages

Lab Task - 4: Name: Kaza Vineeth Reg - no:17BEC0711 Slot:L13+L14

This document contains a lab task assignment to generate square waves of 500 Hz and 7 kHz using timers 0 and 1 of an 8051 microcontroller. It includes an assembly language program that uses interrupts to toggle the P1.0 and P1.1 pins for the two frequencies. The program configures the timers in the appropriate modes and loads the correct values to achieve the desired frequencies. It also contains screenshots from a software simulation verifying the output frequencies on the pins.
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)
82 views5 pages

Lab Task - 4: Name: Kaza Vineeth Reg - no:17BEC0711 Slot:L13+L14

This document contains a lab task assignment to generate square waves of 500 Hz and 7 kHz using timers 0 and 1 of an 8051 microcontroller. It includes an assembly language program that uses interrupts to toggle the P1.0 and P1.1 pins for the two frequencies. The program configures the timers in the appropriate modes and loads the correct values to achieve the desired frequencies. It also contains screenshots from a software simulation verifying the output frequencies on the pins.
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/ 5

Lab task -4

MICRO CONTROLLERS AND ITS APPLICATION(ECE3003)

Name : KAZA VINEETH


Reg.no:17BEC0711
Slot:L13+L14
Q1)Write an 8051 assembly program using timer 0 to generate a
500 Hz and timer 1 to 7 kHz square wave frequency on P1.0 and
P1.1 respectively using Interrupts. Then examine the frequency
using the KEIL IDE inbuilt Logic Analyzer.

CODE:
Using mode 1 for timer 0
T0=1/500=2 ms
(65536 – x)×1.085µs=2ms/2
(since switching takes after every half cycle)
x=64614=FC66h
Using mode 2 for timer 1
T0=1/7000=0.1428 ms
(256 – y)×1.085µs=0.1428ms/2
y=190=BEh
Timer1 mod 2 timer0 mod 1
TMOD: 0 0 1 0 0 0 0 1
IE: 1 0 0 0 1 0 1 0
CODE:
ORG 0000H
LJMP MAIN
ORG 000BH
CPL P1.0
MOV TL0,#66H
MOV TH0,#0FCH
RETI
ORG 001BH
CPL P1.1
RETI
ORG 0100H
MAIN:MOV IE,#8AH
MOV TMOD,#21H
MOV TL0,#66H
MOV TH0,#0FCH
MOV TH1,#0BEH
SETB TR0
SETB TR1
HERE:SJMP HERE
END
SOFTWARE SIMULATION:

RESULTS:
At P0.1 with 500Hz
At P0.1 with 7kHz

You might also like