Software SPI

Nov 15, 2004 6 Replies

Hi,



Could anyone give me AVR source code to implement SPI by software? I need it because I want to have SPI and also external interrupt on ATTiny22. But the pins are overlapped if the two functions are used.



Thanks!


Atmel has an app. note with software SPI receive. I modified it for transmit using a '2313, and it worked fine, communicating with a PIC with hardware SPI.

Leon

Leon Heller, G1HSM http://www.geocities.com/leon_heller

Sorry, that should read SPI master instead of SPI receive. I actually modified it for slave operation, with a PIC SPI master.

Leon

Please note that a software SPI slave is in a very difficult timing position: all transfers are timed solely by the master and the slave must be fast enough to keep up, This will usually mean thet the slave has to use most of the processing time polling the SPI clock.

Tauno Voipio tauno voipio (at) iki fi

Polling? Why not interrupt-on-change?

Probably because the original poster wanted to use the interrupt for something else. Sound like he needs to rethink the problem.

Peter

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required