ATmega48PA/88PA/168PA - Datasheet Error - ADC Example

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This applies to the datasheet as I obtained it here. I've not checked whether this appears in the other non-suffix datasheets.

 

There seems to be an error in the example of the operation of the ADC on page 323:

 

Example:

ADMUX = 0xED (ADC3 - ADC2, 10× gain, 2.56V reference, left adjusted result)

Voltage on ADC3 is 300 mV, voltage on ADC2 is 500 mV.

ADCR = 512 × 10 × (300 - 500) / 2560 = -400 = 0x270

ADCL will thus read 0x00, and ADCH will read 0x9C.

Writing zero to ADLAR right adjusts the result: ADCL = 0x70, ADCH = 0x02.

The first line sets the ADMUX register to 0b11101101; this means REFS[1:0] = 11, ADLAR = 1, and MUX[3:0] = 1101. According to the register description, this means the reference is set to the internal 1.1V reference, whereas the example states this should be a 2.56V reference which doesn't seem to be an option at all, and there is no mention of a 2.56V reference being available within the device when the ADC operation is described. Furthermore, the setting MUX[3:0] = 1101 is listed ominously as 'Reserved' - there is certainly no option for ADC3 - ADC2 with a 10x gain.

 

I haven't tried this example out, so I don't know if it's completely wrong (and intended for another device), or if the undocumented 'Reserved' setting for MUX[3:0] will actually trigger this behaviour. I'm going to contact Atmel/Microchip when I get a change and ask what's going on here, but I was wondering if anyone else had noticed this or had any explanation for it?

Last Edited: Thu. Sep 14, 2017 - 05:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I suspect that you have just come across one of the infamous "cut and paste" errors found in the datasheets...

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jdp407 wrote:
I haven't tried this example out, so I don't know if it's completely wrong (and intended for another device),

I think our friends from Britain would call it "pants". [Which AVR has ever had an ADCR register?]

 

No wonder Atmel is no longer in business.  ;)  Can't tweak too much as I don't see where Microchip has come out with its own version of this family's datasheet yet.

 

But we can still have some fun.  You are looking at the Mega88 family, the next generation of Mega8 which was the next generation of AT90S4433.  Never in this family have there been differential A/D capabilities.

 

Let's start with AT90S4433, circa 2000...good-to-go there, as the ~100 page datasheet doesn't have the Conversion Result section nor example code.

 

On the the Mega8, rev. H (2002) has the Conversion Result section but no code example.

 

Same with (more or less) latest '8A Atmel-8159F-8-bit AVR Microcontroller_Datasheet_Complete-09/2015
 

On to Mega88 family...the one I had open is the "family" 'PA from 2013; it has the section and no code...

...so without opening up all of my downloaded versions, let's assume it was good to that point.  And that is a "blue" version (660 pages)

[Did you pick the only one with that code example?!?  lol ]  Rev. J (2015) same as above.

 

Now I need to go back to your link and start again...

 

 

 

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...

So this would be the B version, 2016.  Getting closer...lessee the Datasheet Revision History...

Nothing there, and still "Atmel" with no "Microchip" in sight.

 

==============================

So, indeed, apparently you chose the only one (or maybe two) of over forty revisions of that family datasheet since before 2000 to now that has the offending example code.  What are the chances?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.