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
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.