Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 29th January 2007, 03:29 AM   (permalink)
Default EEPROM writing, "unique" result

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.
ArtemisGoldfish is offline  
Old 29th January 2007, 04:55 AM   (permalink)
Default

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.
Pommie is offline  
Old 29th January 2007, 11:24 PM   (permalink)
Default

Quote:
Originally Posted by Pommie
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.
ArtemisGoldfish is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Problem Writing into EEPROM of PIC16f690 Ken Ho Micro Controllers 11 17th August 2006 05:55 AM
Writing Data to the EEPROM Electrix Micro Controllers 2 31st August 2005 07:39 AM
Required sequence for writing EEPROM MathGeek Micro Controllers 10 23rd August 2005 08:22 AM
Writing to EEPROM rizzy Micro Controllers 3 27th January 2004 05:01 AM



All times are GMT. The time now is 09:39 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker