okay, benutze die 4.13
irgendwas stimmt aber nciht
ich habe den code mal abgeändert
es kommt nie vor, dass status = 1 wird, weil sich bei meiner simulation beim port D nichts tut
Code:
#define F_CPU 4096000
#include <avr/io.h>
#include <avr/interrupt.h>
#include <inttypes.h>
#include <stdint.h>
volatile int16_t timer=0;
volatile int8_t status=0;
void initTimer(void)
{
TCCR0B |= (1<<CS00)|(1<<CS02);
TCNT0 = 1;
TIMSK |= (1<<TOIE0);
}
void initInterrupts(void)
{
sei();
}
ISR(TIMER0_OVF_vect)
{
timer=timer+1;
}
int main (void)
{
initTimer();
initInterrupts();
DDRB = 0xff;
while(1)
{
if(timer>=4)
{
timer=0;
if(status==0)
{
PORTB = 0xff;
status=1;
}
if(status==1)
{
PORTB = 0x00;
DDRD = 0xff;
PORTD = 0xff;
status=0;
}
}
}
return 0;
}
danke für deine hilfe
ich weiß, es nervt ein bisschen
Lesezeichen