I have been trying to interface a sensor that uses an SPI interface to the RC. I know the actual SPI bus on the PICs is used by IFI - this is how the two PICs communicate. However, C18 has a set of "Software SPI" functions that use digital input pins to emulate SPI (C18 Library Manual, p.121).
I looked at the default values for the SPI pins in the manual. They appear to correspond to digital inputs 1, 2, 5, and 6 on the RC. I connected the sensor to these pins, included the sw_spi.h header in the project, and tried to talk to the sensor.
For some reason I cannot get the data out of the sensor. I either get all 1, or all 0 in a byte

No real data.
I am suspecting a conflict with the default FIRST code. The function that initializes the SPI, OpenSWSPI, is supposed to set up the pins correctly. Could it be that the FIRST library is conflicting with this? I tried to remove all lines that referenced the pins I am using from the default code. Didnt help.
Also for some reason if I change the pin assignment in sw_spi.h in the mcc18 folder the program does not build properly. Do I have to recompile something or include any other files in my project?
Did anyone use the software SPI functions? Or the software I2C which should be close to what I am doing?