Hi, I'm starting to learn how to use assembly. This code refers to a presence sensor, I would like to put a 5 second timer/delay on it. When to open or close the door. I'm programming in mplab and using proteus to simulate the electrical part.

Code:
PROCESSOR 16F877A
#include<p16f877a.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
org 0x00
goto Main
org 0x04
goto Main
Main
BSF STATUS,5
MOVLW B'11111111'
MOVWF TRISB ;
MOVLW B'11110000' ;
MOVWF TRISD
BCF STATUS,5
CLRF PORTD
Loop
BTFSS PORTB,2
GOTO open
GOTO close
close
BCF PORTD,0 ; Close door
BCF PORTD,2 ; LED red on
BSF PORTD,3 ; LED green off
GOTO Loop
open
BSF PORTD,0 ; Open door
BCF PORTD,3 ; LED green on
BSF PORTD,2 ; LED red off
GOTO Loop
END
