The application demonstrates how to use use the TWIHS in high speed slave mode.
This package can be used with the following setup:
In addition, another device will be needed to act as the TWI master. The twi_eeprom_example can be used for that, in which case a second kit supported by that project is needed.
After launching the program, the device will act as a simple TWI-enabled serial memory containing 512 bytes. This enables this project to be used with the twi_eeprom_example project as the master.
To write in the memory, the TWIHS master must address the device first, then send two bytes containing the memory address to access. Additional bytes are treated as the data to write.
Reading is done in the same fashion, except that after receiving the memory address, the device will start outputting data until a STOP condition is sent by the master. The default address for the TWIHS slave is fixed to 0x40. If the board has a TWIHS component with this address, you can change the define AT24C_ADDRESS in twi_eeprom_example.c of twi_eeprom_example project, and the define SLAVE_ADDRESS in twihs_slave_example.c of twihs_slave_exmaple project.
This software was written for the GNU GCC and IAR EWARM. Other compilers may or may not work.
For further information, visit Microchip.
Support and FAQ: https://www.microchip.com/support/