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

--

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 1:27 pm     Reply with quote

Make a test program with a #use i2c() statement in it, and also some
calls to the CCS i2c functions.

Compile it, and look at the .LST file. Normally, this will show register
addresses. If you want to see register names, then go to the Project
menu in MPLAB, and then to Build Options, and then select "Symbolic"
format for the List file. Re-compile and look at the .LST file.
The .LST file will be in your project directory after a successful
compilation with no errors.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 2:40 pm     Reply with quote

That's right. If you're using hardware i2c, then the baud rate generator
is loaded with the appropriate value. If you're using software i2c, then
the routines will be padded with Nop's or delay loops, as needed to make
the correct timing.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 3:57 pm     Reply with quote

Quote:
I just need to find the asm instruction that reads the default SDA pin

If you're using hardware i2c, there is only one SDA pin that can be used.
The pin number is given in the PIC data sheet, assuming that the PIC
has an SSP or MSSP module.

If you're using software i2c, the SDA pin is hard-coded "on the fly" at
compile-time into various places in the CCS i2c library code. There is
no "default location" where you can set the SDA pin. The library code
is not that flexible. It's custom created at compile-time for the pins
that you specify in the #use i2c() statement. It's not changeable at
run-time.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 4:52 pm     Reply with quote

What about this previous you had on the topic ?
http://www.ccsinfo.com/forum/viewtopic.php?t=40656
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 5:20 pm     Reply with quote

Just a few thoughts:
1) An I2C slave in software is difficult. It can be done but will be CPU intensive, so only relative low baud rates are possible.
2) With respect to the above mentioned thread. Why make it difficult to yourself? There are other communication methods that make it easier to split the send and receive, for example UART (RS232/RS485) or SPI.

You have given few details of your system, but I get the feeling I2C is a poor design choice. Here on the forum we like a good puzzle, so if you ask a difficult question you often will get an answer, but this will not necessarily be the best solution for your project. You might consider to take a step back and review the big picture again.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jan 18, 2010 6:00 pm     Reply with quote

Your description is clear.
Looks to me like you are trying to duplicate a wireless Smart Card or Security Card system. This is long existing technology and lots of information is available on the internet. I'm no electronics expert, but my guess is these systems don't use I2C in the transmission link for the same reasons you have discovered. You might want to read up a bit on this.
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