org 00h
main:
mov p3,#0ffh
mov p1,#00b

scan:
jnb p3.3,under
jb p3.2,tem
jnb p3.2,temp
jmp scan

temp:
setb p1.5
call delay
setb p1.5
clr p1.4
jmp scan

tem:
setb p1.4
clr p1.5
jmp scan


under:
clr p1.2
call delay
setb p1.2
call delay
clr p1.2
clr p1.3
call delay
setb p1.3
call delay
call delay
call delay
clr p1.3
jmp scan


delay:							 ;DELAY OF ONE SECOND
 		MOV TMOD,#01H
		MOV TH0,#3CH
		MOV TL0,#0B0H
		MOV R7,#00H
		SETB TR0
	DEL:JNB TF0,DEL
		MOV TH0,#3CH
		MOV TL0,#0B0H
		CLR TF0
		INC R7	
		CJNE R7,#14H,DEL
		REt

end