I have this following question. What is the difference between the read/write operations when using SPI and I2C protocols. For example I have 2 different sensors one interfaced through SPI and another interfaced through I2C.
So I2C read is as follows:
- Send the 7 bit slave address followed by setting the read bit
which will identify the right slave - Send another 7 bit address of the particular register inside the slave device followed by read bit.
- Then how do we read the contents? Store it in a variable by using '=' operator in C?
For SPI read:
Set the Chip select pin to enable the slave.
Send the read command to the slave to say that it is read operation.
Then how do we read the contents? Store it in a variable by using '=' operator in C?
Am I right with the sequence? Or Am I missing something? Please clarify. Thanks