期待高手指点,SD读写驱动
通过SPI接口发送一个字节 INT8U temp; SPI_SPDR = byte; /* 发送数据放入SPI数据寄存器 */ while(0 == (SPI_SPSR & 0x80)); /* 等待SPIF置位,即等待数据发送完毕 */ /* wait for SPIF being set, that is, wait for finishing of data being send */ temp = SPI_SPDR; 从SPI接口接收一个字节 SPI_SPDR = 0xFF; while(0 == (SPI_SPSR & 0x80)); /* 等待SPIF置位,即等待收到数据 */ /* wait for SPIF being set, that is, wait for being received data */ return(SPI_SPDR); /* 读取收到的字节 read the byte received */