okdal⇓ пишет:потому что в С++ возможно не указывать return. Посмотри вывод компилятора, там наверняка есть предупреждение. И операторы выполняются или до return или пока они не закончатся в теле функции.
Компиляция в WinAVR:
И всё работает! А в консоли - ужас!
extract@93 avr30]$ avr-gcc avr30.c
In file included from avr30.c:2:0:
/usr/avr/include/avr/io.h:428:6: warning: #warning "device type not defined" [-Wcpp]
# warning "device type not defined"
^
In file included from avr30.c:3:0:
/usr/avr/include/util/delay.h:89:3: warning: #warning "F_CPU not defined for <util/delay.h>" [-Wcpp]
# warning "F_CPU not defined for <util/delay.h>"
^
/usr/avr/include/util/delay.h:94:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
# warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
^
avr30.c: In function 'main':
avr30.c:11:1: error: 'PORTB' undeclared (first use in this function)
PORTB = DDRD = 0xFF; PORTC = 0b00000010;
^
avr30.c:11:1: note: each undeclared identifier is reported only once for each function it appears in
avr30.c:11:9: error: 'DDRD' undeclared (first use in this function)
PORTB = DDRD = 0xFF; PORTC = 0b00000010;
^
avr30.c:11:23: error: 'PORTC' undeclared (first use in this function)
PORTB = DDRD = 0xFF; PORTC = 0b00000010;
^
avr30.c:12:2: error: 'DDRC' undeclared (first use in this function)
DDRC = 0b11111101;
^
avr30.c:13:4: error: 'ADMUX' undeclared (first use in this function)
ADMUX = 0b01000001; //|REFS1|REFS0|ADLAR| -- |MUX3|MUX2|MUX1|MUX0|
^
avr30.c:15:5: error: 'ADCSR' undeclared (first use in this function)
ADCSR= 0b11001011; //|ADEN|ADSC|ADFR|ADIF|ADIE|ADPS2|ADPS1|ADPS0|
^
avr30.c:24:9: error: 'ADCSRA' undeclared (first use in this function)
{ ADCSRA |= 0x40; //��������� ����������� �������������� ADSC=1
^
avr30.c:26:4: error: 'ADCW' undeclared (first use in this function)
a=ADCW;
^
[extract@93 avr30]$
Я так понимаю, что и так будет работать, просто очень много замечаний мне даёт.