Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '****************************************************************
- '* Name : UNTITLED.BAS *
- '* Author : Alwin Winius *
- '* Notice : Copyright (c) *
- '* : All Rights Reserved *
- '* Date : 8-11-2011 *
- '* Version : 1.0 *
- '* Notes : *
- '* : *
- '****************************************************************
- Device 16F690 ;We gebruiken een 16F690 type
- Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, MCLRE_OFF, CP_OFF, CPD_OFF, BOR_OFF, IESO_OFF, FCMEN_OFF
- All_Digital TRUE ;Alle ingangen digitaal
- ;76543210
- ADCON0 = %00000000
- ANSEL = %00000000
- ANSELH = %00000000
- WPUA = %00000000
- IOCA = %00000000
- ;76543210
- TRISA = %00000111
- TRISB = %01010000
- TRISC = %00000111
- Dim Status1 As Bit
- Dim Status2 As Bit
- Dim Status3 As Bit
- Dim Status4 As Bit
- Dim Status5 As Bit
- Dim Status6 As Bit
- Dim Status7 As Bit
- Dim Status8 As Bit
- Dim Status9 As Bit
- Dim Status10 As Bit
- Dim Vertraging1 As Byte
- Vertraging1 = 50
- Symbol Pallet_detectie1 = PORTA.0
- Symbol Pallet_rust1 = PORTA.1
- Symbol Pallet_vol1 = PORTA.2
- Symbol Inladen1 = PORTA.4
- Symbol Uitladen1 = PORTA.5
- Symbol Pallet_detectie2 = PORTC.0
- Symbol Pallet_rust2 = PORTC.1
- Symbol Pallet_vol2 = PORTC.2
- Symbol Inladen2 = PORTC.4
- Symbol Uitladen2 = PORTC.5
- Symbol Programswitch = PORTB.6
- While 1 = 1
- ;/////////////////////////PROGRAM MAIN//////////////////////////////////////////
- Program_main:
- If Programswitch = 1 Then ;Als programmaswitch hoog is da programma laden uitvoeren. (pull up weerstand)
- GoTo Program_laden
- EndIf
- If Programswitch = 0 Then ;Als programmaswitch laag is dan programma lossen uitvoeren. (gebruikerinput)
- GoTo Program_lossen
- EndIf
- ;/////////////////////////PROGRAM LADEN BAND 1//////////////////////////////////
- Program_laden:
- Status1 = 0
- Status2 = 0
- Status3 = 0
- Status4 = 0
- Status5 = 0
- Status6 = 0
- If Programswitch = 0 Then ;Kijken of voorwaarde nog steeds actief is.
- GoTo Program_main ;Indien voorwaarde veranderd is programma sluiten en terug naar programma lossen
- EndIf
- Repeat
- If Pallet_detectie1 = 1 And Pallet_vol1 = 0 Then ;Inladen pallets starten
- Low Inladen1
- DelayMS Vertraging1
- Status3 = 0
- ElseIf Pallet_rust1 = 1 And Status1 = 0 Then ;stoppen pallets bij rust positie eerste pallet. (1 puls)
- High Inladen1
- DelayMS Vertraging1
- Status1 = 1
- ElseIf Pallet_rust1 = 0 And Status1 = 1 And Status2 = 0 Then ;puls 1 registreren.
- Status2 = 1
- DelayMS Vertraging1
- ElseIf Pallet_rust1 = 1 And Status2 = 1 Then ;puls 2 registreren.
- Status2 = 0
- Status3 = Status3 + 1
- DelayMS Vertraging1
- ElseIf Status3 = 3 Then ;stoppen pallets nadat 1 pallet reeds geladen is. (3 pulsen)
- High Inladen1
- Status3 = 0
- DelayMS Vertraging1
- ElseIf Pallet_vol1 = 1 Then ;stoppen lopende band bij band vol
- High Inladen1
- DelayMS Vertraging1
- EndIf
- ;/////////////////////////PROGRAM LADEN BAND 1//////////////////////////////////
- If Pallet_detectie2 = 1 And Pallet_vol2 = 0 Then ;Inladen starten
- Low Inladen2
- DelayMS Vertraging1
- Status6 = 0
- ElseIf Pallet_rust2 = 1 And Status4 = 0 Then ;stoppen pallets bij rust positie eerste lading. (1 puls)
- High Inladen2
- DelayMS Vertraging1
- Status4 = 1
- ElseIf Pallet_rust2 = 0 And Status4 = 1 And Status5 = 0 Then ;puls 1 registrerem
- Status2 = 1
- DelayMS Vertraging1
- ElseIf Pallet_rust2 = 1 And Status5 = 1 Then ;Puls 2 registreren
- Status5 = 0
- Status6 = Status6 + 1
- DelayMS Vertraging1
- ElseIf Status6 = 3 Then ;stoppen pallets nadat 1 pallet reeds geladen is. (3 pulsen)
- High Inladen2
- Status6 = 0
- DelayMS Vertraging1
- ElseIf Pallet_vol2 = 1 Then ;stoppen lopende band bij band vol
- High Inladen2
- DelayMS Vertraging1
- EndIf
- Until Programswitch = 0 ;Programma uitvoeren tot programswitch is veranderd
- ;////////////////////////PROGRAM LOSSEN/////////////////////////////////////////
- Program_lossen:
- Status7 = 0
- Status8 = 0
- Status9 = 0
- Status10 = 0
- If PORTB.6 = 1 Then ;Kijken of voorwaarde nog steeds actief is.
- GoTo Program_main ;Indien voorwaarde veranderd is programma afsluiten en terug naar laden
- EndIf
- Repeat
- If Pallet_detectie1 = 0 And Status7 = 0 Then ;Pallets uitladen band starten.
- Low Uitladen1
- Status7 = 1
- DelayMS Vertraging1
- ElseIf Pallet_detectie1 = 1 And Status7 = 1 Then ;1ste puls registeren
- Status7 = 0
- Status8 = Status8 + 1
- DelayMS Vertraging1
- ElseIf Status8 = 2 Then ;2de puls uitladen stoppen
- High Uitladen1
- DelayMS Vertraging1
- Status8 = 0
- EndIf
- If Pallet_detectie2 = 0 And Status9 = 0 Then ;pallets uitladen, band starten.
- Low Uitladen2
- Status9 = 1
- DelayMS Vertraging1
- ElseIf Pallet_detectie2 = 1 And Status9 = 1 Then ;1ste puls registeren
- Status9 = 0
- Status10 = Status10 + 1
- DelayMS Vertraging1
- ElseIf Status10 = 2 Then ;2de puls uitladen stoppen
- High Uitladen2
- DelayMS Vertraging1
- Status10 = 0
- EndIf
- Until Programswitch = 1 ;Programma uitvoeren totdat programmaswitch veranderd.
- Wend ;Einde programma
- End
Add Comment
Please, Sign In to add comment