Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Cezary Zaprawa
- //Jedna dioda swieci 500/2000ms
- //Częstotliwość: 1MHz
- #include <avr/io.h>
- #include <avr/interrupt.h>
- ISR(TIMER1_COMPA_vect) {
- PORTA &= ~(1 << 0);
- }
- ISR(TIMER1_OVF_vect) {
- PORTA |= (1 << 0);
- }
- void init() {
- cli();
- DDRA |= (1 << 0);
- PORTA |= (1 << 0);
- OCR1A = 7813;
- ICR1 = 31250;
- TCCR1A |= (1 << WGM11);
- TCCR1B |= (1 << WGM12) | (1 << WGM13);
- TIMSK |= (1 << OCIE1A) | (1 << TOIE1);
- TCCR1B |= (1 << CS11) | (1 << CS10);
- sei();
- }
- int main(void) {
- init();
- while(1) {
- asm("nop");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement