58 lines
868 B
C
58 lines
868 B
C
#include<avr/io.h>
|
|
#include <avr/interrupt.h>
|
|
|
|
volatile uint8_t id;
|
|
volatile uint8_t state;
|
|
volatile int8_t dir = -1;
|
|
|
|
// ISR(TIMER2_OVF_vect)
|
|
// {
|
|
// if(state == 0){
|
|
// PORTC &= ~(1<<id);
|
|
// }else{
|
|
// PORTC |= (1<<id);
|
|
// id = (id + dir) % 8;
|
|
// }
|
|
|
|
// state = (state+1) % 2;
|
|
// }
|
|
|
|
// ISR(PCINT1_vect){
|
|
// if(dir == 1)
|
|
// dir = -1;
|
|
// else
|
|
// dir = 1;
|
|
// }
|
|
|
|
int main(void) {
|
|
// DDRC = (0xff);
|
|
// PORTC = (0xff);
|
|
|
|
|
|
DDRB |= _BV(DDB3);
|
|
PORTB &= ~_BV(PORTB3);
|
|
|
|
// timer int
|
|
// TCCR2B |= _BV(CS22) | _BV(CS21) | _BV(CS20);
|
|
// TIMSK2 |= _BV(TOIE2);
|
|
|
|
// EICRA |= _BV(ISC11) | _BV(ISC10);
|
|
// EIMSK |= _BV(INT1);
|
|
|
|
// enable for pin 8 - PB0
|
|
// PCMSK1 |= _BV(PCINT8);
|
|
// PCICR |= _BV(PCIE1);
|
|
|
|
// sei();
|
|
|
|
TCCR0A |= _BV(COM0A0);
|
|
TCCR0A &= ~_BV(COM0A1);
|
|
|
|
TCCR0B |= _BV(CS02) | _BV(CS00);
|
|
TCCR0B &= ~_BV(CS01);
|
|
|
|
|
|
for(;;);
|
|
|
|
return 0;
|
|
}
|