I found this code which seems to be simple enough to fit tiny controllers (this was the main reason to using this code): LINK.
Any way, the code was originally for atmega1284, and I modified it to work with atmega16, main changes were actually in uart.c because atmega16 has only one USART module. I replaced the makefile because the original one was not displaying the resulting code size. I added some lines in main.c to modify TH and TL registers as well.
First of all, I tried the code with DS1820, and it works fine. The problem appears with DS18B20 that constantly displays 85.0000, I am able to modify scratchpad TH and TL registers and I can read the scratchpad without problems. I tried changing the way code waits for DS18B20 to finish conversion in ds18b20ReadTemperature function, but this has not changed anything, I also tried ignoring the search for sensors on the bus and used skip rom command instead, but this has also never changed anything. I looked at the datasheets, but could not find what could cause this error condition.
I have also tried 4.7K and 10K pullup resistors, Vcc and GND are connected to the sensor as the datasheet pin assignment showed, so technically speaking I don't have connection problems. DS18B20 sensors I have are all working already.
Here is a sample from the output of DS18B20:
5 80 Temperature: 85.0000 scratch: 85 scratch: 0 scratch: 127 scratch: 255 scratch: 12 scratch: 16 scratch: 33
5 and 80 represent temperature MSB and LSB, respectively. Then the actual temperature is displayed, followed by the rest of the scratchpad registers values. Values are in decimal representation, of course.
I am using STK500 and WinAVR.