ATtiny84 and DS18S20-temperature sensor

Hey guys,

I need help with launching of the DS18S20 - temperature sensor on the ATtiny84 programmed with an Ardunino Uno.
I got with my sketch code only fixed values without changes increasing the temperature:

#include <OneWire.h>
#include <DallasTemperature.h>


OneWire ds(2);
DeviceAddress sensor = { 0x10, 0x92, 0x43, 0x90, 0x2, 0x8, 0x0, 0x5B };

void setup()
{
}

void loop()
{
  float temp = getTemperature(sensor);
}


void writeTimeToScratchpad(byte* address)
{
  //reset the bus
  ds.reset();
  //select our sensor
  ds.select(address);
  //CONVERT T function call (44h) which puts the temperature into the scratchpad
  ds.write(0x44,1);
  //sleep a second for the write to take place
  delay(1000);
}
 
void readTimeFromScratchpad(byte* address, byte* data)
{
  //reset the bus
  ds.reset();
  //select our sensor
  ds.select(address);
  //read the scratchpad (BEh)
  ds.write(0xBE);
  for (byte i=0;i<9;i++){
    data[i] = ds.read();
  }
}
 
float getTemperature(byte* address)
{
  int tr;
  byte data[12];
 
  writeTimeToScratchpad(address);
 
  readTimeFromScratchpad(address,data);
 
  //put in temp all the 8 bits of LSB (least significant byte)
  tr = data[0];
 
  //check for negative temperature
  if (data[1] > 0x80)
  {
    tr = !tr + 1; //two's complement adjustment
    tr = tr * -1; //flip value negative.
  }
 
  //COUNT PER Celsius degree (10h)
  int cpc = data[7];
  //COUNT REMAIN (0Ch)
  int cr = data[6];
 
  //drop bit 0
  tr = tr >> 1;
 
  return tr - (float)0.25 + (cpc - cr)/(float)cpc;
}

On the Arduino Uno it works perfectly, on the ATtiny only problems…

Had someone an good advice / tip for me to solve this problem?

Thank you very much!

Regards
emexy

you #include <DallasTemperature.h> library

so why not use it’s methods to read the sensor?