Software SPI

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!

Reply to
terry
Loading thread data ...

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
Reply to
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

Reply to
Leon Heller

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
 Click to see the full signature
Reply to
Tauno Voipio

Polling? Why not interrupt-on-change?

Reply to
Lewin A.R.W. Edwards

Thanks!

Reply to
terry

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

Peter

Reply to
Peter

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.