electonicsproject
Banned
how to set and use timer 0 and timer 1 in at89s52 to develop 2sec delay and blink led with it help in assembly language
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ORG 0000h
MOV TMOD,#01h
//Timer0 16-bit Mode
loop:
MOV TH0,#0x00
MOV TL0,#0x00
//For generating 0.05 Sec delay
CLR p0.0
//Turn ON LED
SETB TR0
// Start Timer 0
JNB TF0,$
// Wait till Timer 0 overflows
CLR TF0//Timer0 has overflowed clear the Flag
CLR TR0
//Stop Timer0
SETB p0.0
//Turn OFF LED
MOV TH0,#0x00
MOV TL0,#0x00
//Reload Timer0 For generating 0.05 Sec delay
SETB TR0
// Start Timer 0
JNB TF0,$
// Wait till Timer 0 overflows
CLR TF0
//Timer0 has overflowed clear the Flag
CLR TR0
//Stop Timer0
ajmp loop