All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] 8-bit ADC, LSB = 8mV - 2.048V or 2.04V?
Date: Thu, 08 Oct 2009 14:08:43 +0000	[thread overview]
Message-ID: <20091008160843.262f3e98@hyperion.delvare> (raw)
In-Reply-To: <hakqgi$q6$1@ger.gmane.org>

Hi Ian,

On Thu, 08 Oct 2009 08:46:57 -0500, Ian Pilcher wrote:
> Thanks to the nonsensical responses I'm getting from MSI, I'm digging in
> to the W83627EHF datasheet to try to figure out what's connected to what
> on my board.
> 
> According to the datasheet, this chip uses an 8-bit analog-to-digital
> converter for voltage measurements, where the least significant bit
> represents 8 mV.  They state that this results in a maximum measurement
> of 2.048 V (2048 mV), but I can't figure out their math:
> 
>     bit 0 (LSB)       8 mV
>     bit 1            16 mV
>     bit 2            32 mV
>     bit 3            64 mV
>     bit 4           128 mV
>     bit 5           256 mV
>     bit 6           512 mV
>     bit 7          1024 mV
>                   ---------
>                    2040 mv     (2.04 V)
>                   ====> 
> Am I missing something?

You are mathematically correct, but the datasheet is possibly correct
too ;)

By their analog nature, ADC chips don't map discrete voltage values to
their digital representation, but voltage _ranges_. For example, a
voltage of 16 mV would be represented as 0x02 but a voltage of 17 mV
would be represented as 0x02 too. So the reality isn't that "16 mV is
represented as 0x02" but rather "voltages ranging from 16 mV to 24 mV
are represented as 0x02" so that all values within the ADC range are
covered.

Under this light, you understand that the values represented by 0xff
would be not just 2.040 V but any value between 2.040 V and 2.048 V,
which means that the datasheet is correct.

In practice this is an error of 0.2%, which you can just ignore. The
error incurred by scaling resistors and electrical noise is at least as
important.

-- 
Jean Delvare
http://khali.linux-fr.org/wishlist.html

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  reply	other threads:[~2009-10-08 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-08 13:46 [lm-sensors] 8-bit ADC, LSB = 8mV - 2.048V or 2.04V? Ian Pilcher
2009-10-08 14:08 ` Jean Delvare [this message]
2009-10-09 19:31 ` Ian Pilcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091008160843.262f3e98@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.