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

Questions regarding "Mark's" I2C communication rou

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



Joined: 16 Apr 2005
Posts: 23

View user's profile Send private message

Questions regarding "Mark's" I2C communication rou
PostPosted: Sun Dec 10, 2006 9:40 am     Reply with quote

[Note: the link to the code is here]

Hi, first off, this code is pretty impressive.
As you probably know, its quite hard to interpret other people's code. So far I have it basically working with a 18f2520 as a master and a 16F88 as a slave, and I have also tested it the other way round, so it does work as a multi-master solution.

The only problem lies somewhere within the 16f88 code, when in the section where you interpret the input commands ( I2C_Process_Message() ), after the example blink_led function, a command to send a message back to blink the original senders LED. I.e.
Code:

if (PORTAbits.RA0) output_low(PIN_A0);  // Slightly changed so when the command is sent, it just inverts the LED
else output_high(PIN_A0);
Blink_Back_LED(0x6E, 14); // Send a I2C message back to the "master" Pic.


Basically, when it comes round to actually sending the new message back via the tasks routine, then into the Tx routine, it does not send the message because the SDA line is still low (active state) (i.e. it hasnt been reset to the high impedance state), and returns a collision error.

Now, if I remove the blink back LED routine, and run it normally (no debug) then the line does return to the High Z state, eventually (note it is not quick enough to send the message). BUT, if I debug (the slave) it and step through the code (breaking just after it has recieved the full message), the LED comes on ok (on the slave) and the line NEVER returns to High Z; even if I set it to run again.

I am using Hardware on the 18F and software on the 16F.

Any Ideas/Questions?

Cheers,

Phil

P.s. It is also tested to have happened the other way round. it fails at this point (when stepping)
Code:

    if (I2C_State != I2C_IDLE)
      return(FALSE);
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