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

Omron Pressure Sensor 2SMPB-01-01 problem...

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



Joined: 14 Jun 2010
Posts: 16

View user's profile Send private message

Omron Pressure Sensor 2SMPB-01-01 problem...
PostPosted: Wed Jan 07, 2015 10:00 am     Reply with quote

Hi everybody !
I'm trying to talk with a I2C pressure sensor (Omron 2SMPB-01-01) but i have some problems....
I use a development board Explorer16 from Microchip with a pic24f, a breakout board with the sensor.
I'm able to access to the register, write a value and read after. For have the pressure value, you have read the internal raw temperature, raw pressure, and calibration value.
My problem is the values are too big for to be true...

So, I look for someone who has already used this sensor for assistance.
Please tell me what !
thanks ! Very Happy
temtronic



Joined: 01 Jul 2010
Posts: 9174
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jan 07, 2015 11:16 am     Reply with quote

You should post your code so we can see how you're 'doing the math'. It could be reading the wrong register, improper casting and wrong braces...

Also post which PIC and compiler version...might be a bug in compiler.

jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Wed Jan 07, 2015 12:14 pm     Reply with quote

The obvious thing that might well give silly results is how you convert 24bit data to 32bit.
Are you attempting the temperature compensation or just looking at raw data?.
What power mode is the chip in?. This changes the returned value by 4*.
Remember the MSB arrives first, if you are using a sequential read to access the bytes.
In high accuracy mode each count, is 0.06pA. So 16.66 counts per Pascal. Remember atmospheric pressure is over 100000 Pascals. Large counts....

Best Wishes
joseph



Joined: 14 Jun 2010
Posts: 16

View user's profile Send private message

PostPosted: Thu Jan 08, 2015 2:57 am     Reply with quote

For beginning, thanks a lot for your reply..

So as you asked me, i share my code :
Code:

//-------Read 8bits register----------------------------
int8 read_data8(adress)
{
int8 data;

i2c_start();   
i2c_write(write_adress);
i2c_write(adress);
i2c_start();   
i2c_write(read_adress);
data=i2c_read(0);
i2c_stop();
return data;
}

//-------Read 16bits register---------------------------
int16 read_data16(adress)
{
int16 data;

i2c_start();   
i2c_write(write_adress);
i2c_write(adress);
i2c_start();   
i2c_write(read_adress);
data=i2c_read();
data=data<<8;
data=data+i2c_read(0);
i2c_stop();
return data;
}


Code:

//----Read raw temperature------------------------------------
int32 data;

write_data8(I2C_SREQ,sensor_PTAT);
delay_ms(10);
data=make32(0,read_data8(I2C_TXD0),read_data8(I2C_TXD1),read_data8(I2C_TXD2));
printf("Raw Temp: %ld\n\r",data);


Ttelmah, i'm little surprise about your comments about the power mode... i will read a other time the datasheet.
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