И еще к ножке PA0 ничего не подключено а на экран выдаёт 2 вольта как это понимать, но при подключении земли выдаёт 0, а питания 5 вольт соответственно.
Спойлер
#include <mega16.h>#include <stdio.h>
#include <delay.h>
#define ADC_VREF_TYPE 0xC0
unsigned int result;// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}
// Declare your global variables here
void main(void)
{
PORTB=0x00;
DDRB=0xFF;
PORTD=0xFF;
DDRD=0x00;
GICR|=0xC0;
MCUCR=0x0A;
MCUCSR=0x00;
GIFR=0xC0;
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;
// ADC initialization
// ADC Clock frequency: 1000,000 kHz
// ADC Voltage Reference: Int., cap. on AREF
// ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x83;
// Global enable interrupts
#asm("sei")
while (1)
{
float volt;
delay_ms(1000) ;
volt=read_adc(0);
result=ADCW*5/1023;
#asm ("cli")
printf("%uvolt\n",result);
#asm ("sei")
};
}
Что Вы хотели увидеть при висячем в воздухе ПИНе ?