Advertisement
Guest User

Untitled

a guest
May 26th, 2017
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. /* Prace na PHS v0.4.0 (20.05.2010) by Bystroushaak (bystrousak@kitakitsune.org)
  2.  
  3.  *
  4.  
  5.  * Poznamky;
  6.  
  7.  *
  8.  
  9. */
  10.  
  11.  
  12.  
  13. #include "displej.c"
  14.  
  15. #include "own_functions.c"
  16.  
  17.  
  18.  
  19. void printStartMessage(void){
  20.  
  21.     clrdsp();
  22.  
  23.     puts("  Vlna nahoru\nStart: 0 Stop: 3");
  24.  
  25. }
  26.  
  27.  
  28.  
  29. void printPauseMessage(void){
  30.  
  31.     clrdsp();
  32.  
  33.     puts("Provadim ...\nPauza: 3");
  34.  
  35. }
  36.  
  37.  
  38.  
  39. void waitForKey(char key){
  40.  
  41.     char oldch, ch;
  42.  
  43.    
  44.  
  45.     while ((ch = getchar()) != key){
  46.  
  47.         oldch = ch;
  48.  
  49.     }
  50.  
  51.    
  52.  
  53.     beep();
  54.  
  55. }
  56.  
  57.  
  58.  
  59. void main(void){
  60.  
  61.     int var = 0;
  62.  
  63.     byte i = 11;   
  64.  
  65.     byte stat = 0;
  66.  
  67.     char counter = 0;
  68.  
  69.    
  70.  
  71.     init_interrupts();
  72.  
  73.     LCD_Init();
  74.  
  75.     ledBarInit();
  76.  
  77.    
  78.  
  79.     printStartMessage();
  80.  
  81.     waitForKey('0');
  82.  
  83.    
  84.  
  85.     //ledBarShow(var);
  86.  
  87.     //waitam();
  88.  
  89.     while (1){
  90.  
  91.         while (i--){
  92.  
  93.             if (!stat){        
  94.  
  95.                 var = setBitUInt(var, i - 1, 1);
  96.  
  97.                 counter++;
  98.  
  99.             }else{
  100.  
  101.                 var = setBitUInt(var, i - 1, 0);
  102.  
  103.                 counter--;
  104.  
  105.             }
  106.  
  107.            
  108.  
  109.             if (counter == 0)
  110.  
  111.                 continue;
  112.  
  113.  
  114.  
  115.             ledBarShow(var);
  116.  
  117.             waitam();  
  118.  
  119.         }
  120.  
  121.         i = 11;
  122.  
  123.         stat = ~stat;
  124.  
  125.     }  
  126.  
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement