Hi,
I am working on a LPS22hh however it's not doing what I wanted it to do.
Using a pic18f8722 with SPI at rtc and two 22bit adc's working perfect.
Now adding a lps22hh
Started with temperature
Getting all strange effects like;
Idiot high temperature ''Thigh'' most of the time far to high 226.78 degree.
If you touch the SDO them goes down to a negative value.
Placing a pull-up 47K output goes to zero.
I must overlooked something but what?
Whom has the answer?
Picbuster.
moderators note : added code tags
I am working on a LPS22hh however it's not doing what I wanted it to do.
Using a pic18f8722 with SPI at rtc and two 22bit adc's working perfect.
Now adding a lps22hh
Started with temperature
Getting all strange effects like;
Idiot high temperature ''Thigh'' most of the time far to high 226.78 degree.
If you touch the SDO them goes down to a negative value.
Placing a pull-up 47K output goes to zero.
I must overlooked something but what?
Whom has the answer?
Picbuster.
Code:
Ena_A2=0; // select
SSP2CON1bits.WCOL = 0;
hhp=0x2b; // low order temperature Byte
hhp=hhp<<1; // shift one see manual
hhp |=1<<0; // set bit zero to enter transmit from lps22hh
SSP2BUF =hhp; // send it
while (!SSP2STATbits.BF) {} // wait receive
__delay_us(1);
Tlow= SSP2BUF; // Get the byte
int garbage= SSP2BUF; // collect garbage
SSP2CON1bits.WCOL = 0;
hhp=0x2c; // high order temperature Byte
hhp=hhp<<1;
hhp |=1<<0;
SSP2BUF =hhp;
while (!SSP2STATbits.BF) {} // wait receive
__delay_us(1);
Thigh= SSP2BUF;
Ena_A2=1; // deselect
long h=(long)(Thigh<<8 ); // shift left
Grd= (float)(h+(long)(Tlow))/100; // calculate conform manual
printf("B T%d %d %ld %f\r\n" ,Tlow,Thigh,h,Grd);
Last edited by a moderator: