This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

1-wire DS18B20 change resolution
#5
Oke, i can do a reading and custom precision with:
Code:
require('ow')
value = ow.readfile('SENSORID', 'temperature', true) -- third argument will force a new conversion
log( round(value,1) )

I know its theoretical, but can i change the precision by lm4 or do i need to connect them to a arduino and execute the following code:
Code:
ds.search(addr); // address on 1wire bus
if (addr[0] == DS18B20)     // check we are really using a DS18B20
{
   ds.reset();             // rest 1-Wire
   ds.select(addr);        // select DS18B20

   ds.write(0x4E);         // write on scratchPad
   ds.write(0x00);         // User byte 0 - Unused
   ds.write(0x00);         // User byte 1 - Unused
   ds.write(0x7F);         // set up en 12 bits (0x7F)

   ds.reset();             // reset 1-Wire
   ds.select(addr);        // select DS18B20
  
   ds.write(0x48);         // copy scratchpad to EEPROM, next reboot it has the new precision
   delay(15);              // wait for end of write
}
Reply


Messages In This Thread
RE: 1-wire DS18B20 change resolution - by gjniewenhuijse - 17.05.2016, 08:38

Forum Jump: