Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

EEPROM Initialization with MPLab

Status
Not open for further replies.

jumper2high

Full Member level 3
Joined
May 24, 2009
Messages
178
Helped
20
Reputation
40
Reaction score
10
Trophy points
1,298
Location
Serbia
Activity points
2,579
Hello all,
I'm trying to find an answer to one very simple and silly question, but failing miserably.

In MPLab, when doing an ASM source file, I was able to tell the software that I want certain values burned into EEPROM upon programming, so I did:

Code:
	ORG 0x2100
	DW b'00000000'
	DW b'01000010'
	DW b'01111111'
	DW b'01000000'
	DW b'00000000'

And it would put those five values in the first five places in EEPROM.

However, if I try this in a C-file (using MCC18) I get an error. I've tried searching for the correct way to do this for some time now, but I can't seem to find it. Because of the type and amount of data I want to put in there - I want to avoid having to convert it all to hex manually and enter it through the EEPROM Editor. :D
 

try this

void write_eeprom(unsigned char x,unsigned char y)
{
EEADR=x;
EEDATA=y;
EECON1bits.EEPGD=0;
EECON1bits.CFGS=0;
EECON1bits.WREN=1;
INTCON=0x00;
EECON2=0x55;
EECON2=0xaa;
EECON1bits.WR=1;
while(EECON1bits.WR==1);
while(!PIR2bits.EEIF);
INTCON=0xc0;
EECON1bits.WREN=0;
PIR2=0x00;
}
char read_eeprom(unsigned char x)
{
delay(100);
EEADR=x;
delay(100);
EECON1bits.EEPGD=0;
delay(100);
EECON1bits.CFGS=0;
delay(100);
EECON1bits.RD=1;
delay(100);
return( EEDATA);
}



regards,

karthikeyan
 

Thanks for trying to help, but that's not what I was looking for really.
I know how to make a program that will put stuff in EEPROM, I want the PROGRAMMER (PICKit3 in my case) to put stuff in EEPROM...

Eventually, I figured it out, though:

Code:
#pragma romdata eedata_cg=0xf00000
rom unsigned char eedata_values[50] = {
				//number0
					0b00111110,
					0b01010001,
					0b01001001,
					0b01000101,
					0b00111110,
					.....and so on....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top