unsigned char eeprom_page_write(unsigned char addressH,unsigned char addressL, unsigned char data[],int length)
{
unsigned char ucAction1Completed = 0;
unsigned char eepret;
eepret = i2c_start(Dev24C02+I2C_WRITE); // set device address and write mode
if ( eepret ) {
/* failed to issue start condition, possibly no device found */
i2c_stop();
PORTB=0xAA; // activate LED to show error */
}else {
/* issuing start condition ok, device accessible */
i2c_write(addressH); // write address
i2c_write(addressL);
for (int i=0; i<length; i++)
{
i2c_write(data[i]); // write data
}
i2c_stop();
ucAction1Completed = 1;
}
}