Bit-banging SPI .. #2

Thread Starter

Jothika

Joined Aug 18, 2021
1
Pls explain spi read reg ,how to read the data ,





SPIData = 0;
for (SPICount = 0; SPICount < 8; SPICount++) // Prepare to clock in the data to be fread
{
SPIData <<=1; // Rotate the data
SPI_CK = 1; // Raise the clock to clock the data out of the MAX7456
SPIData += SPI_MISO; // Read the data bit
SPI_CK = 0; // Drop the clock ready for th enext bit
} // and loop back
SPI_CS = 1; // Raise CS

return ((unsigned char)SPIData); // Finally return the read data


Mod: link to old thread.E
https://forum.allaboutcircuits.com/threads/bit-banging-spi.164120/post-1443131
 
Top