Alx09

Ardiono2

Apr 12th, 2021
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2.  
  3. const int rs = 8, en = 9, d4 = 2, d5 = 3, d6 = 4, d7 = 5;
  4. LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
  5.  
  6. void setup()
  7. {
  8.   DDRD|=0x40;//setare Timer0 mod Fast PWM
  9.   TCCR0A=0x83;
  10.   TCCR0B=0x02;//setare comunicatie cu aceiasi parametri ca si emitatorul
  11.   UBRR0=0x67;//9600 baud UBRR=103
  12.   UCSR0B=(1<<RXEN0);//validare receptie
  13.   UCSR0C=(1<<USBS0)|(1<<UCSZ00)|(1<<UCSZ01);//2 biti stop,8 bit data
  14.   lcd.begin(16, 2);
  15. }
  16. void loop()
  17. {
  18.   lcd.setCursor(0, 0);
  19.   while(!(UCSR0A&(1<<RXC0)))delay(10);//asteapta un numar receptionat in UDR0
  20.   lcd.write(UDR0);
  21.   delay(10);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment