You are on page 1of 3

Rida Iqbal

2012-EE-24

LAB# 09
OBJECTIVE:
To study Timers.

Task 1:
>>Source code to generate minimum delay using timers
org 0000h mov tmod,#01h back: mov tl0,#00h mov th0,#00h setb tr0 here: jnb tf0, here clr tr0 clr tf0 sjmp back end

Task #2:
>>Source code to generate maximum delay using timers.
org 0000h mov tmod,#01h back: mov tl0,#0ffh mov th0,#0ffh setb tr0 here: jnb tf0, here clr tr0 clr tf0 sjmp back end

Task# 3:
>>Source code to generate 8 bit auto reload for minimum.
Org 00h mov tmod,#02h mov th0,#00h

Page 1

Rida Iqbal
back:setb tr0 jnb tf0,$ clr tr0 sjmp back end

2012-EE-24

Task 4:
>> Source code to generate 8 bit auto reload for maximum.
Org 00h mov tmod,#02h mov th0,#0ffh back:setb tr0 jnb tf0,$ clr tr0 sjmp back end

Task 5:
>> Source code to make traffic signal using timers.
org 0000h Mov p2,#0 Main: setb p2.1 Mov r5,#06 Sixsec: Acall DELAY1SEC DJNZ r5,Sixsec SETB P2.2 Mov r4,#2 TWOsec: Acall DELAY1SEC djnz r4,TWOsec clr p2.1 clr p2.2 setb p2.3 MOV R3,#3 FOURsec: Acall DELAY1SEC DJNZ r3,FOURsec CLR P2.3 SETB P2.2 aCALL DELAY1SEC CLR P2.2 SJMP Main DELAY1SEC: Mov R7,#4 ABC: MOV R6,#250

Page 2

Rida Iqbal
DEF: MOV TMOD,#00000001B MOV TH0,#0FCH MOV TL0,#018H SETB TR0 HERE: JNB TF0,HERE CLR TR0 CLR TF0 DJNZ R6, DEF DJNZ R7,ABC RET End

2012-EE-24

Page 3

You might also like