CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC TO PIC COMUNICATION

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

PIC TO PIC COMUNICATION
PostPosted: Sat Oct 29, 2005 1:58 pm     Reply with quote

How can i send a variable from one pic to another?
Is rs232 or I2C the better method?
I need an example.
Thanks!!.-
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Sat Oct 29, 2005 3:08 pm     Reply with quote

It depends on the length of your transmission line (in meters), on your desired data rate and directionality of your communication, your constraints such as power consumprion, board size, EMI (including galvanic isolation) and - finally - cost. Tell us more about your application.

Here are a few typical cases (in no particular order):

* A "master controller" and secondary controller(s) on the same board (or at least in the same box without a lot of EMI). I would recommend I2C. Most PICs have a hardware I2C protocol engine, plus I2C doesn't require bus transceivers. There is code for I2C master and I2C slave in this forum.

* Pier-to pier network. Take a look at Controller Area Network (CAN). Again, there is code for CAN comunication in the forum and in the examples. However, CAN requires bus transcievers.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Sat Oct 29, 2005 3:14 pm     Reply with quote

kender wrote:
* Pier-to pier network


You tie your boat to a PIER and you talk to your PEER... Wink
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Guest








PostPosted: Sat Oct 29, 2005 4:16 pm     Reply with quote

I have the two chips in the same board.
this is the code

receiver

#include "mainbalanza.h"
#int_RDA
RDA_isr()
{
printf(LCD_PUTC,"DEBUG";
}
void main()
{
ini();

while(1)
{

}
}

sender

#include "USvar16f627.h"
void main()
{
while(true)
{
printf("%S\n\r","16f627";
}

}
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Oct 30, 2005 7:49 am     Reply with quote

Read the CCS FAQ. It has an example and tells you what CCS example code you can use to implement the example.
Ttelmah
Guest







PostPosted: Sun Oct 30, 2005 7:58 am     Reply with quote

Also look at the threads here, about interrupts, and serial interrupts in particular.
Your receive interrupt _must_ retrieve the character, or it'll sit in a permanent loop, since it'll keep retriggering waiting for the character to be accepted. You are sending 8 characters, and never retrieving any...

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group