mark_jubay:
hi guys who know about the arduino mega 2560 R3, it is described that it is possible to change the upper end of their range using the AREF pin and analogReference() function. I want to know the specific range of the upper scale of the adc (default is 0-5V).
and the voltage level of the digital high for the digital i/o's and scl&sda pins.
great appreciation for your help!
thanks,
mark
The 2560 has both a 2.56 volt reference and a 1.10 volt reference (and of course VCC of 5.0 volts).
You cannot, however, go ABOVE VCC or BELOW GND. If you do you will latch up the input (translation: fry the chip).
The reference voltages can be selected with the analogReference() function.
You can also provide an EXTERNAL reference via the AREF pin. This pin should be bypassed with a suitable capacitor (a 0.1uF or so).
Also it's a good idea to send the AREF signal through a resistor of around 1000 ohms just to protect the AREF pin.
The ADC will give you 1024 steps between 0 and AREF.
Making AREF very small should theoretically give you "amazing" resolution, but in reality the lower you go the more ambient noise (electrical noise) you get in the signal and you reach a point where it's not accurate anymore because noise dominates the signal.
The digital pins all output nice solid levels... less than 0.2 volts low and close to 5.0 volts high. The pins can safely sink or source 20 milliamps each, and in reality they can do a lot more (but don't push it).
The PWM pins can be used for "analog" control of various devices. These pins do not output varying voltage, but 0 volts or 5 volts (alternating rapidly) with variable duty cycle so that the average voltage can be changed.
For example, if you connect a motor or a light bulb to a PWM output (using a suitable driver circuit of course), you can vary the speed of the motor or the brightness of the bulb.
If you set the analog output value to 64 (which is 1/4 of it's max value of 255), the PWM pin is on 25% of the time and off 75% of the time. So, the load "integrates" the PWM (the motor, by it's rotor inertia and the bulb by the thermal inertia of the filament) to spin at 1/4 of the max RPM or glow at 1/4 brightness.
The PWM goes so fast that the bulb cannot blink on and off, but instead assumes an AVERAGE brightness. The motor cannot stop and start so fast, so it's rotor spins at an AVERAGE speed.
Setting the PWM to 192 generates a 3/4 duty cycle PWM. So the motor now spins at 75% RPM and the bulb glows at 75% brightness.
This PWM can, of course, be varied anywhere between 0 and 255 (in steps of 1), so you have very fine control of the "analog" result.
Remember that the PWM only outputs digital levels (i.e. 0V or 5V), but the ratio of on time to off time varies the average voltage sent to the load.
Hope this answers your question.....