SPI and I2C together

Thread Starter

sarvanan

Joined Aug 8, 2016
45
Hi Friends,

I am working on PIC16LF1939. I am using spi to communicate with another microcontroller.
I have to use I2c protocol to glow the LED's. As PIC16LF1939 has only one MSSP how can we achieve both at the same time?

Please let me know and if possible give an example in 'C' code to achieve it.

Thanks & regards,
Sarvanan.
 

AlbertHall

Joined Jun 4, 2014
12,625
You can bit bang either type of interface providing your program can afford the time.
There is plenty of example code on www. Select the one that fits your requirements best.

I am presently working on code which bit bangs asynchronous serial and a custom serial interface for a sensor chip.
 

JohnInTX

Joined Jun 26, 2012
4,787
+1
FWIW, when I have both I2C and SPI, I bit-bang the SPI and use the MSSP for I2c. SPI is just easier to bit-bang than I2C.
 

MMcLaren

Joined Feb 14, 2010
861
You might consider the 40-pin 16F18877 or 16F15376 devices. Both have two MSSP modules and PPS (Peripheral Pin Select) which make it relatively easy to have hardware I2C, SPI, and Serial running concurrently. The 16F15376 also has a second serial port.

Cheerful regards, Mike
 
Top