Download as pdf or txt
Download as pdf or txt
You are on page 1of 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