Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 8000000UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- ISR(TIMER1_COMPA_vect)
- {
- if(PINB &(1 << PB1)) PORTB &= ~(1 << PB1);
- else PORTB |= (1<<PB1);
- }
- ISR(TIMER0_OVF_vect)
- {
- if(PINB &(1 << PB0)) PORTB&= ~(1 << PB0);
- else PORTB |= (1 << PB0);
- }
- int main (void)
- {
- DDRB = 0b11111111;
- PORTB = 0b0000000;
- TCCR1A = 0b00000000;
- TCCR1B |= (1 << CS12)|(1 << WGM12);
- TCCR0 = 0b00000100;//делитель на 256
- OCR1AH = 0b00010101;
- OCR1AL = 0b00110000;
- TIMSK |=(1 << OCIE1A)|(1 << TOIE0);
- sei();
- while (1)
- {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement