# Atmega16 SPI to clock out 32bit data

I am very new to AVR and even for coding of micro-controllers. I wanted to shift out 32 bit data on SPI from a Atmega16 to a 32 bit shift register. The shift register in not an SPI compatible device. But still hope to use to get the fast transmission.

Since the AVR is having only 8 bit data register, only one byte of data can be written on it. So I need to shift our 32 bits of data. I am able to do the same like making SS# low->load first byte of data->wait till transmission complete->make SS# to high to latch the data. I am doing it four 4 times and getting the 32 bit output. But the issue here is the clock is not continuous, for each byte there is a delay between the clock burst. In this this case the external shift register will not get the 32 bit continuously since for every byte I am doing the SS# low and high. I need to get the complete data packet continuously with out any break. I am digging further into this to resolve.

It would be helpful for me in the meantime if someone can share any idea.

Regards, Prabhu

You could keep the current desired state of the shift register in a single uint32_t variable. Each time when there's the need to change the shift register's output you modify the variable accordingly and then send the whole 32bits; that is, always send all 32bits, even if only one bit changes. This way, you will have a consistent representation of the state of the shift register in memory and don't have to worry about which byte/bit to send when.