Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #define F_CPU 16000000UL
  2.  
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5.  
  6. #define set_bit(Y,bit_x) (Y |= (1<<bit_x))
  7. #define clr_bit(Y,bit_x) (Y &= ~(1<<bit_x))
  8. #define tst_bit(Y,bit_x) (Y & (1<<bit_x))
  9. #define cpl_bit(Y,bit_x) (Y ^= (1<<bit_x))
  10.  
  11.  
  12. #define LED PB5
  13.  
  14. int main( )
  15. {
  16. DDRB = 0xFF; //configura todos os pinos do PORTB como saídas
  17. while(1) {
  18. set_bit(PORTB, LED); //liga LED
  19. _delay_ms(200); //atraso de 200 ms
  20. clr_bit(PORTB, LED); //desliga LED
  21. _delay_ms(200); //atraso de 200 ms
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement