Guest User

Untitled

a guest
Apr 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. unsigned char get_key(void)
  2. {
  3. while((col_1) && (col_2) && (col_3))
  4. {}
  5. while(1){
  6. KEYPAD_PORT=0xFB;
  7. if(!col_1)
  8. { return(1); }
  9. if(!col_2)
  10. { return(2); }
  11. if(!col_3)
  12. { return(3); }
  13.  
  14. KEYPAD_PORT=0x7F;
  15.  
  16. if(!col_1)
  17. { return(4); }
  18. if(!col_2)
  19. { return(5); }
  20. if(!col_3)
  21. { return(6); }
  22.  
  23.  
  24. KEYPAD_PORT=0xBF;
  25.  
  26. if(!col_1)
  27. { return(7); }
  28. if(!col_2)
  29. { return(8); }
  30. if(!col_3)
  31. { return(9); }
  32.  
  33. KEYPAD_PORT=0xEF;
  34.  
  35. if(!col_1)
  36. { return(10); }
  37. if(!col_2)
  38. { return(11); }
  39. if(!col_3)
  40. { return(12); }
  41. }
  42.  
  43. }
Add Comment
Please, Sign In to add comment