In article <5db40b85-90cb-333c-bf0e-ba66a5f26...@gmail.com> you wrote: > Hello all,
> I have a Datanab TC to 1Wire that uses a MAX31850: > http://www.datanab.com/sensors/1wire-%20thermocouple-sensor-thrmcpl_k.php > The device reads fine using a DS9490R on Windows using a package I have > written to read the device as in the datasheet (OneWire Viewer does not > read temperature on the 31850). > Using a DS2483 on owfs, I get some weird stuff. According to the man > page here (http://owfs.org/uploads/DS1825.html), the temperature should > give CJC, and thermocouple should give CJC-compensated temperature. > These values are as follows (owfs is mounted in Celsius): Hello, this is the third attempt for a reponse: - First direct to the asker and Jan - Reply via gmane after successfull subscription. - and now via my normal mailer The manual page tells that the internal chip temperature is the content of the */temperatur* files and the cold junction compensated thermocouple temperature is the content of */thermocouple. The Chip has the thermocouple temperature at data[0] and the internal temperature at data[2]. However all other similar chips have the temperature at data[0]. Current code only mixes up data and interpretation. Appended patch fixes the readings. Please apply! Cheers -- Uwe Bonnes b...@elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 1623569 ------- Fax. 06151 1623305 --------- >From 28b19bf33327bab73d843e1331eaab681e8ff5ba Mon Sep 17 00:00:00 2001 From: Uwe Bonnes <b...@elektron.ikp.physik.tu-darmstadt.de> Date: Tue, 6 Sep 2016 13:13:00 +0200 Subject: MAX32850: Fix values for thermocouple and temperature data. --- module/owlib/src/c/ow_1820.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/module/owlib/src/c/ow_1820.c b/module/owlib/src/c/ow_1820.c index 874746d..47346f8 100644 --- a/module/owlib/src/c/ow_1820.c +++ b/module/owlib/src/c/ow_1820.c @@ -932,9 +932,12 @@ static GOOD_OR_BAD OW_22latesttemp(_FLOAT * temp, enum temperature_problem_flag Resolution = &Resolution12 ; break ; } - - temp[0] = OW_masked_temperature( data, Resolution ) ; - + if ((pn->sn[0] == 0x3B) && (data[4] & 0x80)) { + /* MAX31850 shows internal temperature at data[2] as "temperatureXXX"! */ + temp[0] = ((_FLOAT) ((int16_t) ((data[3] << 8) | (data[2] & 0xf0)))) / 256.0; + } else { + temp[0] = OW_masked_temperature( data, Resolution ) ; + } if ( accept_85C==allow_85C || data[0] != 0x50 || data[1] != 0x05 ) { return gbGOOD; } @@ -964,13 +967,12 @@ static GOOD_OR_BAD OW_thermocouple(_FLOAT * temp, enum temperature_problem_flag RETURN_BAD_IF_BAD(OW_r_scratchpad(data, pn)) ; - temp[0] = OW_masked_temperature( &data[2], Resolution ) ; - if ( (data[0] & 0x01) || (data[2] & 0x07)) { // Fault flag LEVEL_DEBUG("Error flag on thermocouple read of %s",pn->path) ; return gbBAD ; } + temp[0] = OW_masked_temperature( &data[0], Resolution ) ; return gbGOOD ; } -- 2.6.6 ------------------------------------------------------------------------------ _______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers