SCK and SCL are the same thing, but SCK is for SPI (i.e. 3-wire comms) and SCL is for I2C (i.e. 2-wire comms). On the 18F4580, both I2C and SPI hardware module share the same pins (RC3/SCK/SCL, RC4/SDI/SDA, RC5/SDO; third pin is only used for SPI comms). The hardware module on the PIC is called MSSP (Master Synchronous Serial Port) and is configured to support either I2C or SPI communications, but not both at a time.Is SCK and SCL the same thing ? and how would I connect / configure both devices to function?
PBP's I2C routines are software-based (i.e. they do not use the MSSP) so they can be used on any I/O pins. PBP does not have a hardware based (MSSP) SPI routine either. But you can use SHIFTOUT to create software-based SPI communication. Downside of using software-based serial comms (either RS-232, I2C or SPI) is that while the communications are active, the PIC is doing nothing else. PBP has an example of using the hardware MSSP module to perform SPI communications (http://melabs.com/resources/samples/pbp/spimast.htm).
Your best option is to re-allocate your I2C connections somewhere else (PBP's I2C commands should work on any I/O), and use the hardware MSSP (RC3, RC4) for SPI communications.
Bookmarks