Thank you for your precision!
I'll correct the calculation for the next release.
As a side note, I am told that the real precision of the A/D conversion is
8 bits, not 16, which probably is a larger source of error. I recall
discussions of trying to make a drop-in replacement for the DS2450 with a
microprocessor with higher resolution A/D.
Paul Alfille
On Mon, Jan 27, 2014 at 11:07 AM, Prof. Dr. Peter A. Henning <
[email protected]> wrote:
> Hi OWFS developers,
>
>
>
> I apologize if you eventually read this twice - but since it is highly
> unlikely that such an error remains for such a long time in otherwise
> stable code I deem it rather important to reach a fast consensus there.
>
> There seems to be a scaling error in the source code addressing the DS2450
> A/D converter. According to the data sheet of the DS2450, p.22 , its
> minimum full scale input voltage at 16 bit resolution and 5.12 V range is
> 5.1199 V.
>
> This means, that at
>
> (65535-0.5)/65536 * 5.120 = 5.11988 (rounded 5.1199) V the binary value
> becomes 65535.
>
> Each least significant bit therefore weighs 1/65536 * 5.120 = 0.000078125
> (rounded 0.000078) V in agreement with the table on page 22 of the data
> sheet
>
> However, in line 412 ff of owfs-xxx/module/owlib/src/c/ow_2450.c
>
> the code reads
>
> V[0] = 7.8126192E-5 * ((((UINT) data[1]) << 8) | data[0]);
>
> (3 lines following are the same).
>
> The floating point number here is
>
> 0.000078126192 = 1/65535*5.120 instead of the 0.000078125 we obtained above
>
> Consequently, OWFS weighs each least significant bit slightly more
>
> than it should do, and at a binary count of 65535 displays the value
>
> 5.120 V, whereas it should display only 65535/65536*5.120 = 5.11992
>
> (rounded 5.1199 ) V.
>
>
>
> The data sheet is not written very clearly here, but one may crosscheck
> the understanding of the data sheet with another resolution: Using 8 bit
> resolution, the binary count of the DS2450 will be set to FF00=255*256 at
> an input voltage of
>
>
>
> (255-0.5)*256/65356*5120 = 5.090 V (as listed in the data sheet)
>
>
>
> and would be set to 65536 (e.g. ZERO plus carry bit) at
>
>
>
> (255+0.5)*256/65356*5120 = 5.110 V
>
>
>
> Please let me know whether you believe this to be an error.
>
>
>
> Best regards
>
>
>
>
>
> Peter Henning
>
>
>
> ----------------------------------------------PGP 0x5CDC14A1 -------
>
> | Prof.Dr.Peter A.Henning
>
> |
>
> | Institute for Computers in Education
>
> |
>
> | Coordinator of EU Project INTUITEL
>
> | http://www.intuitel.eu
>
> |
>
> | European Award for Technology Supported Learning eureleA
>
> | http://www.eurelea.org
>
> |
>
> | Computer Science, Karlsruhe University of Applied Sciences
>
> | http://medialab-karlsruhe.de/
>
> |-------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Owfs-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers