Привожу. Только не швыряйте гнилыми помидорами - я еще только учусь. Кстати, там еще есть пару warning'ов. Тоже непонятных.
#include <avr/io.h> #include <avr/interrupt.h> #include <avr/signal.h> #include <avr/sleep.h> #include <avr/delay.h>
#define Freq 4000000
char i;
void zaziganie (unsigned char z) { z = 0; for (i=0; i<60; i+=1) { if ((PIND&0x04) == 0); else z += 1; _delay_loop_2 (100); }
//void presskey (void)
int main (void) { DDRD = 0x00; PORTD = 0xFF; DDRB = 0b11111100; PORTB = 0b00000000; ACSR = 0b00000000; GIMSK = 0b01000000; label1: sei(); set_sleep_mode (SLEEP_MODE_IDLE); cli (); zaziganie (z); if (z < 30) goto label1; PORTB = (PINB^0x08); _delay_loop_2 (1000); PORTB = (PINB^0b10010000); //presskey (); label2: zaziganie (z); if (z > 30) goto label2; else goto label1; }
-------- begin -------- avr-gcc (GCC) 3.4.3 Copyright © 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C: main.c avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/main.lst -std=gnu99 -MD -MP -MF .dep/main.o.d main.c -o obj/main.o main.c: In function `zaziganie': main.c:24: warning: 'main' is normally a non-static function main.c:45:2: warning: no newline at end of file main.c:45: error: parse error at end of input make.exe: *** [obj/main.o] Error 1
> Process Exit Code: 2
Спасибо!
|