Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 1000000UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- int main(void)
- {
- DDRB|= (1<<PINB0);
- PORTB|= (1<<PINB0);
- int UBRR_val=25;
- UBRR0H = (unsigned char) (UBRR_val >> 8);
- UBRR0L = (unsigned char) UBRR_val;
- UCSR0B = (1 << RXEN0) | (1 << TXEN0);
- UCSR0C |= (1 << USBS0) | (3 << UCSZ00);
- unsigned char data;
- while(1)
- {
- while ( !(UCSR0A &(1 <<RXC0)) );
- data = UDR0;
- if (data = 0b11111111)
- {
- PORTB^= (1<<PINB0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement