Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C Communication Help

Status
Not open for further replies.

faizanbrohi

Newbie level 5
Joined
Apr 1, 2006
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,349
HEllo everyone . Does anyone has software I2C Code Compatible with the CCS C Compiler. or the PicBasic Compiler . I want to use I2C Master. Thank you
 

faizanbrohi said:
HEllo everyone . Does anyone has software I2C Code Compatible with the CCS C Compiler. or the PicBasic Compiler . I want to use I2C Master. Thank you
Have you looked through the examples of CCS C, and the I2C built-in functions in CCS C help?

Cheers,
 

Actually the examples implement Hardware I2C , i want to use Software I2C for PIC16F84A.
 

chk this out...

i guess the given code is working...


cheers,
tom
 

faizanbrohi said:
Actually the examples implement Hardware I2C , i want to use Software I2C for PIC16F84A.
Right,

Google for 'I2C bit-banging'. I have found one or two examples, but they are all gone because of a hard drive crash. Good luck!

BTW, be more specific next time (say exactly what you want).

Cheers,
 


About the bit-banging example in the first link, it's ok with C18 compiler, but needs to be modified for CCS C.

In CCS C, we use
Code:
#define SCL_IN  PIN_B4
instead of
Code:
#define SCL_IN  RB4

CCS C has set_tris_x() functions (x = A, B, C, ...) for setting TRISx registers. For bit manipulation, you would need to do something similar to the above. Try the following:

https://www.ccsinfo.com/forum/viewtopic.php?t=19185&highlight=i2c+bitbanging

Cheers,
 

Well thanks namqn for the reply . really helpful . i will implement the techniques u highlighted . i will keep you updated . and the link that you gave it is for the Slave implementation of I2C i think. Thank you.
 

Please see
h**p://mcu-programming.blogspot.com/2006/09/ic-bus-interfacing.html

for i2c C Code.

The link does not work.

One more thing how would i determine the speed of the software I2C.
 

faizanbrohi said:
One more thing how would i determine the speed of the software I2C.
By timing the cycle time of your clock line SCL (how many machine cycles for one period of the SCL line, and the time for one machine cycle).

Cheers,
 

faizanbrohi said:
Please see
h**p://mcu-programming.blogspot.com/2006/09/ic-bus-interfacing.html

for i2c C Code.

The link does not work.

One more thing how would i determine the speed of the software I2C.



It is work now.
 

Please see
h**p://mcu-programming.blogspot.com/2006/09/ic-bus-interfacing.html

for i2c C Code.


The link does not work.

One more thing how would i determine the speed of the software I2C.




It is work now.

It does not work now also . can you cache the page , i mean can you upload the page on megaupload .www.megaupload.com . put the site in a zip file.

Thanks for the reply namqn
By timing the cycle time of your clock line SCL (how many machine cycles for one period of the SCL line, and the time for one machine cycle).

But it is a little bit complicated for a beginner . can you elaborate it a little. can you tell me how to change/control the clock time of SCL.
Thanks
 

dear friend
plx look to this site i hope it can help !!

**broken link removed**
thank
buntheun
 

faizanbrohi said:
But it is a little bit complicated for a beginner . can you elaborate it a little. can you tell me how to change/control the clock time of SCL.
Thanks
Write your C code for I2C, compile it, simulate it (with MPLAB SIM or CCS's simulator), you should be able to count the number of machine cycles it takes for creating one period of the SCL waveform.

In assembly language, you can calculate that cycle count from the code (if you count carefully). In C, I am not sure if you can do it though, because there are differences in the machine codes created by different C compilers. For C programs, I usually do the simulation, and get the time I want from the simulator's watch.

Cheers,
 

any of members here try to throw a light on my question below:

What is the difference between I2C,SPI,RS232 and UART
explain with specific application if any
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top