本帖最后由 felix.feng 于 2013-4-1 18:23 编辑
void io_spi_write_addr(unsigned char tmp)
{
unsigned char addr;
unsigned char i;
addr = tmp;
FP10M = 1;
FP11M = 1;
clk = 1;
for(i=0;i<8;i++)
{
clk=0;
if((addr & 0x80) ==0x80)
sdio = 1;
else
sdio = 0;
addr<<=1;
clk=1;
}
}
void io_spi_write_data(unsigned char tmp)
{
unsigned char data;
unsigned char i;
data = tmp;
FP10M = 1;
FP11M = 1;
clk = 1;
for(i=0;i<8;i++)
{
clk =0 ;
if((data & 0x80) ==0x80)
sdio = 1 ;
else
sdio = 0 ;
data<<=1;
clk =1;
// _nop_;
}
} |