PIC to PIC communication requirments

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

PIC to PIC communication requirments

Post by liak » Mon Aug 25, 2008 3:43 pm

Dear all,
I am striding into new areas in my project. :lol:
As my project expands, so is the requirement on the computational power. Now, there is real need for me to start thinking about using multiple PICs. But I have no experience in this.
I will need to divide tasks in between the different PICs, possibly transfering data from a master to slaves and synchronize the operation of multiple slaves by the master.
The other architecture that I can think of is to let the individual PICs to do their own tasks until complete and then synchronize their outputs. Can anyone show me some hints or basics on how to communicate between multiple PICs in the most efficient way?
Anyone can offer any experience or show me some sites with these information?

Regards,
Liak :wink:

richardb
Posts: 306
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Tue Aug 26, 2008 9:42 am

out of interest what speed are you running your pic at?.
Hmmm..

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Wed Aug 27, 2008 4:14 pm

Dear Richard,

Thanks for the reply.
The current single PIC runs at 20Mhz. I plan to chain a few of them together to run at at least this speed, and hoping to be able to transfer data or synchronize them at this speed.
Any particular reason that this is of interests?

Regards,
Liak

richardb
Posts: 306
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Thu Aug 28, 2008 7:12 am

I apologise for not answering your question directly. but maybe you don’t need to go to the complexity of multiple pics when one would do. The one you are using will almost certainly run at 40MHz microchip already do some that run at 64Mhz, that maybe pin compatible(@3.3V) with the device you are using. This would be equivalent to 3 of your pics. Changing some of your algorithms may have an even bigger impact.

Getting back to what you asked originally.

It really does depend on how much data is being sent how often you’re communicating, and how many pins you have free.

Rs232 is probably the lowest pin count if you can get away without any extra handshaking. If you use an extra transistor per pic you can fan in./out to from multiple pics.

Using spi if probably the best compromise of speed and pin count you just need chip select to decide which pic the master is talking to.

Richard
Hmmm..

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Thu Aug 28, 2008 7:39 am

richardb wrote: Rs232 is probably the lowest pin count if you can get away without any extra handshaking. If you use an extra transistor per pic you can fan in./out to from multiple pics.

Using spi if probably the best compromise of speed and pin count you just need chip select to decide which pic the master is talking to.

Richard

I personnaly would have said: use I2C or better, CAN bus ! for CAN you can use 18F458 (not too expensive). If you need it at 3.3V you can use LF version of this PIC. With CAN you got low pin usage+noise immunity!

Regards
octal

richardb
Posts: 306
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Thu Aug 28, 2008 8:04 am

Hi Octal,
Does the pic include the phisical layer?, I hadn't even noticed that pics support CAN, Have you used it?

Richard
Hmmm..

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Thu Aug 28, 2008 8:46 am

Hi Richard,
I didn't used them myself, but I have friends who use them a lot (18F458 aspecially) in industrial applications here in France.

You need to use a transeiver after the PIC 18F458. most users use Microchip MCP2551 http://ww1.microchip.com/downloads/en/D ... 21667E.pdf

Floran had also converted sometimes ago the Microchip implementation (Application Note AN738) to Swordfish Basic module (you can find it on modules page - He reported that it worked on his hardware).

http://www.sfcompiler.co.uk/wiki/pmwiki ... ser.CanBus

Regards
octal

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Fri Aug 29, 2008 8:19 am

Dear Richard and Octal,
Thanks for the replies. I will lookup for those materials you have given. I did a survey on the Microchip site. Indeed, the 18K series run on 64Mhz clock on HSPLL mode. However, when I checked on the supported device list in SF, these devices are missing. I am wondering:

1. What are the special things about the K series and J series from the normal PIC18?
2. Does SwordFish support these devices? What sorts of modification are required? :?:
3. The hardware does seem same like the normal PICs with maybe lower voltage, any changes apart from those required?

Thanks.

Regards,
Liak

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Fri Aug 29, 2008 8:44 am

liak wrote: ...
However, when I checked on the supported device list in SF, these devices are missing. I am wondering:

1. What are the special things about the K series and J series from the normal PIC18?
2. Does SwordFish support these devices? What sorts of modification are required? :?:

...
Liak
Hello,
K series are supported, and are compatible with 18F series.

Check this page ... http://www.sfcompiler.co.uk/wiki/pmwiki ... ionHistory the link for K header files.

You'll find there also the link to the PDF file from Microchip that indicates the differences between K and F series and the migration guidelines.

Regards
octal

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Some further questions...

Post by liak » Sat Aug 30, 2008 9:33 am

Dear all,

I have an embarrassing question to ask; :oops: . I have been considering what richard has said. May be a single PIC will be adequate for my application. Now, just if I can do this task below. I am not sure if there is a way to achieve this or I am just making myself look foolish.
Now, the stupid question. Is it possible to make a few devices share the output from a same pin, given that the output to all these devices are the same, let's say a clock signal? Because I have on hand a few devices running at the same clock speed and to be synchronized. So the most convenient thing to do is to make all of them running on the same clock signal from a same port. I wonder if this is possible. If not what sort of hardware modification can be made to implement this.
Tell me if I have asked a stupid question. Thanks.

regards,
Liak :oops:

richardb
Posts: 306
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Sat Aug 30, 2008 8:25 pm

you probably need to tell us what part your trying to connect.

Richard
Hmmm..

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Sun Aug 31, 2008 1:34 pm

Dear Richard,
To clarify myself further. Now what I intend to do is to connect a single PIC to control multiple of my output devices. These devices are controlled by serial data. So I am wondering is it possible for all these devices to share a clock signal generated from a single pin on the PIC? Diagramatic wise:


PIC Pin PortB.3 Clock -------------> Device 1
|___________> Device 2
|___________> Device 3
|___________> Device N
I am sorry that I am not that good in electronics. I am not sure if this is feasible with PIC?

Thanks.

Regards,
Liak

richardb
Posts: 306
Joined: Tue Oct 03, 2006 8:54 pm

Post by richardb » Sun Aug 31, 2008 2:30 pm

sorry i dont understand. you talk about serial and clock.

do you mean Asynchronous like rs232 or synchronous like spi or PWM like a servo motor ?.


maybe you could give us and example of the type of device that you are trying to connect to your pic, even if it isnt the actual device.

Richard
Hmmm..

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Wed Sep 03, 2008 5:03 am

Dear All and Richard,
Sorry for confusing you further. Maybe I am not good in asking this. My device runs on SPI. I am asking this because, if I can somehow, connect all the parallel output devices, to sharing the same clock pin, then I can save some pins and comp time. Maybe I can illustrate my case better by some coding similar to below:

Code: Select all

Public Dim ClockPin as PortB.3
Public Dim DataPin1 as PortC.2
Public Dim DataPin2 as PortC.3
Public Dim DataPin3 as PortC.4
...
...

Sub SendData()
Dim Counter as Byte
For Counter = 1 to MaxBit
     Low(ClockPin)
     High(DataPin1)
     High(DataPin2)
     High(DataPin3)
     High(ClockPin)
Next Counter
End Sub
Rather than, having to code each separate ClockPin

Code: Select all

Public Dim ClockPin1 as PortB.1
Public Dim ClockPin2 as PortB.2
Public Dim ClockPin3 as PortB.3
So I save some on the ClockPin as Device1, Device2 and Device3 run on same pace.
Please tell me if I have asked something stupid or this is not possible. Thanks.

Regards,
Liak :oops:

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Wed Sep 03, 2008 6:29 am

I think that this should be possible.

Post Reply