csansoon

Sistema anti rebots CI

Oct 30th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. //Anti rebots sense interrupcions
  2. boto_ant = 0;
  3. if (boto && !boto_ant)
  4. {
  5.     __delay_ms(10);
  6.     if (boto)
  7.     {
  8.         tractament_boto();
  9.     }
  10. }
  11. boto_ant = boto
  12.  
  13.  
  14. //Anti rebots amb interrupcions
  15. RSI()
  16. {
  17.     if (INT1IE && INT1IF)
  18.     {
  19.         if (boto)
  20.         {
  21.             INT1IE = 0;
  22.             tractament_boto();
  23.         }
  24.     }
  25.     INT1IF = 0;
  26. }
  27.  
  28. main()
  29. {
  30.     if (INT1IE == 0)
  31.     {
  32.         __delay_ms(s);
  33.         INT1IE = 1;
  34.         INT1IF = 0;
  35.     }
  36. }
Add Comment
Please, Sign In to add comment