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 CCS Technical Support

16F819 & I2C sensor

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



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

16F819 & I2C sensor
PostPosted: Mon Jul 18, 2005 4:27 am     Reply with quote

HI,

I want to connect an I2C sensor to the 16F819.
I saw in the data sheet that this device is only I2C slave.
Is that mean that I can't read from the sensor?
If yes, can someone please send me a simple example for that.

Edi.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Mon Jul 18, 2005 5:53 am     Reply with quote

You can implement the I2C master in firmware. CCS has functions for that as well as example programs. Look at the eeprom examples. Without knowing which sensor that's about all the help I can give you.
edi



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

PostPosted: Mon Jul 18, 2005 7:35 am     Reply with quote

Thanks Mark,

The sensor I need to use is:
SHT1x/SHT7x from : Sensirion.

http://www.sensirion.com/en/02_products/00_products.htm?cat=3&art=5
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Jul 18, 2005 9:11 am     Reply with quote

The sensirion sensors are not I2C devices. The protocol is similar but not the same as I2C. It is easy enough to "bit bash" to implement it in the PIC. If you do a search for Sensirion on this site you will find code posted by others.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Mon Jul 18, 2005 12:21 pm     Reply with quote

I am, currently, using the SHTXX sensor in one of my designs. I had four sensors connected up to the I2C bus utilizing a multiplexer (SN74CBT3253). Since each sensor has the same address you cannot communicate with multiple ones on the same bus unless you use a multiplexer like this. I put 1K pull-up resistors on the Master side and also 1K resistors on each of the sensor buses. Then I simply addressed the multiplexer with a couple of outputs, from the Master, for the sensor that I wanted to talk to.

It's possible to have this sensor connected to the I2C bus but I found it needs to have the bus isolated with something like the multiplexer. The Start signal, of the sensor, is not a standard I2C Start either. It incorporates both a Start and Stop to signal you want to talk to it. It took me a while to figure out how to get it to work on the I2C bus and is a bit easier simply to bit-bang it with separate outputs from the Master.

When the data sheet says that the device is only a Slave, it just means that it cannot act as a master to control other devices. You can talk to it, read from it with a Master. You can even write to certain registers inside of the sensor. Mostly to turn on an internal heater to remove condensation, if needed, before making a reading. You would turn off the heater before you would read the RH/Temperature, of course.

Ronald
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