Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * M32-FZavadil-blikac.c
- *
- * Created: 6. 4. 2020 22:17:55
- * Author : martin
- *
- * Ledky na PB0 a PB1
- * Takt Atmegy32A je na 16MHz, s nižším taktem upravit hodnotu OCR1A na nižší hodnotu
- */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- ISR(TIMER1_COMPA_vect)
- {
- static uint8_t cas=0;
- cas++;
- if (cas==1 || cas==3) PORTB|=(1<<PB0); else PORTB&=~(1<<PB0);
- if (cas==5 || cas==7) PORTB|=(1<<PB1); else PORTB&=~(1<<PB1);
- if (cas>9) cas=0;
- }
- int main(void)
- {
- DDRB|=(1<<PB1)|(1<<PB0);
- TCCR1B |= (1<<WGM12)|(1<<CS12); // CTC + /1024
- OCR1A = 5000;
- TIMSK|=(1<<OCIE1A);
- sei();
- /* Replace with your application code */
- while (1)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement