diese timings sind für 100msCode:#include <avr/io.h> #include <avr/interrupt.h> #include <avr/delay.h> #include <avr/signal.h> volatile uint8_t stepcount=0; SIGNAL (SIG_OVERFLOW1) { stepcount ++; PORTD ^= (1<<PD0); }; int main(void) { DDRD = 0xff; DDRB = 0xff; OCR1AL = 0x27; OCR1AH = 0x09; TCNT1L = 0xd9; TCNT1H = 0xf6; TIMSK |= (1 << TOIE1); TIMSK |= (1 << TOIE1); TCCR1B |= (1<<CS12); //256 //TCCR0 |= (1<<CS10)|(1<<CS12); //1024 //TCCR1B |= (1<<CS10)|(1<<CS11); //64 sei(); while(1) { if(stepcount == 0) { PORTB = 0x01; }; if(stepcount == 1) { PORTB = 0x00; }; if(stepcount == 2) { PORTB = 0x02; }; if(stepcount == 3) { PORTB = 0x00; stepcount = 0; }; }; }
Lesezeichen