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