int main (void) { unsigned int n; InitPorts(); InitI2C(); ControlByte = 0xA0; LowAdd = 0x0C; HighAdd = 0x5A; Data = 0xAB; Length = 0x05; for(n = 0; n < PAGESIZE; n++) { PageString[n] = n; } while(1) { LATAbits.LATA0 = 1; LDByteWriteI2C(ControlByte, LowAdd, Data); HDByteWriteI2C(ControlByte, HighAdd, LowAdd, Data); HDPageWriteI2C(ControlByte, HighAdd, LowAdd, PageString); LDByteReadI2C(ControlByte, LowAdd, &Data, 1); HDByteReadI2C(ControlByte, HighAdd, LowAdd, &Data, 1); HDSequentialReadI2C(ControlByte, HighAdd, LowAdd, PageString, PAGESIZE); Nop(); LATAbits.LATA0 = 0; } }
void write_to_eeprom(char chr, short int addr) { HDByteWriteI2C(0xA0, 0x00, (char)addr, chr); }