where EEADDR is defined as 0xA0, corresponding to EEPROMs control word. I2C Module Initialization For single master-slave enviroment, you can omit I2CENABLESLAVECLOCKSTRETCHING config word.
#I2C EEPROM PROGRAMMER HOW TO#
If (len
MasterWriteI2C2(EE_ADDR | 1) // Read command This EEPROM programmer reads, writes and erases IC 24C EEPROM devices.
MasterWriteI2C2(ee_addr) // Address of operation MasterWriteI2C2(ee_addr > 8) // Address of operation If (I2C2STATbits.ACKSTAT) return // NACK'ed by slave ? MasterWriteI2C2(EE_ADDR | 0) // Write control byte Void eepromRead(unsigned int ee_addr, unsigned char *buf, unsigned int len) I2CSetFrequency(EE_I2C, GetPeripheralClock(),400000) įor single master-slave enviroment, you can omit I2C_ENABLE_SLAVE_CLOCK_STRETCHING config word. I2CConfigure(EE_I2C, I2C_ENABLE_SLAVE_CLOCK_STRETCHING | I2C_ENABLE_HIGH_SPEED) Few useful examples, how to force HW I2C module of PIC32MX to collaborate with I2C EEPROM chip, like Microchip’s 24LC1025.