pawelkl

c---klawiatura

Apr 7th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <REGX52.H>
  2.  
  3. unsigned char key;
  4. unsigned char key1;
  5.  
  6. void analiza (unsigned char x, unsigned char y)
  7.   {
  8.     if(x != y) P2 = x;
  9.   }
  10.  
  11.  
  12. void main(void)
  13.   {
  14.     while(1)
  15.       {
  16.  
  17.         P0 = 0xFE; //  1111 1110
  18.         key1 = 0xFE;
  19.         key = P0;
  20.         analiza(key,key1);
  21.  
  22.         P0 = 0xFD; //  1111 1101
  23.         key1 = 0xFD;
  24.         key = P0;
  25.         analiza(key,key1);
  26.                        
  27.         P0 = 0xFB; //  1111 1011
  28.         key1 = 0xFB;
  29.         key = P0;
  30.         analiza(key,key1);
  31.  
  32.         P0 = 0xF7; //  1111 0111
  33.         key1 = 0xF7;
  34.         key = P0;
  35.         analiza(key,key1);
  36.  
  37.       }
  38.   }
Advertisement
Add Comment
Please, Sign In to add comment