i need to communicate eight slaves (attiny2313) with one master atmega8 which interafacing is better

Discussion in 'Embedded Systems and Microcontrollers' started by shashidhar, Aug 11, 2015.

  1. shashidhar

    Thread Starter New Member

    Aug 11, 2015
    1
    0
    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?
     
  2. pwdixon

    Member

    Oct 11, 2012
    488
    56
    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.
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,180
    1,800
    How far apart are these devices? You can use the UART with RS-485 trnasceivers to make half duplex connections.
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    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").
     
Loading...