|
Mezon,
I am not sure which Encore part you are working with, however, on the I would check for Receive Data Register Not Empty instead of Transmit Data Register Empty.
Typically when I do an SPI_Send() for the ESPI parts:
//Assuming SS select is already selected
void Send_SPI()
{
ESPIDATA = i;
while ( (ESPISTAT & 0x80) == 0); //wait for it to transmit
while ( (ESPISTAT & 0x04) == 0); // and receive gets populated from loop
}
To implement the SPI with interrupts, see associated product specifications for information on how to enable the interrupts for the family you are using, write your interrupt handler to handle the interrupts.
|