You are on page 1of 1

18ECL47 MICROCONTROLLER LABORATORY

Program 7
(Link of Video Demonstration: https://www.youtube.com/watch?v=2SFW_NwY2IQ&t=2s)
DELAY GENERATION USING ON-CHIP TIMER
Aim : ALP TO GENERATE GIVEN TIME DELAY USING ON-CHIP TIMER
MOV TMOD, #01H ;Selection of Timer 0 in Mode-1
START:CPL P1.1 ;Toggle the Values
MOV TH0,#0FCH ;Count value FC67h for 1ms, DC00h for 10ms,
MOV TL0,#67H
SETB TR0 ;Start the Timer
WAIT: JNB TF0,WAIT ;wait for Overflow
CLR TR0 ;Clear TF and Stop the timer for next Cycle
CLR TF0
SJMP START ;Repeat Continuously
END
Calculation and Results:
Case 1: For 1ms: 1ms/1.085µs = 921. For 16 bit timer 65536-921= 64615D = 0FC67H

Case 2: For10ms: 10ms/1.085µs = 9216. For 16 bit timer 65536-9216=56230D = 0DC00H

Case 3: For 1s: 1ms/1.085µs = 921658. For 16 bit timer 921658/65536= 14. (Timer
should be loaded with 0000H and repeated 14 times using a Loop or counter.

Department of ECE, CMRIT, Bangalore 2019-20 1

You might also like