Other Parts Discussed in Thread: AFE4490
Hi all,
I have tried to read the 24 bit register of AFE4490 through SPI,How can I effectively done this, I have tried the following method please help to resolve this out.
unsigned long AFE4490_Reg_Read(unsigned char reg_address)
{
P1OUT &= ~ BIT4;
while (!(UC1IFG & UCA1TXIFG));
UCA1TXBUF = reg_address;
while (!(UC1IFG & UCA1RXIFG));
SPI_Rx_buff1= UCA1RXBUF;
while (!(UC1IFG & UCA1TXIFG));
UCA1TXBUF = 0x00;
while (!(UC1IFG & UCA1RXIFG));
SPI_Rx_buff2= UCA1RXBUF;
while (!(UC1IFG & UCA1TXIFG));
UCA1TXBUF = 0x00;
while (!(UC1IFG & UCA1RXIFG));
SPI_Rx_buff3= UCA1RXBUF;
while (!(UC1IFG & UCA1TXIFG));
UCA1TXBUF = 0x00;
while (!(UC1IFG & UCA1RXIFG));
SPI_Rx_buff4= UCA1RXBUF;
P1OUT |= BIT4;
retValue = (SPI_Rx_buff4|(SPI_Rx_buff3<<8)|(SPI_Rx_buff2<<16));
return retValue;
}