Bit-banging SPI

Thread Starter

champ1

Joined Jun 4, 2018
136
Do you have any programming experience with MCU's.?
I have little bit experience with p89v51rd2 and C lanuguage and I use keil compiler

I don't exactly follow what you mean by 'ideas' from those timing diagrams.?
Mark up this clip from the d/s, showing the sections that are giving you a problem.
@djsfantasi said post#16
While in real time we can’t send/ receive simultaneously (with one cpu), practically sending and receiving sequentially can occur close enough that it appears simultaneous. That’s why timing diagrams are important. They show how fast sending and receiving must be to be successful.
I was trying to found the timing in the datasheet. I do not understand how much minimum time required to successful transmission.
 

ericgibbs

Joined Jan 29, 2010
18,865
hi,
OK,
A point to note is the P89v51 has an inbuilt hardware SPI module, you really do not need Bit switching aka Banging. See image
As you may have noted there are 4 programmable States for SPI [ Modes 0,0 0,1 1,0 1,1] communication.

The Master, usually a MCU controls the data exchange protocol, between Master and Slave.
The Master sets a CS [chip select] output pin Low and this Low is Read by the Slave, which the Slave program should recognise and be Ready for data exchange.
The Master also controls the MOSI Data output to the Slave also the CLK output pin, the Slave Reads the Clock and for each CLK cycle the Slave places a Data Bit on the MISO of the Master, in the same CLK cycle the Master Reads the MISO pin Data Bit.

All this information is available on the Web, just do a search for SPI Protocols.

E

BTW: Is this a College or Homework assignment,?
 

Attachments

Thread Starter

champ1

Joined Jun 4, 2018
136
A point to note is the P89v51 has an inbuilt hardware SPI module, you really do not need Bit switching aka Banging. See image
All this information is available on the Web, just do a search for SPI Protocols.
BTW: Is this a College or Homework assignment,?
Hi ericgibbs
This is not College or Homework assignment. I want to learn SPI protocols and I am learning on my own. It's most important and mostly use in any application. I have gone through so many documents, links and datasheet. I couldn't understand very well so I created one thread on SPI bit banging. You can see in first post of mine. I have explained all point for SPI that, I think required for SPI transmission.
 

Thread Starter

champ1

Joined Jun 4, 2018
136
I do not work with arduino

What does this function do ?

This function pass the parameter and return data while mine function only sending parameter post #10 flow chart

Code:
byte bitBangData(byte _send)
{
  byte _receive = 0;

  for(int i=0; i<8; i++)  // 8 bits in a byte
  {
            
  }
  return _receive;        // Return the received data
}
We were sending data from master to slave device previously. I do not understand what does this function return ?
 
Top