Query on ADC bit resolution

Thread Starter

rabhishek91

Joined Feb 14, 2013
51
Hi everyone.
I am doing a project wherein i am reading analog values using inbuilt ADC of Atmega32A.
It is known that Atmega32A has 10bit ADC.
I don't need resolution of 10 bit for my project. So is there any way where i can read the values and get 1 bit output directly ? I know it can be converted using software but is there any alternative way wherein i can achieve this using hardware(like Setting bits or clearing bits)?

or

My main motto is to read 5V as logic 1 and 0V as logic 0. Can this be done in any other way ?

Please don't get me wrong if this is a silly question. I am new to this programming stuff.
Any help would be much appreciated.
Thanks in advance. :)
 

Thread Starter

rabhishek91

Joined Feb 14, 2013
51
You don't need an ADC. Any input port will do or you can use the on-chip analog comparator.
Any comparator or single input gate is a one-bit ADC.
Thanks for the reply sir.

Any input port will do
Does this means that i can give 5V to any input port (Port A/B/C/D). Port B,C and D are digital input/ouptut lines so i am confused. Can i supply 5V to these ports?
 

WBahn

Joined Mar 31, 2012
30,075
Even if your Atmega is under 5V you have options. First, check the data sheet to see if the inputs are 5V-tolerant. If so, you are done. Otherwise, you can make a small resistor voltage divider to get reduce your signal to a tolerable range. Finally (and not recommendend) is you could use a single current limiting resistor between the signal and the input pin so that the input protection diode clamps the input to the devices power supply plus a diode drop and the resistor limits the current to an acceptable value. Again, not recommended, but sometimes you gotta do what you gotta do.
 

Thread Starter

rabhishek91

Joined Feb 14, 2013
51
Even if your Atmega is under 5V you have options. First, check the data sheet to see if the inputs are 5V-tolerant. If so, you are done. Otherwise, you can make a small resistor voltage divider to get reduce your signal to a tolerable range. Finally (and not recommendend) is you could use a single current limiting resistor between the signal and the input pin so that the input protection diode clamps the input to the devices power supply plus a diode drop and the resistor limits the current to an acceptable value. Again, not recommended, but sometimes you gotta do what you gotta do.
Thank you sir. I got it.
"not recommendend". May i know the reason behind this ?
 

WBahn

Joined Mar 31, 2012
30,075
Thank you sir. I got it.
"not recommendend". May i know the reason behind this ?
The input protection diodes are intended for that purpose -- to protect the internal circuitry from input signals that would do bad things, such as forward bias bulk junctions. Using them to clamp input signals is what, in the drug trade, would be called "off-label" use. It's just not considered good practice to deliberatly use them this way.
 

Thread Starter

rabhishek91

Joined Feb 14, 2013
51
The input protection diodes are intended for that purpose -- to protect the internal circuitry from input signals that would do bad things, such as forward bias bulk junctions. Using them to clamp input signals is what, in the drug trade, would be called "off-label" use. It's just not considered good practice to deliberatly use them this way.
Thanks for the info sir.
 
Top