ATmega32 Analog Pins, use some as digital

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

Dear all, I have recently switched from PIC to AVRs, I am using ATMega32A and I want to use only one or two analog pins for acquiring analog data, while I want rest of the PORTA pins as digital. But what I have realized is that enabling analog turns entire port pins into analog.

Is this kind of setting only limited to ATMega32 or all AVRs behave the same way.

Kind Regards.

Its Better to Light a Candle than to sit back and curse the darkness

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

Welcome to the Forum.

 

What a great question.

 

The M32 is an older chip.

I am not personally very familiar with it.

 

The newer micros, for example the M328 series, uses a multiplexer to select which Port A pins are connect in analog mode to the ADC.

If you are not using a pin in analog mode you can use it as a digital I/O pin.

 

Note that some packages have an extra 2 ADC only pins that do not have digital I/O mode.

 

JC

 

Edit: Typo

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


Well the datasheet shows:

So like most (if not all AVR's) there is an analog mux to select which pins connect to the ADC system.

Some AVR's also have a way to disable digital access to analog port pins too.

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

ameriq wrote:
But what I have realized is that enabling analog turns entire port pins into analog.

Tell more about that.  I've always felt that [while a bit more special] ADC inputs are just another possible alternate function for those pins.

 

Doc mentioned about '32A being an older generation chip.  What inspired you to use that?  A '324 for example would be pin-compatible, be less expensive, use less power, and have many more features.

 

There are some considerations with using pins on the analog port(s) for digital functions.  But what do you mean by "turn into analog"?

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.