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

Interfacing two PIC24's together

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



Joined: 22 Apr 2005
Posts: 15

View user's profile Send private message

Interfacing two PIC24's together
PostPosted: Thu Dec 04, 2008 12:14 pm     Reply with quote

Has anyone successfully been able to interface two PIC24 micro's togther using I2C?

I am trying but I have little experience with the I2C protocol. I can find lots of info on interfacing a pic24 with a memory device but not with another pic24.

All I want to do is send data one way (from the master to slave) the slave processor will be idle until it sees data that is addressed to it on the I2C bus and then it will exicute a desired rutine. Any advice would be appreciated.
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Thu Dec 04, 2008 12:41 pm     Reply with quote

Look in your PICC/Examples directory for the file: EX_SLAVE.C

That is an example of the PIC in I2C Slave mode, where the PIC is acting like it is a memory device. Understand that one along with the ones you mentioned of the PIC accessing memory devices. In those cases, the PIC would be the master. You will then have both sides of the code and should be able to get it to work.

I would strongly suggest that you get the PIC accessing a memory device to work correctly first, and understand exaclty what is going on with it. Do not start with code trying to do both sides up front. If your code is working for the master side, then and only then try to get the Slave side to work. Debugging two sides of communication and not knowing which one is failing can be quite a challenge.

Good luck.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
mharris27



Joined: 22 Apr 2005
Posts: 15

View user's profile Send private message

PostPosted: Thu Dec 04, 2008 12:53 pm     Reply with quote

Thanks for the response...I have looked at the .c file that you recommended...the problem is this. The PIC24H256GP210 does not recognize the #INT_SSP or any of the enable_interrupts commands. I have looked thru the header file and they are not listed. It's my understanding that the I2C intrrupts are all automatic for hese micros no?

Thanks,
Mike
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Thu Dec 04, 2008 1:11 pm     Reply with quote

If there is nothing about the interupt enables in the header file specific to your processor, then that would explain the problem. I don't have PCD, so I can't look at the PIC24 header files. Sorry.
If that is the case though, I would suggest you call/email CCS. I have heard there are bugs in the PCD compiler. Perhaps you have found a new one? Sorry I couldn't be of more help. Maybe someone else on the forum is familiar with it.

FYI, in the future, you should always post your compiler version, processor in question, and a code snippet if possible. It can really help in trying to determine what your problem may be.

Good luck.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Dec 04, 2008 2:15 pm     Reply with quote

To learn the expected #int_xxx names with PCD, you should consult the View - Valid Interrupts page in PCWHD IDE. They are e. g. #int_si2c, #int_si2c2 or #int_si2c3 for I2C slave interrupt. I guess, other details may also need to be corrected when porting the said example program to PCD.
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