写了一个通过MSP430
单片机SPI口读传感器数值的函数,但是在寄存器UCA1RXBUF中看不到数void LSM330DLC_SpiSend_CMD_One(uchar Reg)
{
while (!(UCTXIFG & UCA1IFG));
Reg |= 0x80;
UCA1TXBUF = Reg;
}
uchar LSM330DLC_SpiRecive_Data(uchar Reg, uchar data[])
{
uchar i;
uchar len = 8;
LSM330DLC_SpiSend_CMD_One(Reg);
delay_us(10);
for(i=0;i
{
if (UCRXIFG & UCA1IFG)
{
data
= UCA1RXBUF;
}
else
{
return FALSE;
}
}
return TRUE;
}
当调用这两个函数读取寄存器数值时,UCA1RXBUF寄存器中总是0,哪位能帮忙看一看呢?多谢了!!!