Page 1 of 1

Very OLD Error in one-wire example in the library manager

Posted: 11 Nov 2013 21:36
by Dany
Already a very OLD one, signalled lightyears (yes, I know that is a distance) ago I think:

Code: Select all

      //--- Perform temperature reading
      Ow_Reset(PORTE, 2);                                    // Onewire reset signal
      Ow_Write(PORTE, 2, 0xCC);                              // Issue command SKIP_ROM
      Ow_Write(PORTE, 2, 0x44);                              // Issue command CONVERT_T
      Delay_us(120);

      Ow_Reset(PORTE, 2);
      Ow_Write(PORTE, 2, 0xCC);                              // Issue command SKIP_ROM
      Ow_Write(PORTE, 2, 0xBE);                              // Issue command READ_SCRATCHPAD
The time needed between the CONVERT_T command and the READ_SCRATCHPAD command has to be at least 750 millisecs (can be shorter if using a D18B20 type with resolutions < 12 bits). In the above example it is 120 microseconds!!!!!
This means that the scratcpad will be read before the tempconversion finished, at least the first and probably also the second loop. Eventually the readings will be OK because the first temp conversion will be finished.

Come on guys, so many starting people (will) have problems with this!!!

Re: Very OLD Error in one-wire example in the library manage

Posted: 14 Nov 2013 16:39
by milos.vicentijevic
Hello Dany,

thank you for pointing this out.

I have send this to software development department so they can consider proper change of this example.

Best Regards,
Milos Vicentijevic