>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >On Behalf Of Rich >Sent: 27 July 2007 02:27 >To: Microcontroller discussion list - Public. >Subject: [EE] Software SPI > > >Has anyone created a software SPI? SPI is trivial to bit bang compared with e.g. I2C. However, note that there are four possible timing/polarity variations with SPI, and most peripherals only support one. The data can be clocked on a positive or negative edge, and on a trailing or leading egde so you have to make sure you set up the data at the right point. The PIC datasheets usualy have a diagram explaining this in the MSSP section. For the highest possible speed, don't use a loop but clock out each 8 bits with separate instructions (i.e. unroll the loop). This has only a small code size overhead but can give a good improvement in bit rate. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist