Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 16000000UL
- #include <avr/io.h>
- #include <util/delay.h>
- #define set_bit(Y,bit_x) (Y |= (1<<bit_x))
- #define clr_bit(Y,bit_x) (Y &= ~(1<<bit_x))
- #define tst_bit(Y,bit_x) (Y & (1<<bit_x))
- #define cpl_bit(Y,bit_x) (Y ^= (1<<bit_x))
- #define LED PB5
- int main( )
- {
- DDRB = 0xFF; //configura todos os pinos do PORTB como saídas
- while(1) {
- set_bit(PORTB, LED); //liga LED
- _delay_ms(200); //atraso de 200 ms
- clr_bit(PORTB, LED); //desliga LED
- _delay_ms(200); //atraso de 200 ms
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement