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.

Questions about I2C baud rate for PIC18F452

Status
Not open for further replies.

planet69

Member level 2
Member level 2
Joined
Jul 27, 2006
Messages
51
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,288
Location
Malaysia
Activity points
1,551
i'm using PIC18F452 and i've got a question about i2c function.
1) is it true that i can set any fixed baud rate (clock) from 0 to 100KHz?
2) if i set SSPSTAT,SMP=1, what value should i put into SSPADD if i'm using crystal 4MHz?
3) if i set SSPSTAT,SMP=0, is the baud rate fixed to 400KHz or i'm free to set any baud rate from 0 to 400KHZ? what value should i put into SSPADD then using a 20MHZ crystal?

Please help. i want to clear some doubts.
Thank you.
 

Re: i2c baud rate

Hi,

Dont confuse yourself, you can select any value for SMP bit.
but the value to SSPADD should be ,

SSPADD=(FOSC / (4 * BAUD)) - 1;

for Example:
if u want 100khz baud at 10Mhz crystal,

Set SMP bit and
SSPADD=((10Mhz/(4*100khz))-1=(10000/400)-1=24

use the same formula for other frequencies

Regards,
M.Sukumar
 

    planet69

    Points: 2
    Helpful Answer Positive Rating
Re: i2c baud rate

hello i read your question and i have the same project like you and when i connecte a 24cxxx to my pic the 16f877 and i have fixed the rate to 100khz and this rate is fixed by manufactor of the slave for the i2c so you must have the datasheet of your slave and you find the parametre f osc this is the way to fixe the rate
 

Re: i2c baud rate

i think i understand it now.
we can set any baud rate value between 0-400KHZ depending on the SMP bit.
 

Re: i2c baud rate

sukumar said:
Hi,

Dont confuse yourself, you can select any value for SMP bit.
but the value to SSPADD should be ,

SSPADD=(FOSC / (4 * BAUD)) - 1;

for Example:
if u want 100khz baud at 10Mhz crystal,

Set SMP bit and
SSPADD=((10Mhz/(4*100khz))-1=(10000/400)-1=24

use the same formula for other frequencies

Regards,
M.Sukumar
doesn't depend if the mcu is slave or master?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top