飞天(270651970) 13:33:16
unsigned int send(unsigned int indata)
{
unsigned char i;
unsigned int SPI_IN;
unsigned int SPI_OUT;
SPI_IN=indata;
SPI_CS=0;
delay(10);
SPICLK="0";
for(i=0;i<16;i++)
{
SPICLK="0";
if(SPI_IN & 0x8000)
MOSI="1";
else
MOSI="0";
delay(2);
SPICLK="1";
SPI_OUT<<=1;
SPICLK=0;
delay(2);
SPICLK=1;
if(MISO)
SPI_OUT|=1;
else
SPI_OUT|=0;
delay(2);
SPI_IN <<=1;
}//end for(i=0;i<16;i++)
SPI_CS=1;
return SPI_OUT;
} //end send(unsigned char Hdata, unsigned char Ldata)
飞天(270651970) 13:33:49
请教高手:我的程序哪点出现问题了?
文章评论(0条评论)
登录后参与讨论