Hallo Zusammen,
verwendet von Euch jemand den ADS1115 in Verbindung mit dem ALARM/RDY Signal ?
Ich verwende folgende Init Routine und sofort habe ich Impuls auf dem RDY Signal,
obwohl ich nur eine einize Messung haben will (Single Shoot).
Code:
ret = i2c_start(ADS1115_I2C_BUS_ADRESS+I2C_WRITE); // set device address and write mode
if ( ret )
{
i2c_stop(); /* failed to issue start condition, possibly no device found */
}
else
{
i2c_write(ADS1115_RA_LO_THRESH); // Select the Pointer register with Low thread hold
i2c_write(0x00); // write value zero into the high Byte
i2c_write(0x00); // write value zero into the low Byte
i2c_stop(); // set stop condition = release bus
}
ret = i2c_start(ADS1115_I2C_BUS_ADRESS+I2C_WRITE); // set device address and write mode
if ( ret )
{
i2c_stop(); /* failed to issue start condition, possibly no device found */
}
else
{
i2c_write(ADS1115_RA_HI_THRESH); // Select the Pointer register with High thread hold
i2c_write(0x80); // write value max. value into the high Byte
i2c_write(0x00); // write value max. value into the low Byte
i2c_stop(); // set stop condition = release bus
}
iActualAnalogInput=4; // read the last once for init function of the Ready pin
ret = i2c_start(ADS1115_I2C_BUS_ADRESS+I2C_WRITE); // set device address and write mode
if ( ret )
{
i2c_stop(); /* failed to issue start condition, possibly no device found */
}
else
{
i2c_write(ADS1115_RA_CONFIG); // Select the Pointer register with Configuration
iRegisterValue = 0xC1; // OS Mode / 6.111v Full range / Single shot
i2c_write(iRegisterValue); // write value into the High Byte of Config. Register
iRegisterValue = 0x8C; // 128 SPS / Trans. Comp mode/High pole/Latched /After one conv.
i2c_write(iRegisterValue); // write value into the low Byte of Config. Register
i2c_stop(); // set stop condition = release bus
}
Wo mache ich den Fehler ?
Viele Grüße
R.
Lesezeichen