/// <summary> /// Initializes the temperature probe by specifying the I2C bridge address and clock frequency /// </summary> /// <param name="bridgeAddress">The I2C address of the DS2482 bridge.</param> /// <param name="clockFrequency">The clock rate in kHz of the I2C bus.</param> /// <param name="adcResolution">The resolution of the ADC: 9, 10, 11, or 12 bit.</param> /// <param name="probe">The probe being initialized.</param> public void Initialize(ushort bridgeAddress, int clockFrequency, ADCResolution adcResolution, Module probe) { this.bridgeAddress = bridgeAddress; this.adcResolution = adcResolution; switch (adcResolution) { case ADCResolution.NineBit: temperatureResolution = 8 * minTempResolution; convertionTime = maxConvertionTime / 8; break; case ADCResolution.TenBit: temperatureResolution = 4 * minTempResolution; convertionTime = maxConvertionTime / 4; break; case ADCResolution.ElevenBit: temperatureResolution = 2 * minTempResolution; convertionTime = maxConvertionTime / 2; break; case ADCResolution.TwelveBit: temperatureResolution = minTempResolution; convertionTime = maxConvertionTime; break; default: break; } try { i2cBus = new I2CBus(socket, bridgeAddress, clockFrequency, probe); ResetDS2482(); ReadDS18B20ROMCode(); ReadDS18B20PowerSupply(); ConfigureDS18B20(); } catch (Exception) { throw; } }