Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. /*
  2.  * Sequencer.c
  3.  *
  4.  * Created: 26.09.2017 13:18:08
  5.  * Author : Miłosz
  6.  */
  7.  
  8. #define F_CPU 1000000UL
  9. #define sei()
  10.  
  11. #include <avr/io.h>
  12. #include <avr/interrupt.h>
  13. #include <util/delay.h>
  14.  
  15.  
  16. //wyjscia
  17. #define bit1 PD0
  18. #define bit2 PD1
  19. #define bit3 PD2
  20. #define bit4 PD3
  21.  
  22. void main(void)
  23. {
  24. //  rezystor podciągający do Vcc
  25.     PORTB = 0xff;
  26.     PORTC = 0xff;
  27.     PORTD = 0xf0;
  28.    
  29. //  wyjścia
  30.     DDRD |= (1<<bit1) | (1<<bit2) | (1<<bit3) | (1<<bit4);
  31.    
  32.  
  33.     TCCR0 |= (1<<CS02) | (1<<CS00);
  34.     TIMSK |= (1<<TOIE0);
  35.     TCNT0=0;
  36.    
  37.     PORTD |= (1<<bit1);
  38.  
  39. }
  40.  
  41.  
  42. sei();
  43.  
  44.         ISR(TIMER0_OVF_vect)
  45.         {
  46.             PORTD ^= (1<<bit1);
  47.             PORTD ^= (1<<bit2);
  48.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement