hi everybody on the forum, i need to communicate eight slaves (attiny2313) with one master atmega8 which interafacing is better? I2C? SPI? CAN? OR THERE ANY OTHER INTERFACE WHICH SUITS BEST?
If data are all going from the master to the slaves then RS232 (uart) is very simple just connect masterTX to all slaveRX's at the same time, if the slaves need to reply in any way then everything becomes much harder.
SPI needs 3 pins plus 1 more for each slave, so 8 slaves means 11 pins.
Serial (RS232 or 485) will just need a few extra characters to address a slave, just one pin & wire for master to slave, add another one if you want duplex (though 485 may go both ways on one wire, not really sure). For short distances you can skip the electrical interface and just stay with "TTL-232"
I2C needs just 2 pins, clock and data to address up to 120+ devices, or more if using the extended address. While the coding is always a pain the electrical simplicity makes it my goto choice whenever I can use it. If you need any sore of real time feedback you can always poll (frequently ask) each slave if it is ready to send data, or just read data (which may include a flag "this is something you saw already").