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

SPI Communication between Aduc841 and Maxq3183

Hello everybody,
.i'm looking for a code to have spi communication between aduc841 and maxq3183 for my project.i've got some code from internet but nothing is working right for me.
one is :
#pragma DEBUG OBJECTEXTEND CODE // pragma lines can contain state C51
#include <stdio.h> // declarations for I/O functions
#include <ctype.h>
#include <ADuC841.h> // ADuC841 predefined symbols

sbit ss = P1^5; // Chip select for maxq3183 (PORT1.5)
/*******************************************************
Initialize the ADuC841 resouces being used
in this sample
*******************************************************/
void initmaxq3183(void)
{ SPICON = 0x2A;
} void init841(void) // Initialize internal peripherals { /* Initialize SPI to talk to maxq3183 */ CFG841 = 0x10; // Serial interface enable for P3.5..P3.7 pins SPICON = 0x3A; // Enable SPI I/F as master, SCLOCK idle H, // advance MSB output, sclock=fcore/8 }

/*******************************************************
This function transmittes a byte data
on the SPI interface
*******************************************************/

void spiTx(unsigned char txDat) // Transmit a byte data over the SPI { ISPI = 0; // Clear ISPI bit SPIDAT = txDat; while(!ISPI); // Wait until tx complete ISPI=0; }
void spiTxslave(unsigned char txDatslave)
{ ISPI =0;
SPIDAT=txDatslave;
while(!ISPI);
ISPi=0;
CPHA=1;
}

void main()
{

init841();
while(1)
{ spiTx(0x15); //for checking
spiTx(0x12);
}

initmaxq3183();
spiTxslave(0x15); // for checking
spiTxslave(0x12);

}

i was not getting data on SPIDAT reg. also, after checking the signals on miso, it was not coming. need a help form anyone.