
	LIST P=16F690
   	INCLUDE<P16F690.INC>
	ERRORLEVEL-302

	__CONFIG  _WDT_OFF

	cblock 	0x20
DATA_EE_ADDR
DATA_EE_DATA
	endc

	org 0

	clrf	DATA_EE_ADDR
	clrf	DATA_EE_DATA
main	call	pis
	movlw	0xff
	call	cti
	incf	DATA_EE_ADDR,f
	incf	DATA_EE_DATA,f
	goto	main

;*******************************************
pis
  	BANKSEL    DATA_EE_ADDR               ; 
          MOVF       DATA_EE_ADDR, W; 
	BANKSEL    EEADR
          MOVWF      EEADR              ;Data Memory Address to write 
          BANKSEL    DATA_EE_ADDR
	MOVF       DATA_EE_DATA, W; 
   	BANKSEL	EEDAT
	MOVWF      EEDAT              ;Data Memory Value to write 
          BANKSEL EECON1                 ; 
          BCF        EECON1, EEPGD       ;Point to DATA memory 
          BSF        EECON1, WREN        ;Enable writes 
          MOVLW      0x55                ; 
      	MOVWF      EECON2             ;Write 55h
       	MOVLW      0xAA                ; 
    	MOVWF      EECON2             ;Write AAh
          BSF        EECON1, WR          ;Set WR bit to begin write 
	nop
          BTFSc	EECON1,WR
	GOTO	$-1
 ;         SLEEP                          ;Wait for interrupt to signal write complete (optional) 
          BCF        EECON1, WREN        ;Disable writes 
          BANKSEL 0x00                   ;Bank 0 

	return

;*****************************************
cti

	
  BANKSEL   DATA_EE_ADDR              ;                                    
  MOVF      DATA_EE_ADDR, W; 
  BANKSEL EEADR                                        
  MOVWF     EEADR               ;Data Memory 
                                                                     
                                ;Address to read 
                                                                      
  BANKSEL EECON1                ; 
  BCF       EECON1, EEPGD  ;Point to DATA memory                     
  BSF       EECON1, RD         ;EE Read                               
  BANKSEL EEDAT                ;                                      
  MOVF      EEDAT, W           ;W = EEDAT                             
  BCF       STATUS, RP1        ;Bank 0 
	return
;******************************************
  
  
  
  
  
  	end