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.

Need simple question with I2C code!

Status
Not open for further replies.

milem

Newbie level 6
Joined
Mar 11, 2008
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,382
I need to know on what speed microkontroler 89S52 (24.000 MHz oscilator)
will communicate trough I2C bus using given code in atachment!
 

Hi,
This I think it is not as simple a question as mentioned. However, the fastest duration at which data bits are shifted out will be decided by the execution time of the loop:

scl=0;
HOLD;
sda=MSB;
a<<=1;
_nop_();
scl=1;
HOLD;
scl=0;

Similarly, while receiving data, the execution time of the loop
sda=1;
scl=1;
HOLD;
LSB=sda;
if(i<7)
a<<=1;
HOLD;
scl=0;
HOLD;

will decide the time to receive each bit.

Hope it makes some sense to you.

Regards,
Laktronics
 

Thanks for response, but!
Your response didn't help me!
I already know speed is coming from that loops, but i don't know how to calculate
that!
I don't know how long is single instructions are executed!
Does any know how to calculate that?
 

best way to calculate real speed is, togle pin before and aftre the loop and use oscillscope to find pulse duration ..... i hope it will work
 

That's good idea!
But i don't have good osciloscope to measure that! Thanks!

In short i need only to know are speed is under 400kHz!
 

u can the try hit and trail method ..... if I2C works without delay its ok ...... if not then put delay steadly bw loop untill it start work ...... or use simulator.
 

Hi,
Yes, the speed will be under 400KHz, since the clock Hi/Lo each has a 'Hold' delay which is equal to 3 NOPs and at 24MHz clock it works out to 1.5microsec. So, the maximum clock rate will be below 333kHz.

Regards,
Laktronics
 

Keil has an excellent simulator. If you simulate the code, you will be able to see processor cycles, exact time period between clock cycle etc. Just calculate the frequency from time duration.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top