Kod: Markera allt
volatile static uint8_t varv_klart;
// Interruptrutin för en stigande flank på Int0-pinnen
SIGNAL (SIG_INTERRUPT0)
{
MCUCR ^= _BV( ISC00 );
varv_klart = 0;
}
sei() __asm__ __volatile__ ("sei" ::)
def cli()
ingroup avr_interrupts
int main()
{
DDRC = _BV(PC0) | _BV(PC1) | _BV(PC2) | _BV(PC3)| _BV(PC4)| _BV(PC5)| _BV(PC6) | _BV(PC7);
/*alla bitar i port c är höga.
man kan skriva "DDRC = 0x0f;" med men, det orkar jag inte ändra på, det krånglade lite för mig så, nu får de stå såhär
med "komandot" DDRC = 0x0f gör alltså att alla bitar i port c blir utgångar, vill du använda någon annan port så skriver du
DDRA, DDRB, DDRC ect. det är alltså sista bokstaven där som bestämmer vilken av portarna som ska göras till utgång*/
PIN &= ~ _BV(PD2) // Gör PD2 till ingång
PORTA = _BV(PD2); // Aktivera pullup för PA2
MCUCR = _BV( ISC01 );
GIMSK = _BV( INT0 );
while(1)
{
if (varv_klart==0)
{
V();
_delay_loop_2(60000);
I();
_delay_loop_2(60000);
R();
_delay_loop_2(60000);
R();
_delay_loop_2(60000);
E();
varv_klart = 1;
}
}
}
det va de bästa ja kunde, men inte tillräckligt för det blir mängder med felmedelanden:
binary.c:644: error: parse error before "volatile"
binary.c:662: error: parse error before "volatile"
binary.c:663: error: parse error before "volatile"
binary.c:670: error: parse error before numeric constant
binary.c:670: warning: type defaults to `int' in declaration of `_delay_loop_2'
binary.c:670: warning: function declaration isn't a prototype
binary.c:670: error: conflicting types for '_delay_loop_2'
E:/WinAVR/bin/../lib/gcc/avr/3.4.3/../../../../avr/include/avr/delay.h:110: error: previous definition of '_delay_loop_2' was here
binary.c:670: warning: data definition has no type or storage class
binary.c:671: warning: type defaults to `int' in declaration of `I'
binary.c:671: warning: function declaration isn't a prototype
binary.c:671: error: conflicting types for 'I'
binary.c:226: error: previous definition of 'I' was here
binary.c:671: warning: data definition has no type or storage class
binary.c:672: error: parse error before numeric constant
binary.c:672: warning: type defaults to `int' in declaration of `_delay_loop_2'
binary.c:672: warning: function declaration isn't a prototype
binary.c:672: warning: data definition has no type or storage class
binary.c:673: warning: type defaults to `int' in declaration of `R'
binary.c:673: warning: function declaration isn't a prototype
binary.c:673: error: conflicting types for 'R'
binary.c:427: error: previous definition of 'R' was here
binary.c:673: warning: data definition has no type or storage class
binary.c:674: error: parse error before numeric constant
binary.c:674: warning: type defaults to `int' in declaration of `_delay_loop_2'
binary.c:674: warning: function declaration isn't a prototype
binary.c:674: warning: data definition has no type or storage class
binary.c:675: warning: type defaults to `int' in declaration of `R'
binary.c:675: warning: function declaration isn't a prototype
binary.c:675: warning: data definition has no type or storage class
binary.c:676: error: parse error before numeric constant
binary.c:676: warning: type defaults to `int' in declaration of `_delay_loop_2'
binary.c:676: warning: function declaration isn't a prototype
binary.c:676: warning: data definition has no type or storage class
binary.c:677: warning: type defaults to `int' in declaration of `E'
binary.c:677: warning: function declaration isn't a prototype
binary.c:677: error: conflicting types for 'E'
binary.c:139: error: previous definition of 'E' was here
binary.c:677: warning: data definition has no type or storage class
binary.c:678: warning: type defaults to `int' in declaration of `varv_klart'
binary.c:678: error: conflicting types for 'varv_klart'
binary.c:633: error: previous declaration of 'varv_klart' was here
binary.c:678: warning: data definition has no type or storage class
binary.c:679: error: parse error before '}' token

känner mig ganska usel
aja, är otrolig tacksam för all hjälp
