This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADC Simulation C515C

Dear all,

I'm using Keil uVision for simulating an 80C515C-8R / -8E.

ADC configuration:
VAREF=5V, VAGND:0V, 8-Bit Resolution

-> U_LSB = 5V/256 = 19.53mV

Input voltage:
AIN0 = 2.5 V

I would expect that ADDATH = 0x80, but it shows 0x7F (and ADDATL = 0xC0).

Z = U_IN / U_LSB = 2.5V / 19.53mV = 128 (0x80)

Where's the error in my reasoning? Or is this a bug in Keil's uVision?

Thanking you in anticipation.

Tom

Parents
  • I think it is independent from the datasheet. I have found the calculation of U_LSB in literature on ADCs. It must be 256 values, because there are 256 voltage steps.

     ADC | U
    -----|---------------------
      0  | 0V      ... 19,52mV
      1  | 19,53mV ... 39,05mV
      2  | 39,06mV ... 58,58mV
     ... | ...
     254 | 4,96V   ... 4,97V
     255 | 4,98V   ... 5V
    

    Or I am completely wrong?

    Tom

Reply
  • I think it is independent from the datasheet. I have found the calculation of U_LSB in literature on ADCs. It must be 256 values, because there are 256 voltage steps.

     ADC | U
    -----|---------------------
      0  | 0V      ... 19,52mV
      1  | 19,53mV ... 39,05mV
      2  | 39,06mV ... 58,58mV
     ... | ...
     254 | 4,96V   ... 4,97V
     255 | 4,98V   ... 5V
    

    Or I am completely wrong?

    Tom

Children
  • I think it is independent from the datasheet.

    I think you're wrong about that.

    I have found the calculation of U_LSB in literature on ADCs.

    And how do you know that that particular piece of literature applies to the particular device you're using, other than by consulting the data sheet?

    Yes, there are 256 steps. But what makes you so sure that the outer steps cover exactly as much voltage range as the inner ones? The last step could begin at 5.0 Volt. The first step could be reserved to only apply to an input of exactly 0.0 Volt.

    Even on the scale you computed, 2.50 Volt is exactly on the boundary between two digital outputs. It's never a good idea to make assumptions about what happens in a boundary case of an analog quantity.