Program to generate 50msec delay
26. Program to generate 50msec delay:
mov tmod,#01 ;select timer 0here:mov tl0,#0fdh ;load tl0 with 0fdh
mov th0,#4bh ;load th0 with 4bh
cpl p1.5 ;compliment p1.5
acall delay ;call delay routine
sjmp here ;jump to here
delay:mov r1,#0c8h ;load r1 with data 0c8h
l1:setb tr0 ;set bit tr0
again:jnb tf0,again ;repeat till tf0=0
clr tr0 ;clear tr0
clr tf0 ;clear tf0
djnz r1,l1 ;decrement r1, jump to l1, if not equal to 0
ret
end