用合泰单片机HT66F70A 在写SPI的读取字节函数时,发现temp_send_data无法赋值给_simd 寄存器,大家知道怎么回事不阿?
unsigned char SPI_ReadWriteByte(u8 data)
{
volatile u8 temp_receive_data;
volatile u8 temp_send_data;
do {
_wcol = 0; //wcol=0 WCOL:SPI 写冲突标志位
temp_send_data=data&0xff; //get 8 bits
_simd = temp_send_data; //write data into simd
_clrwdt1(); //clear wdt
_clrwdt2();
}while(_wcol == 1); //data is transferring?
while(_trf == 0) //spi data transfer is completed?
{
_clrwdt1(); //clear wdt
_clrwdt2();
}
_trf = 0; //clear trf
temp_receive_data = _simd; //read data from simd
return temp_receive_data;
} |