Advertisement
ivosexa

reveiver

Feb 3rd, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #define F_CPU 1000000UL
  2. #include <avr/io.h>
  3. #include <avr/interrupt.h>
  4.  
  5. int main(void)
  6. {
  7. DDRB|= (1<<PINB0);
  8. PORTB|= (1<<PINB0);
  9.  
  10. int UBRR_val=25;
  11.  
  12. UBRR0H = (unsigned char) (UBRR_val >> 8);
  13. UBRR0L = (unsigned char) UBRR_val;
  14. UCSR0B = (1 << RXEN0) | (1 << TXEN0);
  15. UCSR0C |= (1 << USBS0) | (3 << UCSZ00);
  16.  
  17. unsigned char data;
  18.  
  19. while(1)
  20. {
  21. while ( !(UCSR0A &(1 <<RXC0)) );
  22.  
  23. data = UDR0;
  24.  
  25. if (data = 0b11111111)
  26. {
  27. PORTB^= (1<<PINB0);
  28. }
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement