Quote:
|
Originally Posted by Greg
Did anyone use the software SPI functions? Or the software I2C which should be close to what I am doing?
|
I have never used the c compiler SPI functions, but I have done firmware Serial Port Interface in assembly on a pic16 series processor. I used it to connect to a digital pot. Depending on what you are doing, my advice is to simply write the software explicitly. SPI is a very simple protocol. The meat of spi is between clock and data pin. Check whatever you are connecting to, if it reads the data pin when your clock pin equals 1, the rise of the clock or cycle, then set what the next bit is when you toggle the clock to 0. Toggle the clock pin 16 times, 8 toggles to value 0 and 8 to value 1, to transmit a byte.
Make a function to do a byte at a time. It shouldn't take more than a half hour to set this up. Most intermediate programmers can do it in several minutes for simpler SPI interfaces.
There is normally a select pin to indicate when the device is reading. Bring that low, set it to zero, for the duration of the communication. Assuming I didn't forget anything critical, it's been a while, that should all there is to most SPI communications.