Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.87 KB | None | 0 0
  1. #include <REGX51.H>
  2.  
  3. void main(void)
  4. {
  5.     unsigned char wiersze[4] = {0xF7,0xEF,0xDF,0xBF};
  6.     unsigned char wartosci[12] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0B,0x00,0x0A};
  7.     unsigned char wyjscie1=0;
  8.     unsigned char wyjscie2=0;
  9.  
  10.     char i = 0;
  11.     P3=0x00;
  12.  
  13.     while(1)
  14.     {
  15.         P1 = wiersze[i];
  16.         if(P1 == wiersze[i]) {;}
  17.         else
  18.         {
  19.             if(P1_0==0)
  20.             {
  21.                 if(i==3)
  22.                 {
  23.                     wyjscie1 = 0;
  24.                     wyjscie2 = 0;
  25.                     P3=0x00;
  26.                 }
  27.                 else
  28.                 {
  29.                     wyjscie2 = wyjscie1;
  30.                     wyjscie1 = wartosci[i*3];
  31.                     for(;;)
  32.                     {
  33.                         if(P1_0 == 0)
  34.                         {;}
  35.                         else
  36.                             break;
  37.                     }
  38.                 }
  39.             }
  40.             else if(P1_1 == 0)
  41.             {
  42.                 wyjscie2 = wyjscie1;
  43.                 wyjscie1 = wartosci[i*3 + 1];
  44.  
  45.  
  46.                 for(;;)
  47.                 {
  48.                     if(P1_1 == 0)
  49.                     {;}
  50.                     else
  51.                         break;
  52.                 }
  53.             }
  54.             else if(P1_2 == 0)
  55.             {
  56.                 if(i == 3)
  57.                 {
  58.                     P3 = wyjscie1|(wyjscie2 <<4);
  59.                 }
  60.                 else
  61.                 {
  62.                     wyjscie2 = wyjscie1;
  63.                     wyjscie1 = wartosci[i*3+2];
  64.                 }
  65.                 for(;;)
  66.                 {
  67.                     if(P1_2 == 0)
  68.                     {;}
  69.                     else
  70.                         break;
  71.                 }
  72.             }
  73.  
  74.         }
  75.         if(i == 3)
  76.             i = 0;
  77.         else
  78.             i++;
  79.  
  80.     }
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement