eewrite bsf STATUS,RP0 ; select bank1
movfw CHOURS ; get Chours
bcf STATUS,RP0 ; reset to bank0
bsf STATUS,RP1 ; select bank2
movwf EEDATA ; load Chours to EEdata
movlw 0x00 ; load eeaddresss 00
movwf EEADR ;
bcf STATUS,RP1 ; reset to bank0
bsf STATUS,RP0 ; select bank1 EEWRITE
bsf STATUS,RP1 ; select bank3
bcf EECON1,EEPGD ; points to data memory
bsf EECON1,WREN ; enable write
bcf INTCON,GIE ; disable all ints
movlw 0x55 ;
movwf EECON2 ; init write sequence
movlw 0xAA ; using 2 instructions
movwf EECON2 ;
bsf EECON1,WR ; write data
bsf INTCON,GIE ; turn ints back on
bcf STATUS,RP0 ; select bank0
bcf STATUS,RP1 ;
wd01 btfss PIR2,EEIF ; is int bit on ie WRTDONE
goto wd01 ; if done continue
bcf PIR2,EEIF ; reset interupt
bsf STATUS,RP0 ; select bank3
bsf STATUS,RP1
bcf EECON1,WREN ; disables write
bcf STATUS,RP1 ; select bank1
bcf STATUS,RP0 ; select bank0