hi friends,
I am using the pic16f877a for the RS 485 master slave communication as per the data sheet the SPI or the I2C are the serial communication with the peripherals as a master slave logic, but currently i am using the master slave communication between two pic 16f877a chips, since I need additional I/O ports for my project I am insist to use the expanders MCP23S17, . but I need to connect the master and slave through the PORTC, for RS 485 communication, but the SPI and I2C caonfiguration also in the PORTC , in this case how to manage the RS 485 communication and SPI for the expander at the same time is it possible to use at the same time
thanks
Saran
how to use RS485 communication and SPI expander
-
- Posts: 61
- Joined: Thu Dec 20, 2007 4:23 pm
- Location: singapore
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: how to use RS485 communication and SPI expander
Hello Saran
It depends which chip you are using. Some of the PIC micro devices share the SPI and UART on the same pins. If this is the case for your chip then you will not be able to implement the RS485 and the SPI without bit banging one of the busses.
It depends which chip you are using. Some of the PIC micro devices share the SPI and UART on the same pins. If this is the case for your chip then you will not be able to implement the RS485 and the SPI without bit banging one of the busses.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: how to use RS485 communication and SPI expander
In the PIC16F877a the USART and MSSP (SPI/I2C) are both on Port C, but use different pins, so can operate simultaneously. You only need to route each port pin to the appropriate external device.
You will need to decide between SPI or I2C for the port expander device because these use the same controller and port pins.
Note: The USART and MSSP can not be used simultaneously on all 40-pin PIC devices
You will need to decide between SPI or I2C for the port expander device because these use the same controller and port pins.
Note: The USART and MSSP can not be used simultaneously on all 40-pin PIC devices