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

ADuC842 SPI problems

Hello
Im having some problems with my ADuC842. The SPI doesnt seem to be working, which I just dont understand, because I think ive done everything right...could someone help me for a moment. The SCLOCK always seems to idle..so I can select high or low...and if I say SDATA = 0, then the SDATA out is always low...

heres my short test code:

#include <ADUC842.H>

int i;
unsigned char t;

void main (void)
{ EA = 1;
ISPI = 0; // Init SPI Interupt
SPIM = 1; // Master / slave select (master)
CPOL = 0; // SCLOCK idles low
CPHA = 1; // Trailling SCLOCK edge
SPR0 = 0;
// SPI Bit rate ( OSC /2)
SPR1 = 0;
SPE = 1;

t = 10;

while(1) {

SPIDAT = t; while(!ISPI); ISPI = 0; for(i=0;i<35000;i++); }

}