;----------------------------------------------------------------------------------
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_ON & _IESO_ON & _BOR_ON & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_OFF & _WDT_OFF & _HS_OSC & _DEBUG_OFF
__CONFIG _CONFIG2, _WRT_OFF & _BOR40V
;---------------------------------------------------------------------------------
; EEPROM WRITE
eeprom_write
nop
banksel EEADR
movlw 0x00
movwf EEADR
banksel EEDAT
movlw H'26'
movwf EEDAT
banksel EECON1
bcf EECON1,EEPGD
bsf EECON1,WREN
banksel INTCON
bcf INTCON,GIE
btfsc INTCON,GIE
goto $-2
banksel PORTB
bsf PORTB,0 ; Indication LED
banksel EECON2
movlw H'55'
movwf EECON2
movlw H'AA'
movwf EECON2
banksel PORTB
bsf PORTB,1 ; Indication LED
banksel EECON1
bsf EECON1,WR
btfss EECON1,WR
goto $-2
banksel PORTB
bsf PORTB,2 ; Indication LED
banksel INTCON
bsf INTCON,GIE
banksel EECON1
btfsc EECON1,WR
goto $-1
banksel PORTB
bsf PORTB,3 ; Indication LED
banksel EECON1
bcf EECON1,WREN
;
banksel STATUS
bcf STATUS,RP0
bcf STATUS,RP1
return
;---------------------------------------------------------------------------