This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Entering data into SPIDAT register

I am trying to debug some simple code to read and write to the SPI port on an ADuC831.

I can setup the port just fine and send data out. However, is there a way for me to "read in" a value into the SPIDAT register?

Example//
ISPI = 0; //init SPI interrupt
SPIM = 1; //Declare as Master
CPOL = 0; //Idle Clock Polarity Low
CPHA = 1; //Data sent on Leading edge
SPR1 = 1; //
SPR0 = 1; // divide clock by 16
SPE = 1; //activate spi port

while (1)
{
SPIDAT = 0xA0; //send a control byte out
while (!ISPI); //wait until interrupt
i = SPIDAT; // read in value in SPIDAT
}

I am not able to enter in a value for SPIDAT into the SPI Peripheral window. It just keeps reading in i = 0x00.

Any help?

0