
;Code for write and read eeprom in AT89c51ED2
;In DPTR the address, in A the data
WRee:	push	acc
lb1:	mov	a,eecon		;Waits the last data was writen
	jb	eebusy,lb1
	clr	ea		;Disable Interrupts
	orl	eecon,#00000010b	;Enable EEPROM
	pop	acc
	movx	@dptr,a
	anl	eecon,#11111101b	;Disable EEPROM
	setb	ea		;Enable Interrupts interrupciones
	ret
RDee:	mov	a,eecon		;Waits the last data was writen
	jb	eebusy,RDee
	clr	ea		;Disable Interrupts
	orl	eecon,#00000010b	;Enable EEPROM
	movx	a,@dptr
	anl	eecon,#11111101b	;Disable EEPROM
	setb	ea		;Disable EEPROM
	ret
;
