Deckard 0 Posted March 1, 2010 Report Share Posted March 1, 2010 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. Quote Link to post Share on other sites
davidb 0 Posted March 2, 2010 Report Share Posted March 2, 2010 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 Quote Link to post Share on other sites
Recommended Posts
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.