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

How to copy SBUF in SPIDAT

Hi everybody !

I'm currently working on a project with a ADuC847 and I would like to copy the content of SBUF (data register of UART) to SPIDAT (data register of SPI).
Here is a part of my code:

T3CON = 0x83; //9600 Baud rate

T3FD = 0x12;

SCON = 0x52; // UART enable, variable baud rate.

SPICON = 0x2C; // SPI enable, slave mode

while(!RI); //interrupt flag of UART (Set when SBUF is full)

if(ISPI==0 && RI==1)

{ SPIDAT = SBUF; // This line doesn't work. Value is still egual to 0

value = SPIDAT; }

RI = 0; ISPI = 0;

Someone would have any idea ?
thanks in advance,

Guillaume.

Parents
  • I'm not telling that the processor has a serious design issue !
    But I have to send data which come from the UART and send them via the SPI. I just want to create a "link" between UART and SPI. I guess that I have to do this with the two data registers SBUF and SPIDAT. I'm right? I absolutely do not question the processor.

Reply
  • I'm not telling that the processor has a serious design issue !
    But I have to send data which come from the UART and send them via the SPI. I just want to create a "link" between UART and SPI. I guess that I have to do this with the two data registers SBUF and SPIDAT. I'm right? I absolutely do not question the processor.

Children