There is ADC in ATMEGA16 with 8 multiplexed inputs. This analog to digital converter have several interesting options. Here is abstract from datasheet:
â€¢ 10-bit Resolution
â€¢ 0.5 LSB Integral Non-linearity
â€¢ Â±2 LSB Absolute Accuracy
â€¢ 13 – 260 Î¼s Conversion Time
â€¢ Up to 15 kSPS at Maximum Resolution
â€¢ 8 Multiplexed Single Ended Input Channels
â€¢ 7 Differential Input Channels
â€¢ 2 Differential Input Channels with Optional Gain of 10x and 200x(1)
â€¢ Optional Left adjustment for ADC Result Readout
â€¢ 0 – VCC ADC Input Voltage Range
â€¢ Selectable 2.56V ADC Reference Voltage
â€¢ Free Running or Single Conversion Mode
â€¢ ADC Start Conversion by Auto Triggering on Interrupt Sources
â€¢ Interrupt on ADC Conversion Complete
â€¢ Sleep Mode Noise Canceler
The ATmega16 features a 10-bit successive approximation ADC. The ADC is connected to an 8-channel Analog Multiplexer which allows 8 single-ended voltage inputs constructed from the pins of Port A. The single-ended voltage inputs refer to 0V (GND). The device also supports 16 differential voltage input combinations. Two of the differential inputs (ADC1, ADC0 and ADC3, ADC2) are equipped with a programmable gain stage, providing amplification steps of 0 dB (1x), 20 dB (10x), or 46 dB (200x) on the differential input voltage before the A/D conversion. Seven differential analog input channels share a common negative terminal (ADC1), while any other ADC input can be selected as the positive input terminal. If 1x or 10x gain is used, 8-bit resolution can be expected. If 200x gain is used, 7-bit resolution can be expected.
The ADC contains a Sample and Hold circuit which ensures that the input voltage to the ADC is held at a constant level during conversion. The ADC has a separate analog supply voltage pin, AVCC. AVCC must not differ more than Â±0.3 V from VCC. Internal reference voltages of nominally 2.56V or AVCC are provided On-chip. The voltage reference may be externally decoupled at the AREF pin by a capacitor for better noise performance.
Software is very simple. It just read data from ADC and prints the results to LCD module. With small change in the source (just uncomment fre lines) and it is possible to read data from all channels.
Changing value near text “Stepas” just indicate the cycle number (in default program version) or ADC channel number. And if this number is changing, we can determine, that software is still working 🙂
Sorftware, source code: 20070918.zip.