Advertisement
kamilnowinski

Uklad nawrotny

Nov 25th, 2011
1,155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Uklad nawrotny, program napisal: Kamil Nowinski
  2. 'enjoy
  3. '-----------------------------------------------
  4.  
  5. $regfile = "m8def.dat"
  6. $crystal = 8000000
  7.  
  8. Config Portd = Output
  9. Config Portb = Input
  10.  
  11. Portd = &B00000000
  12. Portb = &B00000000
  13.  
  14. 'S1 - Dioda1
  15. 'S2 - Dioda2
  16. 'S3 - STOP (przerwanie)
  17.  
  18. S1 Alias Portb.0
  19. S2 Alias Portb.1
  20. S3 Alias Portb.2
  21.  
  22. Dioda1 Alias Portd.0
  23. Dioda2 Alias Portd.1
  24.  
  25.  
  26. Dim Stan1 As Bit
  27. Stan1 = 1
  28.  
  29. Do
  30.  
  31.    If S1 = Stan1 Then
  32.    Gosub Zarowka1
  33.  
  34.    Elseif S2 = Stan1 Then
  35.    Gosub Zarowka2
  36.  
  37. Else
  38.  
  39. Dioda1 = 0
  40. Dioda2 = 0
  41.  
  42. End If
  43.  
  44. Loop
  45.  
  46. End
  47.  
  48.  
  49. Zarowka1:
  50. Do
  51.  
  52.   Dioda1 = Stan1
  53.   Dioda2 = 0
  54.  
  55.   If S1 = 0 And S3 = 1 Then Return
  56.  
  57. Loop
  58. End
  59.  
  60. Zarowka2:
  61. Do
  62.  
  63.   Dioda2 = Stan1
  64.   Dioda1 = 0
  65.  
  66.   If S2 = 0 And S3 = 1 Then Return
  67.  
  68. Loop
  69. End
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement