我的读函数:
CS5534_CS=0;;
switch (Setupx)
{
case Setup1:
SPI_SendByte(0x80);
break;
case Setup2:
SPI_SendByte(0x88);
break;
case Setup3:
SPI_SendByte(0x90);
break;
case Setup4:
SPI_SendByte(0x98);
break;
case Setup5:
SPI_SendByte(0xA0);
break;
case Setup6:
SPI_SendByte(0xA8);
break;
case Setup7:
SPI_SendByte(0xB0);
break;
case Setup8:
SPI_SendByte(0xB8);
break;
default:
break;
}
while(SPI_MISO_R);
SPI_SendByte(0xC0);
dat[0] = SPI_ReceiveByte();
dat[1] = SPI_ReceiveByte();
dat[2] = SPI_ReceiveByte();
dat[3] = SPI_ReceiveByte();
CS5534_CS=1;
|