How do i send ads1115 data over spi to master arduino
Implementing SPI slave mode is a little more tricky than you may think.  The most important thing to remember is that it's not a "Give me X" -> "Ok, here is X" kind of protocol.  It's actually a "Here's X" &lt;=> "Here's Y" protocol.

That is, at the same time that the master sends X to the slave, the slave sends "Y" to the master.

The way you have it is that the master sends "a" as a command and discards what it receives.  The slave remembers that "a" as the "command". Then the master sends 0, and remembers what it receives. The slave receives that 0 and thinks "Ah, I got the command last time, so it must want the value" and queues up the value to be sent the next time a transaction occurs.  That then gets thrown away, since that occurs when the next "command" is sent.

You need to be a little more cunning, and implement a finite state machine to work out where in the stream you are.


When SS falls set a "byte counter" to 0.
When a byte is received examine the "byte counter":


Byte 0: If it's an "a" then place the first byte of the value in SPDR.
Byte 1: Place the second byte of the value in SPDR
Byte 3: Do nothing (or place 0 in SPDR)

Increment the byte counter


So the transaction goes something like this (1570 is 0x622 in hex, and I choose "little endian" since the AVR is naturally little endian):

Master Sends        Slave Queues          Master Receives
'a'                 0x22                  Rubbish
0                   0x06                  0x22
0                   0x00                  0x06

'a'                 0x22                  0x00
0                   0x06                  0x22
0                   0x00                  0x06


The important thing to remember is that the master receives what the slave queued on the next transfer.