stefan_85
Guest
|
|
« 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
|
|
|
Logged
|
|
|
|
respected
Guest
|
|
« Reply #1 on: January 18, 2008, 07:18:55 19:18 » |
|
you can see CCS Compiler example
|
|
|
Logged
|
|
|
|
mayler
Junior Member
Offline
Posts: 68
Thank You
-Given: 14
-Receive: 13
Roger that!
|
|
« Reply #2 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.
|
|
|
Logged
|
Computer Engineer. Digital IC Designer - Cadence certified.
|
|
|
fool_453
Guest
|
|
« Reply #3 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
|
|
|
Logged
|
|
|
|
stefan_85
Guest
|
|
« Reply #4 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
|
|
|
Logged
|
|
|
|
edi14_10
Junior Member
Offline
Posts: 45
Thank You
-Given: 2
-Receive: 7
|
|
« Reply #5 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.
|
|
|
Logged
|
|
|
|
phu_thanh
Guest
|
|
« Reply #6 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.
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #7 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...
|
|
|
Logged
|
Code Warrior
|
|
|
leonardoaraujo.santos
Newbie
Offline
Posts: 10
Thank You
-Given: 0
-Receive: 3
|
|
« Reply #8 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
|
|
|
Logged
|
|
|
|
martinisonline
Inactive
Offline
Posts: 5
Thank You
-Given: 0
-Receive: 19
|
|
« Reply #9 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
|
|
|
Logged
|
|
|
|
neer4evr
Guest
|
|
« Reply #10 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.
|
|
|
Logged
|
|
|
|
bliviudaniel
Newbie
Offline
Posts: 27
Thank You
-Given: 25
-Receive: 9
|
|
« Reply #11 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.
|
|
|
Logged
|
BLD
|
|
|
strolch
Guest
|
|
« Reply #12 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
|
|
|
Logged
|
|
|
|
edi14_10
Junior Member
Offline
Posts: 45
Thank You
-Given: 2
-Receive: 7
|
|
« Reply #13 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?
|
|
|
Logged
|
|
|
|
mayler
Junior Member
Offline
Posts: 68
Thank You
-Given: 14
-Receive: 13
Roger that!
|
|
« Reply #14 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.
|
|
|
Logged
|
Computer Engineer. Digital IC Designer - Cadence certified.
|
|
|
ugur
Newbie
Offline
Posts: 12
Thank You
-Given: 0
-Receive: 0
|
|
« Reply #15 on: February 05, 2008, 01:29:32 13:29 » |
|
i think i2c is the best solution to comunication for several pics.
|
|
|
Logged
|
|
|
|
swapgo
Newbie
Offline
Posts: 8
Thank You
-Given: 0
-Receive: 0
|
|
« Reply #16 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
|
|
|
Logged
|
|
|
|
|
xfx7950
Guest
|
|
« Reply #18 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
|
|
|
Logged
|
|
|
|
endSly
Guest
|
|
« Reply #19 on: March 01, 2008, 05:44:58 17:44 » |
|
SPI also support master and multiple slave and is faster
|
|
|
Logged
|
|
|
|
|