How to get silabs Si1141 out of suspended mode

Thread Starter

jokkeedk

Joined Mar 20, 2015
1
Trying to read the PS1 values. But as im running the following code it keeps saying on "chip_stat" that its suspended.

Code:
main (void){

init();// Configuration initialization
si1141_init();// Si1141 sensor initialization

__delay_ms(30);// Delay to ensure Si1141 is completely booted, must be atleast 25ms

si1141_WriteToRegister(REG_IRQ_STATUS,0xFF);// Clear interrupt source

signed int status;

while(1){

WriteToI2C(0x5A<<1);// Slave addressPutByteI2C(0x30);// chip_stat
ReadFromI2C(0x5A<<1);// Slave address
if((status =GetByteI2C(0x30))==Sw_I2C_ERROR)// part_id{
returnSw_I2C_ERROR;
}
Stop_I2C();
status++;
}
}
The code im using to read the PS1 values is the following. Im reading the value 16705. Which keeps being the same on all measurements.

The value should go up and down from 0 - 32767, as it measures more or less movement.

Code:
signedint si1141_ReadFromRegister(unsignedchar reg){signedint data;

WriteToI2C(0x5A<<1);// Slave address
ReadFromI2C(0x5A<<1);// Slave address
if((data =GetByteI2C(Sw_I2C_LAST))==Sw_I2C_ERROR){
return Sw_I2C_ERROR;
}
Stop_I2C();
return data;
}

main (void){

init();// Configuration initialization
si1141_init();// Si1141 sensor initialization

__delay_ms(30);// Delay to ensure Si1141 is completely booted, must be atleast 25ms

si1141_WriteToRegister(REG_IRQ_STATUS,0xFF);// Clear interrupt source

signedint PS1;

while(1){

PS1 = si1141_ReadFromRegister(REG_PS1_DATA0)+(256* si1141_ReadFromRegister(REG_PS1_DATA1));// Proximity CH1

}
}
I linked the files for the i2c communication.

https://www.dropbox.com/s/q41vw444gjvj0qa/swi2c.c?dl=0
https://www.dropbox.com/s/1mshyz88o15hz8c/swi2c.h?dl=0

Moderators note : Please use code tags for pieces of code
 
Top