 __CONFIG   _CP_OFF &  _WDT_OFF & _PWRTE_ON & _XT_OSC
       LIST P=16F84A
      #include<p16f84a.inc>

      CBLOCK 0x0C
      ENDC

 #DEFINE  RELE1      PORTA,.0         ; Relay 1 conectado al RA0
 #DEFINE  RELE2      PORTA,.1         ; Relay 2 conectado al RA1
 #DEFINE  PULSADOR   PORTB,.0         ; Línea donde se conecta el pulsador RB0
      ORG      .0
      GOTO      INICIO

INICIO
      bsf      STATUS,RP0			; acceso al Banco 0
      bsf      PULSADOR             ; Switch como entrada 
      bcf      RELE1				; Relay 1 como salida
      bcf      RELE2				; Relay 2 como salida
      bcf      STATUS,RP0			; acceso al Banco 1
PRINCIPAL
      btfsc    PULSADOR             ; Switch presionado? Switch = 0?
      goto     APAGAR				; No 
      bsf      RELE1				; Activo el relay 1	
      bsf      RELE2				; Activo el relay 2	
      call     Retardo_10s			; LLamo retardo de 10s
      call     Retardo_20s			; LLamo retardo de 20s
      goto     PRINCIPAL			; Vuelo al inicio
APAGAR 
      bcf  	   RELE1				; Desactivo el relay 1
      bcf  	   RELE2				; Desactivo el relay 2
      call     Retardo_10s			; LLamo retardo de 10s
	  call     Retardo_20s			; LLamo retardo de 20s
	  goto     PRINCIPAL			;
 	
      
      #INCLUDE<RETARDOS.INC>
      end