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 support@ccsinfo.com

i2c master and slave logger: Multi-byte

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



Joined: 28 Mar 2015
Posts: 1

View user's profile Send private message

i2c master and slave logger: Multi-byte
PostPosted: Sat Mar 28, 2015 8:10 pm     Reply with quote

WORKING I2C MASTER AND SLAVE LOGGER : MULTI-BYTE
http://www.ccsinfo.com/forum/viewtopic.php?t=21456

Hi all!,

I know that this is an old thread, but I hope that someone can help me. I am working with two PIC16F876A, one Master the other slave. Trying the code (changing the clock speed to 4MHz and including delays), if I enter any 16bit value, after the last digit i get the message "debug 1". If then I press Read, I get Value=0000 and "debug state 4 and 5. If I change the clock back to 20MHz then after writing a value I get "debug 5" (assume Ok?) but on reading the error message comes up. I am afraid I know very little about microcontrollers, only have made small projects so I am very sorry it. Can anyone tell me what I am missing?
Basically my project is as follows: on powering up both PICs, the slave must send 8 int16 values to the Master that he needs to do some stuff. Eventually the Master would send back another int16 result to the Slave. After finding this post I thought that I could modify it to get my goal.

I hope you can help, many thanks in advance!
temtronic



Joined: 01 Jul 2010
Posts: 9174
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Mar 29, 2015 5:29 am     Reply with quote

Why not just use the CCS supplied I2C functions ????

I'm NOT convinced his 'working code' actually works and in the time it took me to read it, I could have cut code using the I2C functions from CCS.

Also, why use 4Mhz clock? A 20MHz xtal is the same price and will give you 5 x more speed, allowing the PIC to do more !

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19371

View user's profile Send private message

PostPosted: Sun Mar 29, 2015 5:45 am     Reply with quote

The code dates back ten years, to when there were problems with the I2C functions. For anything after perhaps the last eight years or so, the CCS functions have worked, and worked better.
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