'*********************************************************************
'* Name : CV-pomp schakelprint *
'* Author : Stijn Coenen [Stynus] *
'* Notice : Copyright (c) 2009 Stijn Coenen *
'* : All Rights Reserved *
'* Date : 2/11/2009 *
'* Version : 1.1 *
'* elektronicastynus.be/Projecten/IO/CV_pomp_schakelprint/index.php *
'*********************************************************************
Device 16F627A
Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF
All_Digital TRUE
Dim Therm1Bit As Bit
Dim Therm2Bit As Bit
Dim Therm3Bit As Bit
Dim LaatsteAan As Byte
Symbol Pomp1 = PORTA.2
Symbol Pomp2 = PORTA.3
Symbol Pomp3 = PORTB.2
Symbol Ketel = PORTB.3
Symbol Therm1 = PORTB.7
Symbol Therm2 = PORTB.6
Symbol Therm3 = PORTB.5
Symbol NaPomp = PORTB.4
TRISA = %00000000
TRISB = %11110000
Symbol Aan = 1
Symbol Uit = 0
Clear
DelayMS 500
'****************************************************************
While 1 = 1
'************************************************************
'Ketel aan/uit zetten
If Therm1 = 0 Or Therm2 = 0 Or Therm3 = 0 Then
Ketel = Aan
Else
Ketel = Uit
EndIf
'************************************************************
'Bijhouden welke thermostaat het laatste aanging
If Therm1 = 0 Then 'And Therm1Bit = 0 Then
'Therm1Bit = 1
LaatsteAan = 1
' EndIf
' If Therm1 = 1 And Therm1Bit = 1 Then
' Therm1Bit = 0
EndIf
'
If Therm2 = 0 Then 'And Therm2Bit = 0 Then
' Therm2Bit = 1
LaatsteAan = 2
' EndIf
' If Therm2 = 1 And Therm2Bit = 1 Then
' Therm2Bit = 0
EndIf
'
If Therm3 = 0 Then 'And Therm3Bit = 0 Then
' Therm3Bit = 1
LaatsteAan = 3
'EndIf
' If Therm3 = 1 And Therm3Bit = 1 Then
' Therm3Bit = 0
EndIf
'************************************************************
'Pompen aansturen
'Pomp1
If Therm1 = 0 Then
'Pomp aan afhankelijk van de ingang vd cv ketel
P1: If NaPomp = 0 Then
Pomp1 = Aan
Else
If NaPomp = 0 Then GoTo P1
Pomp1 = Uit
EndIf
Else
'De thermostaat is uit
'Controleren of deze thermostaat het laatste aanging:
If LaatsteAan = 1 Then
'Het laatste aan
L1: If NaPomp = 1 Then
DelayMS 2
If NaPomp = 0 Then GoTo L1
'Als de napompen uitgang uit is dan uitvallen
Pomp1 = Uit
EndIf
Else
'Niet het laatste aan
Pomp1 = Uit
EndIf
EndIf
'Pomp2
If Therm2 = 0 Then
'Pomp aan afhankelijk van de ingang vd cv ketel
P2: If NaPomp = 0 Then
Pomp2 = Aan
Else
If NaPomp = 0 Then GoTo P2
Pomp2 = Uit
EndIf
Else
'De thermostaat is uit
'Controleren of deze thermostaat het laatste aanging:
If LaatsteAan = 2 Then
'Het laatste aan
L2: If NaPomp = 1 Then
DelayMS 2
If NaPomp = 0 Then GoTo L2
'Als de napompen uitgang uit is dan uitvallen
Pomp2 = Uit
EndIf
Else
'Niet het laatste aan
Pomp2 = Uit
EndIf
EndIf
'Pomp3
If Therm3 = 0 Then
'Pomp aan afhankelijk van de ingang vd cv ketel
P3: If NaPomp = 0 Then
Pomp3 = Aan
Else
If NaPomp = 0 Then GoTo P3
Pomp3 = Uit
EndIf
Else
'De thermostaat is uit
'Controleren of deze thermostaat het laatste aanging:
If LaatsteAan = 3 Then
'Het laatste aan
L3: If NaPomp = 1 Then
DelayMS 2
If NaPomp = 0 Then GoTo L3
'Als de napompen uitgang uit is dan uitvallen
Pomp3 = Uit
EndIf
Else
'Niet het laatste aan
Pomp3 = Uit
EndIf
EndIf
Wend
End