Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. ISR(INT4_vect){    
  2.    
  3.     //if(first_start == 0){
  4.         //first_start = 1;
  5.     //}else{
  6.         hopper_pulse++;
  7.  
  8.         btn_enabled = 0;
  9.        
  10.         if(hopper_pulse == coin_for_out){
  11.             EIMSK &= ~(1<<INT4);
  12.             //TCNT3 = 0;
  13.             //START_HOPPER_TIMER;                  
  14.             PORTJ &=~ (1<<PJ2);
  15.             hopper_complete = 0;
  16.             coin_for_out=0;
  17.             hopper_pulse = 0;
  18.             PORTJ &= ~(1<<PJ4);
  19.             //START_BTN_TIMER;
  20.         }
  21.    
  22.     //}
  23.    
  24. }
  25.  
  26.         if (!(PINA & (1<<PA3)) ){
  27.                                        
  28.  
  29.             //btn_pressed_flag = 1;
  30.             if(bill_summ>49 & btn_enabled == 1){//  
  31.                 PORTJ |= (1<<PJ5);
  32.                 btn_enabled = 0;               
  33.                 //coin_for_out = 1;            
  34.                 coin_for_out = bill_summ / COIN_PRICE;
  35.                 summ_reciept = coin_for_out*COIN_PRICE;
  36.                 bill_summ = bill_summ - (coin_for_out*COIN_PRICE);//               
  37.                 first_start = 0;
  38.                 send_sale(summ_reciept);                       
  39.                 hopper_pulse = 0;
  40.                 EIMSK |= (1<<INT4);            
  41.                 out_coin();
  42.                 printSumm(bill_summ);
  43.                 PORTJ &= ~(1<<PJ5);    
  44.                        
  45.             }      
  46.         }
  47.  
  48.     void out_coin(){   
  49.    
  50.     PORTJ |= (1<<PJ2);
  51.     PORTJ |= (1<<PJ4);//LED ON
  52.     //START_HOPPER_TIMER;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement