MAX11410 high speed 24-bit Delta-Sigma ADC
Dependents: MAX11410BOB_24bit_ADC MAX11410BOB_Serial_Tester
Diff: MAX11410.cpp
- Revision:
- 3:658a93dfb2d8
- Parent:
- 2:eac67184cc0c
- Child:
- 4:c169ba85d673
--- a/MAX11410.cpp Fri Dec 20 23:46:49 2019 +0000 +++ b/MAX11410.cpp Tue Dec 24 00:09:37 2019 +0000 @@ -423,6 +423,10 @@ VRef_AVDD = 3.300; //---------------------------------------- + // Temperature calculated from RTD Resistance; Thermocouple Cold Junction, in degrees C + RTD_Temperature = 25.0; + + //---------------------------------------- // shadow of register ctrl CMD_r000_1001_dddd_dddd_CTRL ctrl = 0x01; @@ -1620,7 +1624,7 @@ } //---------------------------------------- -// Menu item 'R' +// Menu item 'RM' // Trigger Measurement for Resistive Temperature Device (RTD). // // Example code for typical RTD measurement. @@ -1632,7 +1636,7 @@ // @param[in] rtd_ainn = channel RTD low side, default=AINN_SEL_1001_AIN9 // @post AINcode[rtd_ainp]: measurement result LSB code // -// @return ideal voltage calculated from raw LSB code and reference voltage +// @return resistance calculated from raw LSB code and reference resistance double MAX11410::Measure_RTD(MAX11410_AINP_SEL_enum_t rtd_iout, MAX11410_AINP_SEL_enum_t rtd_ainp, MAX11410_AINN_SEL_enum_t rtd_ainn) { @@ -1693,6 +1697,33 @@ } //---------------------------------------- +// Menu item 'RT' +// Return the physical temperature corresponding to measured resistance +// of a PT1000 type Resistive Temperature Device (RTD). +// +// @param[in] rtd_resistance = RTD resistance in ohms, default=1000 +// +// @return ideal temperature in degrees C, calculated from RTD resistance in ohms +// @test TemperatureOfRTD_PT1000(1000.0) expect 0.00 PT1000 at 0 deg C +// @test TemperatureOfRTD_PT1000(1100.0) expect 25.00 PT1000 at 25 deg C +// +double MAX11410::TemperatureOfRTD_PT1000(double rtd_resistance) +{ + + //---------------------------------------- + // warning -- WIP work in progress + #warning "Not Tested Yet: MAX11410::TemperatureOfRTD_PT1000..." + + //---------------------------------------- + // Temperature from RTD Resistance maths + // TODO: define R0 = 1000 ohms for PT1000 + // TODO: define standard RTD coefficients + // TODO: calculate T from R and R0 + RTD_Temperature = 25.00; + return RTD_Temperature; +} + +//---------------------------------------- // Configure Measurement for Thermocouple // // Example code for typical Thermocouple measurement. @@ -1726,7 +1757,7 @@ } //---------------------------------------- -// Menu item 'T' +// Menu item 'TM' // Trigger Measurement for Thermocouple // // Example code for typical Thermocouple measurement. @@ -1761,5 +1792,32 @@ return VoltageOfCode(AINcode[((int)rtd_ainp & 0x0F)]); } +//---------------------------------------- +// Menu item 'TK' +// Return the physical temperature corresponding to measured voltage +// of a type K Thermocouple (TC). +// +// @pre {0}.RTD_Temperature = cold junction temperature, in degrees C +// @param[in] tc_voltage = Thermocouple voltage in volts, default=0.0254 +// +// @return ideal temperature in degrees C, calculated from RTD resistance in ohms +// @test TemperatureOfTC_TypeK(0.123) expect 0.00 TC_TypeK at 0 deg C +// @test TemperatureOfTC_TypeK(0.456) expect 25.00 TC_TypeK at 25 deg C +// +double MAX11410::TemperatureOfTC_TypeK(double tc_voltage) +{ + + //---------------------------------------- + // warning -- WIP work in progress + #warning "Not Tested Yet: MAX11410::TemperatureOfTC_TypeK..." + + //---------------------------------------- + // Temperature from TC_TypeK voltage maths + // TODO: define standard TC_TypeK coefficients + // TODO: calculate deltaT from tc_voltage + double deltaT = 0; + return deltaT + RTD_Temperature; // cold junction +} + // End of file