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.
Your remark is correct! there are two data register physically separated. therefore it's normal that the value I wrote in SBUF was different of the value I read. So do you think that SPIDAT = SBUF is correct ?
"So do you think that SPIDAT = SBUF is correct ?
Have you found any errata for the processor saying that the UART is broken, and that it isn't possible to read from SBUF?
Have you found any errata for the processor saying that the SPI device is broken, and that it isn't possible to write to SPIDAT?
Exactly why do you question the possibility of reading from SBUF or writing to SPIDAT? Do you think the UART have special tracking to know where the data read from it is sent? Do you think the SPI device has special tracking that checks where the data to send comes from?
Don't you think you should take two steps back and find other ways to figure out why your code and/or hardware doesn't work as expected, than questioning if the processor has a serious design issue?
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.
For information, the hardware work well, it's an Analog Devices kit (EVAL-ADF70xxMBZ2). The problem is certainly my code!