EEPROM writing, "unique" result

Status
Not open for further replies.
I'm just full of problems, aren't I?
Now, I've started programming in Assembly and WOW, it's a whole lot easier than I thought. As a test to make sure my PIC is functioning correctly, I wrote (stole most of the) code for writing to EEPROM. Since it's short, here it be:

#include <P16F876A.inc>

BSF STATUS,RP1
BSF STATUS,RP0
BTFSC EECON1,WR
GOTO $-1
BCF STATUS,RP0
MOVF 0x0000,W
MOVWF EEADR
MOVF 0x3F,W
MOVWF EEDATA
BSF STATUS,RP0
BCF EECON1,EEPGD
BSF EECON1,WREN
MOVLW 0x55
MOVWF EECON2
MOVLW 0xAA
MOVWF EECON2
BSF EECON1,WR
BCF EECON1,WREN

loop NOP
GOTO loop
end

Now, when I write it to my PIC (JDM programmer, IC-Prog 1.05D), hook it up, etc, and I plug it back into my programmer and read from it, the EEPROM location 0x0002 was written to instead of 0x0000, as I had copied to the EEADR register. Well, errr, What up with that?

Thanks again, community, for putting up with me.
 
Your writing whatever is in SFR 3F into EEPROM at address, whatever is in SFR 00.

Try changing it to,
Code:
	BCF STATUS,RP0
	movlw	00;  < change
	MOVWF EEADR
	movlw	0x3f;< change
	MOVWF EEDATA
	BSF STATUS,RP0
	BCF EECON1,EEPGD

Try that and report back.

Mike.
 

Hm, fancy that. Thanks, Mike. I'll try more fancy little configurations and say if I have any more problems that are EEPROM-based.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…