
counter1 EQU 40h
counter2 EQU 50h
counter3 EQU 60h
counter4 EQU 70h
org 0
    mov P1,#00h              ;set the LEDs and fans to off
    mov P3,#00h
   mov counter1,#200
   mov counter2,#200
   mov counter3,#2
   mov counter4,#2
Loop:
     acall Pressure_Up
     acall Air_Inlet_Out
     acall Pressure_Up
     acall Air_Outlet_Out
     ajmp Loop
Pressure_Up:
            setb P1.2           ;light up LED_1
            acall Dlay_2
            setb P1.3           ;light up LED_2
            acall Dlay_2
            setb P1.4           ;light up LED_3
            acall Dlay_2
            setb P1.5           ;light up LED_4
            acall Dlay_2
            setb P1.6           ;light up LED_5
            acall Dlay_2
            ret
Air_Inlet_Out:
              setb P3.0	;light up LED for air out at inlet
              setb P3.1		;switch on fan at inlet
              acall Dlay_1
		clr P1.6
		acall Dlay_1
		clr P1.5
		acall Dlay_1
		clr P1.4
		acall Dlay_1
		clr P1.3
		acall Dlay_1
		clr P1.2
		acall Dlay_1
              clr P3.0		;switch off the LED
              clr P3.1		;switch off fan at inlet
              ret
Air_Outlet_Out:
               setb P3.2	;light up LED for air out at outlet
               setb P1.7	;switch on fan at outlet
               acall Dlay_1
		clr P1.6
		acall Dlay_1
		clr P1.5
		acall Dlay_1
		clr P1.4
		acall Dlay_1
		clr P1.3
		acall Dlay_1
		clr P1.2
		acall Dlay_1
               clr P3.2		;switch off the LED
               clr P1.7		;switch off fan at outlet
               ret
Dlay_2:
        djnz counter1,Dlay_2
        mov counter1,#200
        djnz counter2,Dlay_2
        mov counter2,#200
	djnz counter3,Dlay_2
   	mov counter3,#2
   	djnz counter4,Dlay_2
   	mov counter4,#2
        ret
Dlay_1:
        djnz counter1,Dlay_1
        mov counter1,#200
        djnz counter2,Dlay_1
        mov counter2,#200
	djnz counter3,Dlay_1
	mov counter3,#2
        ret
END
[/quote]

