General > 8051 Development Tools
Writing EEprom
DanielD:
Need to know instruction or routine to write eeprom on min/max51. Can it be written one byte at a time.
vitaliy:
If you use 8051/52 development system
you will be able to find EEPROM example under
C:\\bipom\\devtools\\MicroC\\Examples\\8051\\tiny\\eeprom\\24C04 folder.
Please try it.
Best regards,
Vitaliy
DanielD:
Thank you very much for the help. However, I have another problem. If I write to an eeprom address over 255 (8 bits) it writes to the target address and also to the target address minus 256. For example if I write to 256 it will write the data to address 256 and address 0. Any solutions for this? Is there a format for writing the address over 256? I\'m using WriteByte from the example programs on a MinMax51c with a T89C51RD2 and serial eeprom.
WriteByte( deviceNumber, address, data )
UBYTE deviceNumber;
unsigned address;
UBYTE data;
{
ERRCODE ec;
unsigned temp;
ec = Start();
if( ec != SUCCESS )
return ec;
ec = Transmit( I2C_DEVICE_24CXX | I2C_WRITE | (deviceNumber << 1) );
if( ec != SUCCESS )
goto func_end;
ec = Transmit( address & 0xFF );
if( ec != SUCCESS )
goto func_end;
ec = Transmit( data );
printf("\\nWriteByte=%d",data);
if( ec != SUCCESS )
goto func_end;
func_end:
Stop();
return ec;
}
vitaliy:
Please note, you changed the original source.
It had contained
....
deviceNumber |= (address >> 8);
ec = Transmit( I2C_DEVICE_24CXX | I2C_WRITE | (deviceNumber << 1) );
...
vitaliy:
sorry
deviceNumber |= (address >> 8 ) ;
ec = Transmit( I2C_DEVICE_24CXX | I2C_WRITE | (deviceNumber << 1) );
Navigation
[0] Message Index
[#] Next page
Go to full version