Alx09

Cod prima placă

Apr 17th, 2021
784
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned char i;
  2. void setup()
  3. {
  4.   UBRR0=0x67;// 9600 baud UBRR=103
  5.   UCSR0B=(1<<TXEN0);//validare transmisie
  6.   UCSR0C=(1<<USBS0)|(1<<UCSZ00)|(1<<UCSZ01);// 2 biti stop,8 bit data
  7.   DDRC = 0x0F;
  8.   DDRB = 0x00;
  9. }
  10. void loop()
  11. {
  12.  
  13.   while(!(UCSR0A&(1<<UDRE0)));
  14.   PORTC = 0x08;
  15.   switch (PINB & 0x0F){
  16.     case 0x01: UDR0 = '1'; break;
  17.     case 0x02: UDR0 = '2'; break;
  18.     case 0x04: UDR0 = '3'; break;
  19.     case 0x08: UDR0 = 'A'; break;
  20.   }
  21.  
  22.   PORTC = 0x04;
  23.   switch (PINB & 0x0F){
  24.     case 0x01: UDR0 = '4'; break;
  25.     case 0x02: UDR0 = '5'; break;
  26.     case 0x04: UDR0 = '6'; break;
  27.     case 0x08: UDR0 = 'B'; break;
  28.   }
  29.  
  30.   PORTC = 0x02;
  31.   switch (PINB & 0x0F){
  32.     case 0x01: UDR0 = '7'; break;
  33.     case 0x02: UDR0 = '8'; break;
  34.     case 0x04: UDR0 = '9'; break;
  35.     case 0x08: UDR0 = 'C'; break;
  36.   }
  37.  
  38.   PORTC = 0x01;
  39.   switch (PINB & 0x0F){
  40.     case 0x01: UDR0 = '*'; break;
  41.     case 0x02: UDR0 = '0'; break;
  42.     case 0x04: UDR0 = '#'; break;
  43.     case 0x08: UDR0 = 'D'; break;
  44.   }
  45.   delay(10);
  46. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×