Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Easy serial interface between PICs

Status
Not open for further replies.

rgc

Junior Member level 1
Joined
May 3, 2011
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,430
Hey there!
I have a master (PIC18F4550) that I want to communicate with several slaves (16F628A and 12F683) in the simplest possible way, I surely don't care for speed or any other luxury, all I want is that it takes as little effort as possible, the project is already too complex and I'm also running low on program memory.
Due to the 12F683 low pin count, I only have 2 wires available. Also, since I'm interfacing the master with the PC via USB, I heard the built-in UART is off the table (is that true?)

What do you suggest?
 

I2C is a two-wire protocol where a master can communicate with several slaves - have a look at Microchip's application node AN982
**broken link removed**
 
  • Like
Reactions: rgc

    rgc

    Points: 2
    Helpful Answer Positive Rating
hi,

i2c communications is used as single master & multi slave send & receive data to other one.
 

I2C is a two-wire protocol where a master can communicate with several slaves - have a look at Microchip's application node AN982
**broken link removed**

That AP is for interfacing an EEPROM IC with a PIC 12F, would it work just the same with two PICs? Isn't I²C a little too complex?
 

That AP is for interfacing an EEPROM IC with a PIC 12F, would it work just the same with two PICs? Isn't I²C a little too complex?
it would work the same with two PICs except that instead of an EEPROM a PIC would be programmed as a slave.
I2C is complex but you require a master with a number of slaves over two wires.

RS485 may be an alternative
https://en.wikipedia.org/wiki/RS-485
 
  • Like
Reactions: rgc

    rgc

    Points: 2
    Helpful Answer Positive Rating
why can't you select pic 16f its has inbuilt eeprom

The 12F683 also has inbuilt EEPROM, doesn't it? I have a bucketful of 12F683's, and I don't want to buy any more MCU's. Also, the 12F have a good size that would fit the small board I intent to build.

RS485 may be an alternative
Humm... Interesting. After some reading I'm pending towards RS485, it seems simpler to implement and the maximum distance of the I²C is below that of my application.
Is there a library or tutorial or something that teaches how to implement the RS485, I'm pretty new to MCU's and every little thing takes me quite some effort.
Also, can I implement RS485 without any other IC's but the MCU's? Space and cost are kind of an issue here...
 
Last edited:

Is there a library or tutorial or something that teaches how to implement the RS485, I'm pretty new to MCU's and every little thing takes me quite some effort.
Also, can I implement RS485 without any other IC's but the MCU's? Space and cost are kind of an issue here...
have a look at Microchip's application note AN774
**broken link removed**
 

This may not work but have you tried UART with a address header? You could send one byte as the address, then the second as the data, and just keep repeating that. It may be inefficient, but may work, seeing your requirement of low device count.
 

All very sound suggestions that I will try soon! But just for argument's sake, if I were to switch from the 12F683 to the 16F684, with now 6 free pins for communication, what stupidly-simple way of serially communicating it with the 18F would you suggest? I'm looking for simple to implement protocols that don't need extra IC's...
 
Last edited:

I highly suggest moving to a chip with I2C. Microchip has libraries for communicating with it, and it isn't very complicated if you are going to use a single master architecture.
 

I highly suggest moving to a chip with I2C. Microchip has libraries for communicating with it, and it isn't very complicated if you are going to use a single master architecture.
All the MCU's involved have I2C. What would be ideal to me is a tree-like architecture, where a node is a master to a few others below him, but a slave to a higher node. Is that too hard to implement?
 

Only an I2C master can initiate a transfer and drive the clock line (SCL), an I2C slave can only respond to a transfer initiated by a I2C master.

Normally an I2C bus is composed of one master and one or more slaves. There are devices which support a I2C multimaster configuration, however the protocol is complex and not supported by all devices.

An important issue concerning I2C is capacitive loading, which can determine bus speed, length and limit number of attached devices.


The following is an example of using an I2C bus for communication between two PICs as well as a few tutorials covering I2C:

I2C communication between PICs



I2C Primer

Using the I2C Bus


BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top