if(byte & 0x80)
PORT |= BIT(MOSI);
else
{
PORT &= ~(BIT(MOSI)); // output 'byte', MSB to MOSI
}
byte = (byte << 1); // shift next bit into MSB..
PORT |=BIT(CLK); // Set clk high..
if(PIN&(BIT(MISO)))
byte |= BIT0; // capture current MISO bit
else
{
byte &=~BIT0;
}
PORT &=~BIT(CLK); // set clk low
}
PORT &=~(BIT(MOSI)); //PULL DOWN THE MOSI
return(byte); // return read byte
}
为什么还要把MISO读取出来啊???