DS18B20 data in excel

tim griff

Member
Hi

I'm OK with the PICAXE code to handle the data output from a DS18B20 and display correctly on my display.

I then transer the data via a datalogger into MS Excel spreadsheet.

What I cannot work out is how to handle the "sign bit" in the spreadsheet ie positive or negative numbers .............. any thoughts

Regards
Tim
 

hippy

Technical Support
Staff member
Not familiar with Excel but if you're using ReadTemp's 8-bit data, an equation for all cells in the temperature column/row like the following should do it ...

Code:
  ' Input value = 0..255
  If inputValue >= 128 Then
    outputValue = -(inputValue-128)
  Else
    outputValue = inputValue
  End If
If using ReadTemp12 12-bits ...

Code:
  ' Input value = 0..4095
  If inputValue >= 2048 Then
    outputValue = (inputValue-4096) / 16
  Else
    outputValue = inputValue / 16
  End If
 

tim griff

Member
hippy,

Thanks, I understand this now.
I had

let w1 = w1 ^$ffff + 1

in the code to handle negative values............. it was this that was "masking" the true value from the sensor which I need in the datalogger.

Cheers
 
Top