Pseudo SPI Is this right trans form for Arduino : As requested new thread

So, say I had a clk, a cs, and a msio.
And inorder for the msio to transmit, I had to push clk and cs low.


would that mean?
var p3 = GT.Socket.GetSocket(9, false, null, null).CpuPins[3];
var p4 = GT.Socket.GetSocket(9, false, null, null).CpuPins[4];

var ClkPin = new OutputPort(p3, false);
var CsPin = new OutputPort(p4, false);


ClkPin.Write(True);
CsPin.Write(true);


WriteRead(bytes, bytes);

CsPin.Write(true);
ClkPin.Write(true);


for ->
  digitalWrite(sclk, LOW);  
_delay_ms(1);  
digitalWrite(cs, LOW);  _
delay_ms(1);  
for (i=31; i>=0; i--) 
 {
    digitalWrite(sclk, LOW);
   _delay_ms(1);
    d <<= 1;
    if (digitalRead(miso))
   {
      d |= 1;
    }
    digitalWrite(sclk, HIGH);
  _delay_ms(1);  
}
digitalWrite(cs, HIGH);

Leaving out the naghty bits.

Is this right?

BTW running on a kind of SPI.

Thanks

Using code tags will make your post more readable. This can be done in two ways:[ol]
Click the “101010” icon and paste your code between the

 tags or...
Select the code within your post and click the "101010" icon.[/ol]
(Generated by QuickReply)

I wonder if you really need to do this, whether SPI will work for you?

But bit-banging will work fine. Whether your code is right or not I’m not going to say, why don’t you try it and see if you get reasonable data?