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

HDC1000 Reading sensor
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
respected



Joined: 16 May 2006
Posts: 95

View user's profile Send private message

PostPosted: Mon Jan 12, 2015 3:04 am     Reply with quote

In fact I know i2c needs pullups. But pullups are other side. Anyway this is good lesson for me
Animok



Joined: 03 May 2018
Posts: 11

View user's profile Send private message

HDC1000 WORKING
PostPosted: Mon Feb 25, 2019 12:05 pm     Reply with quote

Hello everyone!
I got many solutions from this forum, so I would like contribute with my solution about HDC1000 sensor.
I read temperature and humidity separately. Here you are the routines:
Code:

#use i2c(Master,SLOW,sda=PIN_B5,scl=PIN_B4,force_hw)
//------
void hdc_setup(void)
{
    i2c_start();     
   i2c_write(0x02);                         
    i2c_write(0x20);   //
    i2c_write(0x00);
    i2c_stop();
   delay_ms(500);                         
}                                                 
//********************************************************                                                         
void read_T(void)                                       
{
   i2c_start();
    i2c_write(0x80);             
    i2c_write(0x00);
    delay_ms(300);       //that's the key!!
    i2c_write(0x81);
    data[0]=i2c_read();
    data[1]=i2c_read(0);
   i2c_stop();   
   variaL=make16(data[0],data[1]);   
    temperature=(variaL*0.0025177)-40;
    delay_ms(500);   
}                   
//*********************************************************
void read_HR(void)                                       
{
   i2c_start();
    i2c_write(0x80);             
    i2c_write(0x01);
    delay_ms(300);       //that's the key!!
    i2c_write(0x81);
    data[0]=i2c_read();
    data[1]=i2c_read(0);
   i2c_stop();   
   variaL=make16(data[0],data[1]);   
    humidity=(variaL*0.0015258);
    delay_ms(500);   
}       

This is for all good people in the world! Cool
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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