Jump to content

Writing To Eeprom...."error: Left Operand Must Be L-value"


Recommended Posts

Hello, I'm experimenting with the EEPROM of a PIC16F88. At the minute I'm trying to write an arbitary value to an address in the EEPROM. However I'm seeing the " error: left operand must be l-value" error message. I have a vague idea that this is something to do with trying to assign a variable to a constant but i'm stumped on as how to get around it. The code I have is:

 

void eeprom_write()
{

EEADR=01111011b;												//write address to EEADR
EEDATA=01110001b;												//write 8-bit data value to EEDATA
eecon1.7=0;													//access data memory
eecon1.2=1;													//allow write cycles													
intcon.7=0;													//temporarily disable interrupts
eecon2=01010101b;												//write 55h to eecon2
eecon2=10101010b;												//write AAh to eecon2
eecon1.1=1;													//Initiates a write cycle
intcon.7=1;													//re-enable interrupts
eecon1.2=0;													//Inhibits EEPROM writes													
while(pir2.4==0)
{
	nop();												//wait for write to complete
}
pir2.4=0;

Currently I just want to write values to the EEPROM, simulate the progam and check for correct operation. Any help is appreciated, thanks.

Link to post
Share on other sites
Hello, I'm experimenting with the EEPROM of a PIC16F88. At the minute I'm trying to write an arbitary value to an address in the EEPROM. However I'm seeing the " error: left operand must be l-value" error message. I have a vague idea that this is something to do with trying to assign a variable to a constant but i'm stumped on as how to get around it. The code I have is:

 

void eeprom_write()
{

EEADR=01111011b;												//write address to EEADR
EEDATA=01110001b;												//write 8-bit data value to EEDATA
eecon1.7=0;													//access data memory
eecon1.2=1;													//allow write cycles													
intcon.7=0;													//temporarily disable interrupts
eecon2=01010101b;												//write 55h to eecon2
eecon2=10101010b;												//write AAh to eecon2
eecon1.1=1;													//Initiates a write cycle
intcon.7=1;													//re-enable interrupts
eecon1.2=0;													//Inhibits EEPROM writes													
while(pir2.4==0)
{
	nop();												//wait for write to complete
}
pir2.4=0;

Currently I just want to write values to the EEPROM, simulate the progam and check for correct operation. Any help is appreciated, thanks.

Deckard,

 

EEADR & EEDATA are the literal definitions for the associated variable addresses so you are trying to assign a value to a literal.

BoostC uses lower case convention for register variables. Use eeadr & eedata for the registers. See the appropriate header file in the include directory, in your case PIC16F88.h, for all the definitions and declarations.

 

Regards

 

davidb

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...