__CONFIG _WDT_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF & _CP_OFF & _BODEN_OFF
; 1 - DELAYS: 18mS, 200mS, 500mS, MICRO4, 50uS
;********************************************************
org 0x0000
NOP
goto START
;******************************************************
org 0x04
goto INT_O
org 0x08
;******************************************************
INT_O
bcf INTCON, INTF ; disabling interrupt
clrf SENSEBIT
MOVLW 0X80
MOVWF INTCON
RETFIE
;******************************************************
org 0x0020
;******************************************************
INIT
#define V_OFF PORTC,5 ;PIN5 - RC5 VALVE OFF Signal
#define V_ON PORTC,4 ;PIN6 - RC4 VALVE ON Signal
#define IRLED PORTC,3 ;PIN7 - RC3 IR LED Signal
#define GRNLED PORTC,2 ;PIN8 - RC2 SENSING INDICATOR
#define VALVELED PORTC,1 ;PIN9 - RC1 VALVE INDICATOR
#define IRSUPP PORTC,0 ;PIN10 - RC0 IR SUPPLY
#define INPUT PORTA,2 ;PIN11 - RA2 Remote eye input
RS0 equ 0X21 ; reserve 1 address location
RS1 equ 0X22 ; reserve 1 address location
RS2 equ 0X23 ; reserve 1 address location
RS3 equ 0X24 ; reserve 1 address location
RS4 equ 0X25 ; reserve 1 address location
RS5 equ 0X26 ; reserve 1 address location
SENSEBIT equ 0X27
; PORTA SETTING :
BCF STATUS, RP0 ; Bank 0
CLRF PORTA ; Init PORTA
MOVLW 03Fh ; Set RA<all pins to 1 >
MOVWF PORTA
MOVLW 07h ;
MOVWF CMCON ;
BSF STATUS, RP0 ; Bank 1
CLRF ANSEL ; digital I/O
BSF ANSEL, ANS0 ; SET AN0 = Analog Input (PIN13)
movlw 0x80 ;
movwf OPTION_REG ; locked in Option Reg
MOVLW 03Fh ; RA<all pins as inputs>
MOVWF TRISA ;
MOVLW 00h ;Weak pull ups enabled -- all
MOVWF WPUA
BCF STATUS, RP0 ; Bank 0