Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Device 16F628A                ;We gebruiken een 16F628A type
  2. Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF
  3. All_Digital TRUE              ;Alle ingangen digitaal
  4.  
  5. Dim Servo1 As Byte
  6. Dim servo2 As Byte
  7. Dim teller As Byte
  8. Dim Teller1 As Byte
  9. Dim Alarmlichten As Byte
  10. Dim counter1 As Byte
  11.  
  12. Symbol Kniptijd1 = 350
  13. Symbol Remtijd1 = 500
  14. Symbol Servopulsin1 =       PORTB.1
  15. Symbol Servopulsin2 =       PORTB.2
  16. Symbol Knipperlicht1 =      PORTB.3
  17. Symbol Knipperlicht2 =      PORTB.4
  18. Symbol Remlicht =           PORTB.5
  19. Symbol Achteruitrijlicht =  PORTB.6
  20.  
  21. Main:
  22.  
  23.  
  24.  
  25.     If teller = 35 Then
  26.         GoTo Eind
  27.     EndIf      
  28.    
  29. For teller = 0 To 50
  30. DelayMS 350
  31.        
  32.     Servo1 = PulsIn Servopulsin1 , 1  
  33.     servo2 = PulsIn Servopulsin2 , 1
  34.    
  35.  
  36.         If Servo1 > 121 And Servo1 < 179 Then
  37.             Low Knipperlicht1
  38.             Low Knipperlicht2            
  39.         EndIf
  40.        
  41.         If Servo1 < 120 Then
  42.             Toggle Knipperlicht1
  43.             Low Knipperlicht2
  44.         EndIf
  45.                
  46.         If Servo1 > 180 Then
  47.             Toggle Knipperlicht2
  48.             Low Knipperlicht1
  49.         EndIf                  
  50.  
  51.             If servo2 > 121 And servo2 < 179 Then
  52.                 Low Remlicht
  53.                 Low Achteruitrijlicht          
  54.             EndIf
  55.            
  56.     If counter1 = 1 And servo2 >120 Then
  57.         High Remlicht
  58.         counter1 = 0
  59.     EndIf
  60.        
  61.    
  62.     If servo2 < 140 Then
  63.         counter1 = 1
  64.     EndIf
  65.    
  66.     If servo2 > 160 Then
  67.         High Remlicht
  68.     EndIf
  69.            
  70.             If servo2 > 175 Then
  71.                 High Achteruitrijlicht
  72.                 Low Remlicht
  73.             EndIf
  74.  
  75. Next
  76.  
  77. GoTo Main
  78.  
  79. Eind:
  80.         Low Knipperlicht1
  81.         Low Knipperlicht2        
  82.         Low Remlicht
  83.         Low Achteruitrijlicht
  84.         teller = 0
  85.  
  86. GoTo Main              
  87.  
  88. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement