SHARE
TWEET

Untitled

a guest Jan 24th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Myfun.h"
  2.  
  3. extern volatile uint32_t tick2,lcdvalue;
  4. extern volatile uint8_t stan;
  5.  
  6. int main(void)
  7. {
  8.  
  9.     SysTick_Config(4000000 / 1000);
  10.     Led_Conf();
  11.     Joy_Conf();
  12.     LCD7seg_conf();
  13.  
  14.     while(1)
  15.     {
  16.        
  17.        
  18.         if(stan == 0){
  19.             if(Joy_Read() == Up) tick2++;
  20.             if(Joy_Read() == Down && tick2 > 0) tick2--;
  21.             delay_ms(100);
  22.         }
  23.         if(Joy_Read() == Center) stan = 1;
  24.  
  25.        
  26.     }
  27. }
  28.  
  29.  
  30.  
  31. ///////////////// Myfun.c
  32.  
  33. volatile uint32_t tick = 0,tick2 = 500;
  34. volatile uint32_t lcdvalue;
  35. volatile uint8_t stan = 0;
  36.  
  37.  
  38. void SysTick_Handler(void) //przrwanie od systick
  39. {
  40.     tick++;
  41.    
  42.     lcdvalue = tick2;
  43.     if(stan == 1){
  44.         tick2--;
  45.        
  46.         if(tick2 <= 0){
  47.             Led_OnOff(8,LedOn);
  48.             stan = 0;
  49.             tick2 = 0;
  50.         }
  51.            
  52.     }
  53.     Lcd7seg_WriteNumber();
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top