Eric Peterson

spi data register

Discussion created by Eric Peterson on Apr 22, 2006
Latest reply on Apr 24, 2006 by Jeff Smith
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.