lee_avr 发表于 2009-7-8 10:29:32

24L01 SPI的时序问题

24L01 spi的时序是不是 输出数据在上升沿之前 读取数据在上升沿之后?
伪代码:
CSN = 0;
for (int i=0; i<8; i++)
{
        //设置MOSI
        SCK = 0;
        SCK = 1;
        //读取MISO
}
CSN = 1;


看到的代码都是直接用avr的spi端口的,用IO模拟SPI,所以想学习下。

mandey 发表于 2009-7-8 10:38:47

24L01不是SPI接口的,是IIC接口的吧。

simond 发表于 2009-7-8 10:47:54

/**************************************************
Function: SPI_RW();

Description:
Writes one byte to nRF24L01, and return the byte read
from nRF24L01 during write, according to SPI protocol
**************************************************/
unsigned char SPI_RW(unsigned char byte)
{
unsigned char i;
nRF24L01_SCK = 0;   
for(i=0;i<8;i++) // output 8-bit
{
    nRF24L01_MOSI = (byte & 0x80)>>7;// output 'byte', MSB to MOSI
    byte = byte<<1;                        // shift next bit into MSB..
    nRF24L01_SCK = 1;                           // Set SCK high..
    byte |=(nRF24L01_MISO_PIN&0X01);      // capture current MISO bit
    nRF24L01_SCK = 0;                              // ..then set SCK low again
}
return(byte);                           // return read byte
}

wear778899 发表于 2009-7-17 12:30:23

一楼。。。。。

yingmu1021 发表于 2010-4-22 22:53:57

无语了。

maoweikeji 发表于 2010-4-25 10:57:56

靠。。。。这个问题无语了。。。直接到我网站上。全面资料提供下载。
页: [1]
查看完整版本: 24L01 SPI的时序问题