本帖最后由 sdpz 于 2011-4-20 20:49 编辑
void SPI_WriteByte(unsigned char dat)
{
while (!(SPI->SR & SPI_SR_TXE));
SPI->DR = dat;
}
void main()
{
.............
SPI_WriteByte(0x90);
LED_ON(LED1);
SPI_WriteByte(0x00);
LED_ON(LED2);
SPI_WriteByte(0x00);
SPI_WriteByte(0x00);
...........
}
SPI_WriteByte函数第一次可以跳出循环,第二次就不行了。太诡异了!!! |