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

the smbus directive in #use i2c command

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



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

the smbus directive in #use i2c command
PostPosted: Thu Oct 11, 2012 9:43 pm     Reply with quote

Hi,

What does the Smbus option do in #use i2c directive ?
I am trying to interface a 16F648A mcu to a TSL 2560 light sensor. The sensor runs on 3.3V, so I run the pic on 3V also.

Thanks
a
Ttelmah



Joined: 11 Mar 2010
Posts: 19327

View user's profile Send private message

PostPosted: Fri Oct 12, 2012 12:47 am     Reply with quote

Basically nothing on your chip.

Some of the newer PIC's with a hardware MSSP, have a hardware option to change the bus interface detection levels to match the SMBUS standard, rather than the I2C standard. If you are using a chip with this option, the SMBUS setting switches the interface.

Best Wishes
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

RE
PostPosted: Fri Oct 12, 2012 1:24 am     Reply with quote

So that's why I am unable to interface with device..

thanks
a
Ttelmah



Joined: 11 Mar 2010
Posts: 19327

View user's profile Send private message

PostPosted: Fri Oct 12, 2012 3:22 am     Reply with quote

No.

The 648, should drive the TSL2560 fine.

Key thing though is which pins you are using, and what speed you are trying to work?.
On the PIC itself, some pins have Schmitt input buffers, while others have TTL input buffers. You _must_ be using pins with TTL input buffers to talk to an Smbus device.
Second, the pull up resistors needed with a 3v device, are much lower than those normally used for I2C. Start with something like 2KR.
Then the speed. SMBUS does not support the 400K rates like I2C, so you need to be setting up the I2C at 100KHz.

The basic timings are identical for SMBUS, and I2C, within the speed limitations (except SMBUS adds a timeout).

As a comment, why fiddle with two supply rails?. The 2550, allows operation on 3.3v.

Best Wishes
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

thanks
PostPosted: Sat Oct 13, 2012 3:06 am     Reply with quote

thanks, I managed to get the device working.

The SDA pin was always pulled to about 0.5 V whereas the SCL pin was pulsing correctly, I re-soldered the TSL2560 and got the SDA line back to normal, and I was able to communicate with the device.

I am trying to measure the power of a red laser beam (wavelength 635 nm) using this device, from the datasheet I learnt its possible to calculate the irradiance in lux. I learnt from another forum that a laser power meter would be the ideal choice for a laser light source and not a luxmeter.

Perhaps I should look for another sensor...

thanks anyway for all the help..

a
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