Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 10:23:38 10:23


Login with username, password and session length


Pages: [1]
Print
Author Topic: i2c baud rate  (Read 4371 times)
0 Members and 1 Guest are viewing this topic.
planet69
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 5
-Receive: 8


« on: February 27, 2008, 07:26:13 07:26 »

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?

answers are appreciated.
Thank you. Smiley
Logged
tomzi
Guest
« Reply #1 on: March 02, 2008, 01:53:22 13:53 »

hi,
1) i think you can set it
2) value in BRG should be 28h (SSPADD = b'x0101000'
3) i think you can set it, for baud rate 400kHz and xtal 20MHz value in SSPAD should be b'x0110010'
Logged
abbas1707
Junior Member
**
Offline Offline

Posts: 76

Thank You
-Given: 15
-Receive: 25



WWW
« Reply #2 on: March 02, 2008, 07:02:29 19:02 »

i wrote my own i2c code.but how can i find that  at which rate communication is going on?? can anyone tell me some method to find it??
Logged

A Thousand Miles Journey Starts With a Single Step
planet69
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 5
-Receive: 8


« Reply #3 on: March 03, 2008, 01:17:51 01:17 »

i think i understand it now.
we can set any value 0-400KHz based on the setting of SMP bit
using the formula, BRG = ((Fosc / Fclock X 4)) - 1, the value for SSPADD is found
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC