I2C Master-slave in Assembly (ASM)
The I2C protocol is one of the most used protocols in hobby projects. But some might experience getting it to work can be hard. So I created some example code to communicate between 2 AVR's, an ATmega32 as the master and ATmega8 as slave.
This is only one way I2C communication (master->slave) but I hope it gets you going, because I couldn't find a good headstart for the slave anywere. Offcourse you can use other types of AVR's as long as they have hardware I2C support. Atmel calls it TWI. Note that this is only an example that you can expand and modify yourself. Getting this to work in a real application requires some more coding by using interrupts for example. I'm working on a library that can be used in such circumstances.
This is what it can look like in a test setup. It looks chaotic, and it probably is, but in fact it's quite easy.
Master code
The master controls the I2C bus. In this example, the master can only transmit data.