Gast
#2913656
Hallo,
ich versuche einen Interupt zu Starten.
Kann mir jemand dabei helfen?
#include <avr/io.h>
#include <stdint.h>
#include <util/delay.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <avr/iotn25.h>
int8_t Takt;
int Schreibe (int8_t Takt, int8_t Fehler1, int8_t Fehler2)
{
PORTB = (Takt << PB0) | (Fehler1 << PB3) | (Fehler2 << PB4);
}
ISR(TIMER0_OVF_vect)
{
if (Takt==1)
{
Takt=0;
}
else
{
Takt=1;
}
}
int main(void)
{
sei();
wdt_enable (WDTO_2S);
int8_t Fehler1;
int8_t Fehler2;
int8_t Schalter1;
int8_t Schalter2;
int8_t Ausgang1;
int8_t Ausgang2;
DDRB= (1 << DDB0) | (0 << DDB1) | (0 << DDB2) | (1 << DDB3) | (1 <<
DDB4) | (1 << DDB5);
Fehler1=0;
Fehler2=0;
while(1)
{
wdt_reset();
Ausgang1=1;
Ausgang2=1;
Schalter1=PINB1;
Schalter2=PINB2;
Schreibe(Takt,Ausgang1,Ausgang2);
return 0;
}
ich möchte dabei den Takt für die Lichtschranken vorgeben etwa 10
Hz(externe beschaltung).