Sawy3R11

lab1_mikro

Mar 13th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <lcd.h>
  2. #include <stdio.h>
  3.  
  4. void czekaj();
  5. int main(){
  6. unsigned char znak = '\0';
  7. unsigned char memo= '\0';
  8. unsigned int ciag = 0;
  9. unsigned int flaga = 0;
  10. unsigned int ifEnter = 0;
  11.  
  12. lcd_init();
  13. out_instr(0x01);
  14. czekaj();
  15.  
  16. while(1)
  17. {
  18. znak = get_kb();
  19. if(znak=='\0')
  20. memo=znak;
  21. if (memo!=znak) {
  22. czekaj();
  23. if((znak >='0') && (znak<='9'))
  24. {
  25. if(flaga==1){
  26. out_instr(0x01);
  27. flaga=0;}
  28. out_char(znak);
  29. memo = znak;
  30. ciag = ciag*10 + ((int)znak -48);
  31. ifEnter = 0;
  32.  
  33. }
  34.  
  35.  
  36. else if(znak == 'e' && ifEnter == 0) {
  37.  
  38. flaga=1;
  39. out_char(ciag);
  40. memo = znak;
  41. ciag = 0;
  42. ifEnter = 1;
  43. }
  44. }
  45. }
  46.  
  47. }
  48.  
  49. void czekaj() {
  50.  
  51. int i=0;
  52.  
  53. while(1) {
  54. i++;
  55. if(i==30000) break;
  56. }
  57. }
Add Comment
Please, Sign In to add comment