Sonsivri

Electronics => Pic C Languages => Topic started by: stefan_85 on January 18, 2008, 07:06:58 19:06



Title: Communication between PICs
Post by: stefan_85 on January 18, 2008, 07:06:58 19:06
Hi,

I'am trying to make a connection between several pic's. I already used this technique with microcontrollers from Echelon. This system is based on a netword with many microcontrollers performing a single task. Now I wanted to do the same with microcontrollers from microchip.  I don't really know how this works, shouw i use i2c or uart or something else?

Thanks


Title: Re: Communication between PICs
Post by: respected on January 18, 2008, 07:18:55 19:18
you can see CCS Compiler example


Title: Re: Communication between PICs
Post by: mayler on January 19, 2008, 07:23:14 19:23
The I2C is a good protocol because you can have a master and 100+ slaves in same bus and you use only 2 wires. I think i2c its the best option for your problem.


Title: Re: Communication between PICs
Post by: fool_453 on January 20, 2008, 09:22:07 21:22
Hi,

I'am trying to make a connection between several pic's. I already used this technique with microcontrollers from Echelon. This system is based on a netword with many microcontrollers performing a single task. Now I wanted to do the same with microcontrollers from microchip.  I don't really know how this works, shouw i use i2c or uart or something else?

Thanks
ic


Title: Re: Communication between PICs
Post by: stefan_85 on January 20, 2008, 09:56:44 21:56
I used i2c for accessing memory en an DAC but I have never tried it between microcontrollers. I know that one of the devices is master and the other is slave. The problem is that I don't really know how to make this bi-directional. And I never tried to set a pic as slave.

But what do you mean with ic, fool_453?

thanks


Title: Re: Communication between PICs
Post by: edi14_10 on January 21, 2008, 02:23:08 02:23
I prefer use the UART rather than I2C to comunicate two microcontrollers. if u use the I2C, the slave will act like I2C eeprom.


Title: Re: Communication between PICs
Post by: phu_thanh on January 21, 2008, 10:29:39 10:29
There are some PIC MCUs which have CAN protocol that you can use to communicate between Pic MCUs or any other MCU that support CAN protocol. I have been using this protocol on dspic30f6014A to communicate to other pic mcu. It worked well for me. dspic30f6014A has high pin count (80 pins). dspic30f2014 also support CAN protocol, it has low pin count(28pins) in SOIC.package.


Title: Re: Communication between PICs
Post by: robban on January 21, 2008, 01:13:47 13:13
This can be done. F.ex. the PIC 16F877 use port D, parallell pins psp0 through psp3. It's tricky and You don't always get the expected results. To be sure, use assembler and control the signals Your way...


Title: Re: Communication between PICs
Post by: leonardoaraujo.santos on January 24, 2008, 05:08:50 17:08
Hi I've used I2C to perfom some kind of PIC network... But the problem is... Just one pic was a master... The other PIC's were slaves... I mean the master PIC continually polls for some information...

If you like i could send you some CCS code doing this


Title: Re: Communication between PICs
Post by: martinisonline on January 27, 2008, 09:37:25 09:37
It depends on what PICs you are using!

Most of them have dedicated hardware that implement the protocol!.

First you must decide about some aspects:

Speed of comunication;
Number of wires needed;
how many pics you wanna connect;
how efficient must be the system!

after you think about these answers,  then you can select the protocol you may use:

I2C, SPI, RS-232, CAN, LIN


Title: Re: Communication between PICs
Post by: neer4evr on January 27, 2008, 11:42:40 11:42
I would prefer to use I2C, coz here we have an address for each target. Whereas if we use serial communication we will have to assign addresses in software. I may be wrong but this is what i feel.  :)


Title: Re: Communication between PICs
Post by: bliviudaniel on January 28, 2008, 09:30:41 09:30
If the communication speed it is not critical, use I2C. I made communication between PICs and I used I2C. The advantage is that is not very complex protocol(like CAN) and you can create a network of PICs if you will ever want to extend you application.


Title: Re: Communication between PICs
Post by: strolch on January 29, 2008, 03:23:44 15:23
I like the MODBUS-Protocol.
It is easy to implement and to debug (by PC).
You can use HMI (Bejer Elektronic) to display data.
One of the PICS must be the Master!

 Greetings

Michael


Title: Re: Communication between PICs
Post by: edi14_10 on January 30, 2008, 03:40:08 15:40
How far is the distance if I communicate two or more PIC microcontroller using the I2C?


Title: Re: Communication between PICs
Post by: mayler on January 31, 2008, 12:39:02 00:39
With the specs I have here... The I2C range is about 18 feet ( 6 meters ), but I dont know if they updated this value in new devices.


Title: Re: Communication between PICs
Post by: ugur on February 05, 2008, 01:29:32 13:29
i think i2c is the best solution to comunication for several pics.


Title: Re: Communication between PICs
Post by: swapgo on February 07, 2008, 10:29:20 10:29
Hi,

       I suggest to go UART with RS-485. It will be easy and the communication length can be more. You can even think of CAN also.

Thanks
Gopi


Title: Re: Communication between PICs
Post by: pinoytsikboy on February 21, 2008, 02:01:01 02:01
Guys,

If you're still interested in PIC communications, check out this link. This project uses master_slave configuration on 2 PIC18F452 using the serial peripheral interface (SPI).  They used Hitech C compiler. Hope this helps

http://users.ece.gatech.edu/~hamblen/4006/projects/bluebot/reports/finalpaper.html


Title: Re: Communication between PICs
Post by: xfx7950 on February 27, 2008, 02:11:31 14:11
good info

Posted on: February 27, 2008, 02:58:01 14:58 - Automerged

agree that


Posted on: February 27, 2008, 03:08:44 15:08 - Automerged

I will try this too


Title: Re: Communication between PICs
Post by: endSly on March 01, 2008, 05:44:58 17:44
SPI also support master and multiple slave and is faster