spi data register

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

spi data register

2,235 Views
lssuer
Contributor I
I am trying to send data from one hs12 to another hs12using spi and whenever i write the data to the SPI0DR it doesnt work. It looks like the data never gets written to the register.

Here is my routine firs the setup then the send



void init_spi(void){
DDRS = 0xE2;
SPI0CR1 = 0x50;
SPI0CR2 = 0x00;
SPI0BR = 0x00;
}

void data_transfer(void)
{
// Declare Variables
for (i=0;i5;i++){



PTH &= 0x7F;
SPI0DR = data_array[i];
while (!(SPI0SR & 0x80));
PTH |= 0x80;
}
}

can anybody see or know any reason why this wouldnt send the data or copy the data into the SPI0DR register to be sent.

thanks
Labels (1)
0 Kudos
1 Reply

351 Views
imajeff
Contributor III
Some pointers:

1. The code you posted won't compile, so I know you have not tested it in a simple form.

2. Your selected baud rate is rather fast. Try a fairly slow rate just to make sure that's not the problem.
0 Kudos