Hi, I still have some problems. I have added percent scale of runtime. If one of start times is true then percent scale crashed (pic below). I cannot set a flag inside my Main Loop because then is problem with button's reaction. I think the code of my interrupt is very very difficult. I am beginner and i do not know do it easier. I think it is a complicated system because i compare four start times of eight valves, weekday of eight valves etc. I would like compare start times in the my interrupt because it ensures comparing during browsing my menu.
[code:1:4ab90fe45b]
$regfile = "m644pdef.dat"
$hwstack = 80
$swstack = 100
$framesize = 80
$lib "glcdKS108.lbx"
$lib "datetime.lbx"
'$lib "mcsbyte.lbx"
Const Xtal = 8000000
$crystal = Xtal
$baud = 19200
Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portd , Ce = 2 , Ce2 = 3 , Cd = 4 , Rd = 5 , Reset = 7 , Enable = 6
Config Scl = Porta.1
Config Sda = Porta.2
Config I2cdelay = 5
Dim Year As Byte
Dim Month As Byte
Dim Day As Byte
Dim Weekday As Byte
Dim Hours As Byte
Dim Minutes As Byte
Dim Seconds As Byte
Dim S_hours As String * 2
Dim S_year As String * 3
Dim S_minutes As String * 2
Dim S_seconds As String * 2
Dim Read_time As Bit
Dim Hours_sett As Byte
Dim Minutes_sett As Byte
Dim Seconds_sett As Byte
Dim Weekday_sett As Byte
Dim Hodiny As Byte
Dim Minuty As Byte
Dim S_hodiny As String * 2
Dim S_minuty As String * 2
Dim Dnivtyzdni As Byte
Dim A As Byte
Dim U As Byte
Dim Back As Integer
Dim S As Long
'Dim X_temp As Byte
Dim Lsecofday As Long
Dim Lsyssec As Long
Dim Lsyssec1 As Long
Dim Lsyssec11 As Long
Dim Lsyssec2 As Long
Dim Lsyssec22 As Long
Dim Lsecofday2 As Long
Dim Lsyssec3 As Long
Dim Lsyssec33 As Long
Dim Lsecofday3 As Long
Dim Lsyssec4 As Long
Dim Lsyssec44 As Long
Dim Lsecofday4 As Long
Dim Lsyssec5 As Long
Dim Lsyssec55 As Long
Dim Lsecofday5 As Long
Dim Lsyssec6 As Long
Dim Lsyssec66 As Long
Dim Lsecofday6 As Long
Dim Lsyssec7 As Long
Dim Lsyssec77 As Long
Dim Lsecofday7 As Long
Dim Lsyssec8 As Long
Dim Lsyssec88 As Long
Dim Lsecofday8 As Long
'Dim Sec_a1 As Word
'Config Clock = User
'Dim Lvar1 As Long
Dim Bsec As Byte , Bmin As Byte , Bhour As Byte
Dim Bsec1 As Byte , Bmin1 As Byte , Bhour1 As Byte
Dim Bsec2 As Byte , Bmin2 As Byte , Bhour2 As Byte
Dim Bsec3 As Byte , Bmin3 As Byte , Bhour3 As Byte
Dim Bsec4 As Byte , Bmin4 As Byte , Bhour4 As Byte
Dim Bsec5 As Byte , Bmin5 As Byte , Bhour5 As Byte
Dim Bsec6 As Byte , Bmin6 As Byte , Bhour6 As Byte
Dim Bsec7 As Byte , Bmin7 As Byte , Bhour7 As Byte
Dim Bsec8 As Byte , Bmin8 As Byte , Bhour8 As Byte
Dim Prog(20) As Byte
Dim Readdata As Byte
Dim S_prog(20) As String * 3
'Dim Start_eeprom As Byte
Dim Program_a1(20) As Eram Byte
Dim Program_a2(20) As Eram Byte
Dim Program_a3(20) As Eram Byte
Dim Program_a4(20) As Eram Byte
Dim Program_a5(20) As Eram Byte
Dim Program_a6(20) As Eram Byte
Dim Program_a7(20) As Eram Byte
Dim Program_a8(20) As Eram Byte
Dim Sec_runtimea1 As Word
Dim Sec_runtimea2 As Word
Dim Sec_runtimea3 As Word
Dim Sec_runtimea4 As Word
Dim Sec_runtimea5 As Word
Dim Sec_runtimea6 As Word
Dim Sec_runtimea7 As Word
Dim Sec_runtimea8 As Word
Dim Start_runtime As Bit
Dim Runtime1 As Word
Dim Runtime2 As Word
Dim Runtime3 As Word
Dim Runtime4 As Word
Dim Runtime5 As Word
Dim Runtime6 As Word
Dim Runtime7 As Word
Dim Runtime8 As Word
Dim Percenta_zavlahy As Byte
Dim Percenta_zavlahy_clear As Byte
Dim Percenta As Byte
Dim Percenta_add As Single
Dim Percenta_spolu1 As Single
Dim Percenta_spolu2 As Single
Dim Percenta_spolu3 As Single
Dim Percenta_spolu4 As Single
Dim Percenta_spolu5 As Single
Dim Percenta_spolu6 As Single
Dim Percenta_spolu7 As Single
Dim Percenta_spolu8 As Single
Dim Stop_povel As Byte
Dim Weekday_start As Byte
Dim Starta1_true As Byte , Starta2_true As Byte , Starta3_true As Byte , Starta4_true As Byte
Dim Starta5_true As Byte , Starta6_true As Byte , Starta7_true As Byte , Starta8_true As Byte
Dim Runtime_starta1 As Byte
Dim Runtime_starta2 As Byte
Dim Runtime_starta3 As Byte
Dim Runtime_starta4 As Byte
Dim Runtime_starta5 As Byte
Dim Runtime_starta6 As Byte
Dim Runtime_starta7 As Byte
Dim Runtime_starta8 As Byte
Dim Dni(7) As String * 8
Dim Inverse As Byte
Dim Inverse_a As Byte
Dim Main_selec As Byte
Dim Sett_selec As Byte
Dim Sett_automat As Byte
Dim Sett_hod As Byte
Dim Ovladanie_selec As Byte
Dim Ventil(8) As Byte
Dim Automat As String * 7
Dim Sett_program As Byte
Dim Sett_programa As Byte
Dim Starttime(4) As Byte
Dim Sett_okruh As Byte
Declare Sub Identification
Declare Sub Ukladam
Declare Sub Beep
'Declare Sub Check_time
'Declare Sub Runtime
Config Pina.0 = Input : Pina.0 = 1
Config Pina.3 = Input : Pina.3 = 1
Config Pina.4 = Input : Pina.4 = 1
Config Pina.5 = Input : Pina.5 = 1
Config Pina.7 = Output
Piezo Alias Pina.7
Up_tl Alias Pina.3
Down_tl Alias Pina.0
Go_tl Alias Pina.4
Cancel_tl Alias Pina.5
Config Debounce = 30
Config Portb = Output
Read_time = 0
Inverse = 0
Inverse_a = 0
Const Ulozit = "Ulozit"
Const Nastavenie = "Nastavenie"
Const Ovladanie = "Ovladanie"
Const Ident = "Identifikacia"
Const Nast_hodin = "Hodiny/den"
Const Nast_zavlaha = "Automat/zavlaha"
Const Dlzka_zavlahy = "Zmena zavlahy %"
Const Nast_snimac = "Snimac"
Dni(1) = "Pondelok"
Dni(2) = "Utorok "
Dni(3) = "Streda "
Dni(4) = "Stvrtok "
Dni(5) = "Piatok "
Dni(6) = "Sobota "
Dni(7) = "Nedela "
Config Timer1 = Timer , Prescale = 256
On Ovf1 Interrupt
Enable Interrupts
Enable Timer1
Start Timer1
'--------------------------------Start------------------------------------------
Ventil1 Alias Portb.0
Ventil2 Alias Portb.1
Ventil3 Alias Portb.2
Ventil4 Alias Portb.3
Ventil5 Alias Portb.4
Ventil6 Alias Portb.5
Ventil7 Alias Portb.6
Ventil8 Alias Portb.7
If Program_a1(1) = 255 Then
For A = 1 To 20
Program_a1(a) = 0
Program_a2(a) = 0
Program_a3(a) = 0
Program_a4(a) = 0
Program_a5(a) = 0
Program_a6(a) = 0
Program_a7(a) = 0
Program_a8(a) = 0
Next A
End If
Start_runtime = 0
Stop_povel = 0
'Ovladanie_selec = 1
Percenta_zavlahy = 78
For A = 1 To 8
Ventil(a) = 0
Next A
Start_menu:
Main_selec = 1
Call Beep
Cls
Do
Back = 0
'If Read_time = 1 Then
' Read_time = 0
'Gosub Readtime
Setfont Font16x16
Lcdat 1 , 50 , S_hours ; ":" ; S_minutes
Setfont Font5x5
Lcdat 8 , 1 , "Pon"
Lcdat 8 , 20 , "Uto"
Lcdat 8 , 39 , "Str"
Lcdat 8 , 57 , "Stv"
Lcdat 8 , 75 , "Pia"
Lcdat 8 , 94 , "Sob"
Lcdat 8 , 113 , "Ned"
Select Case Stop_povel
Case 0
Lcdat 2 , 1 , "Automat"
Case 1
Lcdat 2 , 1 , " Manual"
End Select
'Lcdat 1 , 1 , Sec_runtimea1
Select Case Weekday
Case 1
Lcdat 7 , 6 , "_" , 0
Lcdat 7 , 118 , " " , 0
Case 2
Lcdat 7 , 25 , "_" , 0
Lcdat 7 , 6 , " " , 0
Case 3
Lcdat 7 , 44 , "_" , 0
Lcdat 7 , 25 , " " , 0
Case 4
Lcdat 7 , 62 , "_" , 0
Lcdat 7 , 44 , " " , 0
Case 5
Lcdat 7 , 80 , "_" , 0
Lcdat 7 , 62 , " " , 0
Case 6
Lcdat 7 , 99 , "_" , 0
Lcdat 7 , 80 , " " , 0
Case 7
Lcdat 7 , 118 , "_" , 0
Lcdat 7 , 99 , " " , 0
End Select
Gosub Percenta_temp
Debounce Go_tl , 0 , Main_menu
'End If
Loop
'--------------------------------Hlavne menu------------------------------------
Main_menu:
Call Beep
Cls
Do
Setfont Font8x8
Lcdat 1 , 1 , " -Hlavne menu-" , 0
Setfont My6_8
If Main_selec = 1 Then
Inverse = 1
End If
Lcdat 3 , 1 , Nastavenie , Inverse
Inverse = 0
If Main_selec = 2 Then
Inverse = 1
End If
Lcdat 4 , 1 , Ovladanie , Inverse
Inverse = 0
If Main_selec = 3 Then
Inverse = 1
End If
Lcdat 5 , 1 , Ident , Inverse
Inverse = 0
Debounce Up_tl , 0 , Inc_main , Sub
Debounce Down_tl , 0 , Dec_main , Sub
Debounce Go_tl , 0 , Go_main , Sub
Debounce Cancel_tl , 0 , Start_menu , Sub
Gosub Back_start
Loop
Inc_main:
Call Beep
Back = 0
If Main_selec <= 2 Then
Main_selec = Main_selec + 1
End If
Return
Dec_main:
Call Beep
Back = 0
If Main_selec >= 2 Then
Main_selec = Main_selec - 1
End If
Return
Go_main:
Call Beep
Back = 0
If Main_selec = 1 Then
Gosub Setting_menu
End If
If Main_selec = 2 Then
Gosub Ovladanie_menu
End If
If Main_selec = 3 Then
Call Identification
End If
If Main_selec = 4 Then
Goto Start_menu
End If
Return
'-------------------------------Identifikacia-----------------------------------
Sub Identification:
Setfont Font8x8
Cls
Lcdat 1 , 1 , "-Identifikacia-" , 0
Lcdat 4 , 1 , " Automat-808/1 " , 0
Lcdat 6 , 1 , " S/N: 130105 " , 0
Wait 5
Cls
End Sub
'-------------------------------Ovladanie-----------------------------------
Ovladanie_menu:
'Call Beep
Ovladanie_selec = 1
Cls
Do
Setfont Font8x8
Lcdat 1 , 1 , " -Ovladanie-" , 0
Setfont My6_8
Lcdat 3 , 1 , "Automat: "
Select Case Stop_povel
Case 0
Automat = "zapnuty"
Case 1
Automat = "vypnuty"
End Select
If Ovladanie_selec = 1 Then
Inverse = 1
End If
Lcdat 3 , 54 , Automat , Inverse
Inverse = 0
If Stop_povel = 1 Then
Lcdat 5 , 1 , "Spustit ventil:"
If Ovladanie_selec = 2 Then
Inverse = 1
End If
Lcdat 7 , 1 , "1" , Inverse
Inverse = 0
If Ovladanie_selec = 3 Then
Inverse = 1
End If
Lcdat 7 , 12 , "2" , Inverse
Inverse = 0
If Ovladanie_selec = 4 Then
Inverse = 1
End If
Lcdat 7 , 24 , "3" , Inverse
Inverse = 0
If Ovladanie_selec = 5 Then
Inverse = 1
End If
Lcdat 7 , 36 , "4" , Inverse
Inverse = 0
If Ovladanie_selec = 6 Then
Inverse = 1
End If
Lcdat 7 , 48 , "5" , Inverse
Inverse = 0
If Ovladanie_selec = 7 Then
Inverse = 1
End If
Lcdat 7 , 60 , "6" , Inverse
Inverse = 0
If Ovladanie_selec = 8 Then
Inverse = 1
End If
Lcdat 7 , 72 , "7" , Inverse
Inverse = 0
If Ovladanie_selec = 9 Then
Inverse = 1
End If
Lcdat 7 , 84 , "8" , Inverse
Inverse = 0
If Ventil1 = 1 Then
Lcdat 6 , 1 , "-"
Else
Lcdat 6 , 1 , " "
End If
If Ventil2 = 1 Then
Lcdat 6 , 12 , "-"
Else
Lcdat 6 , 12 , " "
End If
If Ventil3 = 1 Then
Lcdat 6 , 24 , "-"
Else
Lcdat 6 , 24 , " "
End If
If Ventil4 = 1 Then
Lcdat 6 , 36 , "-"
Else
Lcdat 6 , 36 , " "
End If
If Ventil5 = 1 Then
Lcdat 6 , 48 , "-"
Else
Lcdat 6 , 48 , " "
End If
If Ventil6 = 1 Then
Lcdat 6 , 60 , "-"
Else
Lcdat 6 , 60 , " "
End If
If Ventil7 = 1 Then
Lcdat 6 , 72 , "-"
Else
Lcdat 6 , 72 , " "
End If
If Ventil8 = 1 Then
Lcdat 6 , 84 , "-"
Else
Lcdat 6 , 84 , " "
End If
Else
Lcdat 5 , 1 , " "
For A = 1 To 128
Lcdat 6 , A , " "
Lcdat 7 , A , " "
Next A
End If
If Stop_povel = 1 Then
Debounce Up_tl , 0 , Inc_ovladanie , Sub
Debounce Down_tl , 0 , Dec_ovladanie , Sub
End If
Debounce Go_tl , 0 , Go_ovladanie , Sub
Debounce Cancel_tl , 0 , Main_menu , Sub
Gosub Back_start
Loop
Return
Inc_ovladanie:
Call Beep
Back = 0
Incr Ovladanie_selec
If Ovladanie_selec > 9 Then Ovladanie_selec = 9
Return
Dec_ovladanie:
Call Beep
Back = 0
Decr Ovladanie_selec
If Ovladanie_selec < 1 Then Ovladanie_selec = 1
Return
Go_ovladanie:
Call Beep
Back = 0
If Ovladanie_selec = 1 Then
If Stop_povel = 0 Then
Stop_povel = 1
Gosub Reset_ventil
Else
Stop_povel = 0
Gosub Reset_ventil
End If
End If
If Ovladanie_selec = 2 Then
If Ventil1 = 1 Then
Reset Ventil1
'Stop_povel = 0
Else
Set Ventil1
Stop_povel = 1
End If
End If
If Ovladanie_selec = 3 Then
If Ventil2 = 1 Then
Reset Ventil2
'Stop_povel = 0
Else
Set Ventil2
Stop_povel = 1
End If
End If
If Ovladanie_selec = 4 Then
If Ventil3 = 1 Then
Reset Ventil3
'Stop_povel = 0
Else
Set Ventil3
Stop_povel = 1
End If
End If
If Ovladanie_selec = 5 Then
If Ventil4 = 1 Then
Reset Ventil4
'Stop_povel = 0
Else
Set Ventil4
Stop_povel = 1
End If
End If
If Ovladanie_selec = 6 Then
If Ventil5 = 1 Then
Reset Ventil5
'Stop_povel = 0
Else
Set Ventil5
Stop_povel = 1
End If
End If
If Ovladanie_selec = 7 Then
If Ventil6 = 1 Then
Reset Ventil6
'Stop_povel = 0
Else
Set Ventil6
Stop_povel = 1
End If
End If
If Ovladanie_selec = 8 Then
If Ventil7 = 1 Then
Reset Ventil7
'Stop_povel = 0
Else
Set Ventil7
Stop_povel = 1
End If
End If
If Ovladanie_selec = 9 Then
If Ventil8 = 1 Then
Reset Ventil8
'Stop_povel = 0
Else
Set Ventil8
Stop_povel = 1
End If
End If
Return
'------------------------------Reset_ventil-------------------------------------
Reset_ventil:
Reset Ventil1
Reset Ventil2
Reset Ventil3
Reset Ventil4
Reset Ventil5
Reset Ventil6
Reset Ventil7
Reset Ventil8
Return
'-------------------------------Menu nastavenie---------------------------------
Setting_menu:
Call Beep
Cls
Sett_selec = 1
Do
Setfont Font8x8
Lcdat 1 , 1 , " -Nastavenie-" , 0
Setfont My6_8
If Sett_selec = 1 Then
Inverse = 1
End If
Lcdat 3 , 1 , Nast_hodin , Inverse
Inverse = 0
If Sett_selec = 2 Then
Inverse = 1
End If
Lcdat 4 , 1 , Nast_zavlaha , Inverse
Inverse = 0
If Sett_selec = 3 Then
Inverse = 1
End If
Lcdat 5 , 1 , Dlzka_zavlahy, Inverse
Inverse = 0
If Sett_selec = 4 Then
Inverse = 1
End If
Lcdat 6 , 1 , Nast_snimac , Inverse
Inverse = 0
Debounce Up_tl , 0 , Inc_sett , Sub
Debounce Down_tl , 0 , Dec_sett , Sub
Debounce Go_tl , 0 , Go_sett , Sub
Debounce Cancel_tl , 0 , Main_menu , Sub
Gosub Back_start
Loop
Return
Inc_sett:
Call Beep
Back = 0
If Sett_selec <= 3 Then
Sett_selec = Sett_selec + 1
End If
Return
Dec_sett:
Call Beep
Back = 0
If Sett_selec >= 2 Then
Sett_selec = Sett_selec - 1
End If
Return
Go_sett:
Call Beep
Back = 0
If Sett_selec = 1 Then
Gosub Sett_time
End If
If Sett_selec = 2 Then
Sett_program = 1
Sett_programa = 1
Goto Program
End If
If Sett_selec = 3 Then
Gosub Zavlaha_dlz
End If
If Sett_selec = 4 Then
Goto Main_menu
End If
Return
'-------------------------------Dlzka zavlahy %---------------------------------
Zavlaha_dlz:
Cls
Do
Setfont Font8x8
Lcdat 1 , 1 , "-Zmena zavlahy-" , 0
Debounce Up_tl , 0 , Inc_dlzka , Sub
Debounce Down_tl , 0 , Dec_dlzka , Sub
Debounce Cancel_tl , 0 , Setting_menu , Sub
Gosub Back_start
Gosub Percenta_temp
Loop
Return
'------------------------------Percenta----------------------------------------
Percenta_temp:
Setfont Font5x5
For A = 6 To Percenta_zavlahy Step 8
Lcdat 5 , A , " " , 1
Next A
Select Case Percenta_zavlahy
Case 6
Percenta = 10
Percenta_add = 0.1
Case 14
Percenta = 20
Percenta_add = 0.2
Case 22
Percenta = 30
Percenta_add = 0.3
Case 30
Percenta = 40
Percenta_add = 0.4
Case 38
Percenta = 50
Percenta_add = 0.5
Case 46
Percenta = 60
Percenta_add = 0.6
Case 54
Percenta = 70
Percenta_add = 0.7
Case 62
Percenta = 80
Percenta_add = 0.8
Case 70
Percenta = 90
Percenta_add = 0.9
Case 78
Percenta = 100
Percenta_add = 1.0
Case 86
Percenta = 110
Percenta_add = 1.1
Case 94
Percenta = 120
Percenta_add = 1.2
Case 102
Percenta = 130
Percenta_add = 1.3
Case 110
Percenta = 140
Percenta_add = 1.4
Case 118
Percenta = 150
Percenta_add = 1.5
End Select
Setfont Font5x5
Lcdat 4 , 1 , Percenta ; "% "
Lcdat 5 , Percenta_zavlahy , " " , 1
Return
Inc_dlzka:
Back = 0
Call Beep
Percenta_zavlahy = Percenta_zavlahy + 8
If Percenta_zavlahy >= 118 Then Percenta_zavlahy = 118
Return
Dec_dlzka:
Back = 0
Call Beep
Percenta_zavlahy = Percenta_zavlahy - 8
If Percenta_zavlahy <= 6 Or Percenta_zavlahy > 250 Then Percenta_zavlahy = 6
Percenta_zavlahy_clear = Percenta_zavlahy + 8
Lcdat 5 , Percenta_zavlahy_clear , " " , 0
Return
'-------------------------------Nastavenie hodin--------------------------------
Sett_time:
Sett_hod = 1
Cls
S_hodiny = S_hours
S_minuty = S_minutes
Dnivtyzdni = Weekday
Do
Setfont Font8x8
Lcdat 1 , 1 , " -Hodiny/dni-" , 0
If Sett_hod = 1 Then
Inverse = 1
End If
Lcdat 3 , 44 , S_hodiny , Inverse
Inverse = 0
Lcdat 3 , 60 , ":" , 0
If Sett_hod = 2 Then
Inverse = 1
End If
Lcdat 3 , 68 , S_minuty , Inverse
Inverse = 0
If Sett_hod = 3 Then
Inverse = 1
End If
Lcdat 5 , 44 , Dni(dnivtyzdni) , Inverse
Inverse = 0
'If Sett_hod = 4 Then
'Inverse = 1
'End If
'Lcdat 8 , 1 , Zrusit , Inverse
'Inverse = 0
If Sett_hod = 4 Then
Inverse = 1
End If
Lcdat 8 , 81 , Ulozit , Inverse
Inverse = 0
Hodiny = Val(s_hodiny)
Minuty = Val(s_minuty)
Debounce Up_tl , 0 , Inc_time , Sub
Debounce Down_tl , 0 , Dec_time , Sub
Debounce Go_tl , 0 , Go_time , Sub
Debounce Cancel_tl , 0 , Setting_menu , Sub
Loop
Dec_time:
Call Beep
If Sett_hod <= 3 Then
Sett_hod = Sett_hod + 1
End If
Return
Inc_time:
Call Beep
If Sett_hod >= 2 Then
Sett_hod = Sett_hod - 1
End If
Return
Go_time:
Call Beep
If Sett_hod = 1 Then
Hodiny = Hodiny + 1
If Hodiny = 24 Then
Hodiny = 0
End If
End If
S_hodiny = Str(hodiny)
S_hodiny = Format(s_hodiny , "00")
If Sett_hod = 2 Then
Minuty = Minuty + 1
If Minuty = 60 Then
Minuty = 0
End If
End If
S_minuty = Str(minuty)
S_minuty = Format(s_minuty , "00")
If Sett_hod = 3 Then
Dnivtyzdni = Dnivtyzdni + 1
If Dnivtyzdni = 8 Then
Dnivtyzdni = 1
End If
End If
'If Sett_hod = 4 Then
'Goto Setting_menu
'End If
If Sett_hod = 4 Then
Goto Writetime
End If
Return
'-------------------------------Zapis hodin=----------------------------------
Writetime:
Disable Interrupts
Seconds_sett = Makebcd(0) : Minutes_sett = Makebcd(minuty) : Hours_sett = Makebcd(hodiny) : Weekday_sett = Makebcd(dnivtyzdni)
I2cstart
I2cwbyte &B11010000
I2cwbyte 0
I2cwbyte Seconds_sett
I2cwbyte Minutes_sett
I2cwbyte Hours_sett
I2cwbyte Weekday_sett
I2cstop
Enable Interrupts
Gosub Ukladam
Goto Setting_menu
Return
'----------------------------------Program------------------------------------
Program:
Back = 0
Cls
Gosub Selectprogram
Do
'Setfont Font8x8
'Lcdat 1 , 81 , "Prog.A" , 0
Setfont My6_8
If Sett_programa = 1 Then
Inverse = 1
End If
Lcdat 1 , 1 , "1" , Inverse
Inverse = 0
If Sett_programa = 2 Then
Inverse = 1
End If
Lcdat 1 , 17 , "2" , Inverse
Inverse = 0
If Sett_programa = 3 Then
Inverse = 1
End If
Lcdat 1 , 33 , "3" , Inverse
Inverse = 0
If Sett_programa = 4 Then
Inverse = 1
End If
Lcdat 1 , 49 , "4" , Inverse
Inverse = 0
If Sett_programa = 5 Then
Inverse = 1
End If
Lcdat 2 , 1 , "5" , Inverse
Inverse = 0
If Sett_programa = 6 Then
Inverse = 1
End If
Lcdat 2 , 17 , "6" , Inverse
Inverse = 0
If Sett_programa = 7 Then
Inverse = 1
End If
Lcdat 2 , 33 , "7" , Inverse
Inverse = 0
If Sett_programa = 8 Then
Inverse = 1
End If
Lcdat 2 , 49 , "8" , Inverse
Inverse = 0
'-------------------------------------------------------------------------------
If Sett_okruh = 1 Then
Inverse_a = 1
End If
If Prog(1) <> 0 Then
Lcdat 2 , 80 , " "
Lcdat 2 , 68 , S_prog(1) , Inverse_a
Else
Lcdat 2 , 68 , "OFF" , Inverse_a
End If
Inverse_a = 0
Lcdat 2 , 84 , ":" , 0
If Sett_okruh = 2 Then
Inverse_a = 1
End If
Lcdat 2 , 92 , S_prog(2) , Inverse_a
Inverse_a = 0
If Sett_okruh = 3 Then
Inverse_a = 1
End If
Lcdat 2 , 116 , S_prog(3) , Inverse_a
Inverse_a = 0
If Sett_okruh = 4 Then
Inverse_a = 1
End If
If Prog(4) <> 0 Then
Lcdat 3 , 80 , " "
Lcdat 3 , 68 , S_prog(4) , Inverse_a
Else
Lcdat 3 , 68 , "OFF" , Inverse_a
End If
Inverse_a = 0
Lcdat 3 , 84 , ":" , 0
If Sett_okruh = 5 Then
Inverse_a = 1
End If
Lcdat 3 , 92 , S_prog(5) , Inverse_a
Inverse_a = 0
If Sett_okruh = 6 Then
Inverse_a = 1
End If
Lcdat 3 , 116 , S_prog(6) , Inverse_a
Inverse_a = 0
If Sett_okruh = 7 Then
Inverse_a = 1
End If
If Prog(7) <> 0 Then
Lcdat 4 , 80 , " "
Lcdat 4 , 68 , S_prog(7) , Inverse_a
Else
Lcdat 4 , 68 , "OFF" , Inverse_a
End If
Inverse_a = 0
Lcdat 4 , 84 , ":" , 0
If Sett_okruh = 8 Then
Inverse_a = 1
End If
Lcdat 4 , 92 , S_prog(8) , Inverse_a
Inverse_a = 0
If Sett_okruh = 9 Then
Inverse_a = 1
End If
Lcdat 4 , 116 , S_prog(9) , Inverse_a
Inverse_a = 0
If Sett_okruh = 10 Then
Inverse_a = 1
End If
If Prog(10) <> 0 Then
Lcdat 5 , 80 , " "
Lcdat 5 , 68 , S_prog(10) , Inverse_a
Else
Lcdat 5 , 68 , "OFF" , Inverse_a
End If
Inverse_a = 0
Lcdat 5 , 84 , ":" , 0
If Sett_okruh = 11 Then
Inverse_a = 1
End If
Lcdat 5 , 92 , S_prog(11) , Inverse_a
Inverse_a = 0
If Sett_okruh = 12 Then
Inverse_a = 1
End If
Lcdat 5 , 116 , S_prog(12) , Inverse_a
Inverse_a = 0
If Sett_okruh <> 0 Then
If Sett_okruh = 20 Then
Inverse_a = 1
End If
Lcdat 4 , 1 , Ulozit , Inverse_a
Inverse_a = 0
End If
Setfont Font5x5
If Sett_okruh = 13 Then
Inverse_a = 1
End If
Lcdat 8 , 1 , "Pon" , Inverse_a
Inverse_a = 0
If Sett_okruh = 14 Then
Inverse_a = 1
End If
Lcdat 8 , 20 , "Uto" , Inverse_a
Inverse_a = 0
If Sett_okruh = 15 Then
Inverse_a = 1
End If
Lcdat 8 , 39 , "Str" , Inverse_a
Inverse_a = 0
If Sett_okruh = 16 Then
Inverse_a = 1
End If
Lcdat 8 , 57 , "Stv" , Inverse_a
Inverse_a = 0
If Sett_okruh = 17 Then
Inverse_a = 1
End If
Lcdat 8 , 75 , "Pia" , Inverse_a
Inverse_a = 0
If Sett_okruh = 18 Then
Inverse_a = 1
End If
Lcdat 8 , 94 , "Sob" , Inverse_a
Inverse_a = 0
If Sett_okruh = 19 Then
Inverse_a = 1
End If
Lcdat 8 , 113 , "Ned" , Inverse_a
Inverse_a = 0
If Prog(13) = 1 Then
Lcdat 7 , 6 , "_"
Else
Lcdat 7 , 6 , " "
End If
If Prog(14) = 2 Then
Lcdat 7 , 25 , "_"
Else
Lcdat 7 , 25 , " "
End If
If Prog(15) = 3 Then
Lcdat 7 , 44 , "_"
Else
Lcdat 7 , 44 , " "
End If
If Prog(16) = 4 Then
Lcdat 7 , 62 , "_"
Else
Lcdat 7 , 62 , " "
End If
If Prog(17) = 5 Then
Lcdat 7 , 80 , "_"
Else
Lcdat 7 , 80 , " "
End If
If Prog(18) = 6 Then
Lcdat 7 , 99 , "_"
Else
Lcdat 7 , 99 , " "
End If
If Prog(19) = 7 Then
Lcdat 7 , 118 , "_"
Else
Lcdat 7 , 118 , " "
End If
Lcdat 1 , 66 , "Hod"
Lcdat 1 , 90 , "Min"
Lcdat 1 , 114 , "Dlz"
Debounce Up_tl , 0 , Inc_proga , Sub
Debounce Down_tl , 0 , Dec_proga , Sub
Debounce Go_tl , 0 , Go_proga , Sub
Debounce Cancel_tl , 0 , Cancel_program , Sub
Gosub Back_start
Loop
Return
Inc_proga:
Call Beep
If Sett_okruh = 0 Then
If Sett_programa <= 7 Then
Sett_programa = Sett_programa + 1
End If
Gosub Selectprogram
Back = 0
End If
If Sett_okruh <> 0 Then
If Sett_okruh <= 19 Then
Sett_okruh = Sett_okruh + 1
End If
Back = 0
End If
Return
Dec_proga:
Call Beep
If Sett_okruh = 0 Then
If Sett_programa >= 2 Then
Sett_programa = Sett_programa - 1
End If
Gosub Selectprogram
Back = 0
End If
If Sett_okruh <> 0 Then
If Sett_okruh >= 2 Then
Sett_okruh = Sett_okruh - 1
End If
Back = 0
End If
Return
Cancel_program:
Call Beep
If Sett_okruh = 0 Then Goto Setting_menu
If Sett_okruh <> 0 Then
Sett_okruh = 0
Back = 0
Goto Program
End If
Return
Go_proga:
Call Beep
If Sett_okruh = 0 Then
Select Case Sett_programa
Case 1 To 8 : Sett_okruh = 1
'Case 9 : Goto Setting_menu
End Select
Back = 0
Goto Program
End If
'-----------------------Start_Time1-----------------------------------------------
If Sett_okruh = 1 Then
Prog(1) = Prog(1) + 1
If Prog(1) = 24 Then
Prog(1) = 0
End If
S_prog(1) = Str(prog(1))
S_prog(1) = Format(s_prog(1) , "00")
End If
If Prog(1) <> 0 Then
If Sett_okruh = 2 Then
Prog(2) = Prog(2) + 5
If Prog(2) = 60 Then
Prog(2) = 0
End If
S_prog(2) = Str(prog(2))
S_prog(2) = Format(s_prog(2) , "00")
End If
End If
If Prog(1) <> 0 Then
If Sett_okruh = 3 Then
Prog(3) = Prog(3) + 1
If Prog(3) > 90 Then
Prog(3) = 0
End If
S_prog(3) = Str(prog(3))
S_prog(3) = Format(s_prog(3) , "00")
End If
End If
'-----------------------Start_Time2-----------------------------------------------
If Sett_okruh = 4 Then
Prog(4) = Prog(4) + 1
If Prog(4) = 24 Then
Prog(4) = 0
End If
S_prog(4) = Str(prog(4))
S_prog(4) = Format(s_prog(4) , "00")
End If
If Prog(4) <> 0 Then
If Sett_okruh = 5 Then
Prog(5) = Prog(5) + 5
If Prog(5) = 60 Then
Prog(5) = 0
End If
S_prog(5) = Str(prog(5))
S_prog(5) = Format(s_prog(5) , "00")
End If
End If
If Prog(4) <> 0 Then
If Sett_okruh = 6 Then
Prog(6) = Prog(6) + 1
If Prog(6) > 90 Then
Prog(6) = 0
End If
S_prog(6) = Str(prog(6))
S_prog(6) = Format(s_prog(6) , "00")
End If
End If
'-----------------------Start_Time3-----------------------------------------------
If Sett_okruh = 7 Then
Prog(7) = Prog(7) + 1
If Prog(7) = 24 Then
Prog(7) = 0
End If
S_prog(7) = Str(prog(7))
S_prog(7) = Format(s_prog(7) , "00")
End If
If Prog(7) <> 0 Then
If Sett_okruh = 8 Then
Prog(8) = Prog(8) + 5
If Prog(8) = 60 Then
Prog(8) = 0
End If
S_prog(8) = Str(prog(8))
S_prog(8) = Format(s_prog(8) , "00")
End If
End If
If Prog(7) <> 0 Then
If Sett_okruh = 9 Then
Prog(9) = Prog(9) + 1
If Prog(9) > 90 Then
Prog(9) = 0
End If
S_prog(9) = Str(prog(9))
S_prog(9) = Format(s_prog(9) , "00")
End If
End If
'-----------------------Start_Time4-----------------------------------------------
If Sett_okruh = 10 Then
Prog(10) = Prog(10) + 1
If Prog(10) = 24 Then
Prog(10) = 0
End If
S_prog(10) = Str(prog(10))
S_prog(10) = Format(s_prog(10) , "00")
End If
If Prog(10) <> 0 Then
If Sett_okruh = 11 Then
Prog(11) = Prog(11) + 5
If Prog(11) = 60 Then
Prog(11) = 0
End If
S_prog(11) = Str(prog(11))
S_prog(11) = Format(s_prog(11) , "00")
End If
End If
If Prog(10) <> 0 Then
If Sett_okruh = 12 Then
Prog(12) = Prog(12) + 1
If Prog(12) > 90 Then
Prog(12) = 0
End If
S_prog(12) = Str(prog(12))
S_prog(12) = Format(s_prog(12) , "00")
End If
End If
'-----------------------Sett_Day-----------------------------------------------
If Sett_okruh = 13 Then
If Prog(13) = 1 Then
Prog(13) = 0
Else
Prog(13) = 1
End If
End If
If Sett_okruh = 14 Then
If Prog(14) = 2 Then
Prog(14) = 0
Else
Prog(14) = 2
End If
End If
If Sett_okruh = 15 Then
If Prog(15) = 3 Then
Prog(15) = 0
Else
Prog(15) = 3
End If
End If
If Sett_okruh = 16 Then
If Prog(16) = 4 Then
Prog(16) = 0
Else
Prog(16) = 4
End If
End If
If Sett_okruh = 17 Then
If Prog(17) = 5 Then
Prog(17) = 0
Else
Prog(17) = 5
End If
End If
If Sett_okruh = 18 Then
If Prog(18) = 6 Then
Prog(18) = 0
Else
Prog(18) = 6
End If
End If
If Sett_okruh = 19 Then
If Prog(19) = 7 Then
Prog(19) = 0
Else
Prog(19) = 7
End If
End If
'------------------------------------Save_program-------------------------------
If Sett_okruh = 20 And Sett_program = 1 Then
Disable Interrupts
For A = 1 To 20
Select Case Sett_programa
Case 1 : Program_a1(a) = Prog(a)
Case 2 : Program_a2(a) = Prog(a)
Case 3 : Program_a3(a) = Prog(a)
Case 4 : Program_a4(a) = Prog(a)
Case 5 : Program_a5(a) = Prog(a)
Case 6 : Program_a6(a) = Prog(a)
Case 7 : Program_a7(a) = Prog(a)
Case 8 : Program_a8(a) = Prog(a)
End Select
Next A
Enable Interrupts
Gosub Ukladam
Goto Program
End If
Back = 0
Return
'-----------------------------------Beep-------------------------------------
Sub Beep
Sound Piezo , 65 , 400
End Sub
'-----------------------------------Ukladam-------------------------------------
Sub Ukladam
U = 0
Cls
Do
Setfont Font8x8
Lcdat 4 , 24 , "Ukladam..." , 0
Waitms 400
Lcdat 4 , 24 , " " , 0
Waitms 400
Incr U
Loop Until U = 3
Sett_okruh = 0
End Sub
'--------------------------------Vyber programu---------------------------------
Selectprogram:
For A = 1 To 20
If Sett_program = 1 Then
Select Case Sett_programa
Case 1 : Prog(a) = Program_a1(a)
Case 2 : Prog(a) = Program_a2(a)
Case 3 : Prog(a) = Program_a3(a)
Case 4 : Prog(a) = Program_a4(a)
Case 5 : Prog(a) = Program_a5(a)
Case 6 : Prog(a) = Program_a6(a)
Case 7 : Prog(a) = Program_a7(a)
Case 8 : Prog(a) = Program_a8(a)
End Select
End If
S_prog(a) = Str(prog(a) )
S_prog(a) = Format(s_prog(a) , "00")
Next A
Return
'-----------------------------Spat na start-------------------------------------
Back_start:
Incr Back
If Back = 600 Then
Goto Start_menu
End If
Return
'-------------------------------Prerusenie--------------------------------------
Interrupt: ' Interrupt
Read_time = 1
'Gosub Readtime
Timer1 = 34286
I2cstart
I2cwbyte &B11010000
I2cwbyte 0
I2cstop
Waitms 50
I2cstart
I2cwbyte &B11010001
I2crbyte Seconds , Ack
I2crbyte Minutes , Ack
I2crbyte Hours , Ack
I2crbyte Weekday , Ack
I2crbyte Day , Ack
I2crbyte Month , Ack
I2crbyte Year , Nack
Seconds = Makedec(seconds)
Minutes = Makedec(minutes)
Hours = Makedec(hours)
Weekday = Makedec(weekday)
Day = Makedec(day)
Month = Makedec(month)
Year = Makedec(year)
I2cstop
S_hours = Str(hours)
S_hours = Format(s_hours , "00")
S_year = Str(year)
S_year = Format(s_year , "000")
S_minutes = Str(minutes)
S_minutes = Format(s_minutes , "00")
S_seconds = Str(seconds)
S_seconds = Format(s_seconds , "00")
If Stop_povel = 0 Then
'Percenta_add = Percenta / 100
Bsec = Seconds
Bhour = Hours
Bmin = Minutes
Lsyssec = Secofday(bsec)
Sec_runtimea1 = Runtime_starta1 * 60
Sec_runtimea2 = Runtime_starta2 * 60
Sec_runtimea3 = Runtime_starta3 * 60
Sec_runtimea4 = Runtime_starta4 * 60
Sec_runtimea5 = Runtime_starta5 * 60
Sec_runtimea6 = Runtime_starta6 * 60
Sec_runtimea7 = Runtime_starta7 * 60
Sec_runtimea8 = Runtime_starta8 * 60
Percenta_spolu1 = Sec_runtimea1 * Percenta_add
Percenta_spolu2 = Sec_runtimea2 * Percenta_add
Percenta_spolu3 = Sec_runtimea3 * Percenta_add
Percenta_spolu4 = Sec_runtimea4 * Percenta_add
Percenta_spolu5 = Sec_runtimea5 * Percenta_add
Percenta_spolu6 = Sec_runtimea6 * Percenta_add
Percenta_spolu7 = Sec_runtimea7 * Percenta_add
Percenta_spolu8 = Sec_runtimea8 * Percenta_add
Sec_runtimea1 = Round(percenta_spolu1)
Sec_runtimea2 = Round(percenta_spolu2)
Sec_runtimea3 = Round(percenta_spolu3)
Sec_runtimea4 = Round(percenta_spolu4)
Sec_runtimea5 = Round(percenta_spolu5)
Sec_runtimea6 = Round(percenta_spolu6)
Sec_runtimea7 = Round(percenta_spolu7)
Sec_runtimea8 = Round(percenta_spolu8)
Lsyssec1 = Secofday(bsec1)
Lsyssec11 = Sec_runtimea1
Lsyssec11 = Lsyssec11 + Lsyssec1
Lsecofday = Secofday(lsyssec11)
Lsyssec2 = Secofday(bsec2)
Lsyssec22 = Sec_runtimea2
Lsyssec22 = Lsyssec22 + Lsyssec2
Lsecofday2 = Secofday(lsyssec22)
Lsyssec3 = Secofday(bsec3)
Lsyssec33 = Sec_runtimea3
Lsyssec33 = Lsyssec33 + Lsyssec3
Lsecofday3 = Secofday(lsyssec33)
Lsyssec4 = Secofday(bsec4)
Lsyssec4 = Sec_runtimea4
Lsyssec44 = Lsyssec44 + Lsyssec4
Lsecofday4 = Secofday(lsyssec44)
Lsyssec5 = Secofday(bsec5)
Lsyssec55 = Sec_runtimea5
Lsyssec55 = Lsyssec55 + Lsyssec5
Lsecofday5 = Secofday(lsyssec55)
Lsyssec6 = Secofday(bsec6)
Lsyssec66 = Sec_runtimea6
Lsyssec66 = Lsyssec66 + Lsyssec6
Lsecofday6 = Secofday(lsyssec66)
Lsyssec7 = Secofday(bsec7)
Lsyssec77 = Sec_runtimea7
Lsyssec77 = Lsyssec77 + Lsyssec7
Lsecofday7 = Secofday(lsyssec77)
Lsyssec8 = Secofday(bsec8)
Lsyssec88 = Sec_runtimea8
Lsyssec88 = Lsyssec88 + Lsyssec8
Lsecofday8 = Secofday(lsyssec88)
If Hours = Program_a1(1) And Minutes = Program_a1(2) Then Starta1_true = 1
If Hours = Program_a1(4) And Minutes = Program_a1(5) Then Starta1_true = 2
If Hours = Program_a1(7) And Minutes = Program_a1(8) Then Starta1_true = 3
If Hours = Program_a1(10) And Minutes = Program_a1(11) Then Starta1_true = 4
If Hours = Program_a2(1) And Minutes = Program_a2(2) Then Starta2_true = 1
If Hours = Program_a2(4) And Minutes = Program_a2(5) Then Starta2_true = 2
If Hours = Program_a2(7) And Minutes = Program_a2(8) Then Starta2_true = 3
If Hours = Program_a2(10) And Minutes = Program_a2(11) Then Starta2_true = 4
If Hours = Program_a3(1) And Minutes = Program_a3(2) Then Starta3_true = 1
If Hours = Program_a3(4) And Minutes = Program_a3(5) Then Starta3_true = 2
If Hours = Program_a3(7) And Minutes = Program_a3(8) Then Starta3_true = 3
If Hours = Program_a3(10) And Minutes = Program_a3(11) Then Starta3_true = 4
If Hours = Program_a4(1) And Minutes = Program_a4(2) Then Starta4_true = 1
If Hours = Program_a4(4) And Minutes = Program_a4(5) Then Starta4_true = 2
If Hours = Program_a4(7) And Minutes = Program_a4(8) Then Starta4_true = 3
If Hours = Program_a4(10) And Minutes = Program_a4(11) Then Starta4_true = 4
If Hours = Program_a5(1) And Minutes = Program_a5(2) Then Starta5_true = 1
If Hours = Program_a5(4) And Minutes = Program_a5(5) Then Starta5_true = 2
If Hours = Program_a5(7) And Minutes = Program_a5(8) Then Starta5_true = 3
If Hours = Program_a5(10) And Minutes = Program_a5(11) Then Starta5_true = 4
If Hours = Program_a6(1) And Minutes = Program_a6(2) Then Starta6_true = 1
If Hours = Program_a6(4) And Minutes = Program_a6(5) Then Starta6_true = 2
If Hours = Program_a6(7) And Minutes = Program_a6(8) Then Starta6_true = 3
If Hours = Program_a6(10) And Minutes = Program_a6(11) Then Starta6_true = 4
If Hours = Program_a7(1) And Minutes = Program_a7(2) Then Starta7_true = 1
If Hours = Program_a7(4) And Minutes = Program_a7(5) Then Starta7_true = 2
If Hours = Program_a7(7) And Minutes = Program_a7(8) Then Starta7_true = 3
If Hours = Program_a7(10) And Minutes = Program_a7(11) Then Starta7_true = 4
If Hours = Program_a8(1) And Minutes = Program_a8(2) Then Starta8_true = 1
If Hours = Program_a8(4) And Minutes = Program_a8(5) Then Starta8_true = 2
If Hours = Program_a8(7) And Minutes = Program_a8(8) Then Starta8_true = 3
If Hours = Program_a8(10) And Minutes = Program_a8(11) Then Starta8_true = 4
'-----------------------------------Check start----------------------------------
Select Case Starta1_true
Case 1
Bsec1 = 0
Bhour1 = Program_a1(1)
Bmin1 = Program_a1(2)
Runtime_starta1 = Program_a1(3)
For A = 13 To 19
If Weekday = Program_a1(a) Then
If Program_a1(1) <> 0 Then
'Sec_runtimea1 = Runtime_starta1 * 60
Set Ventil1
End If
If Lsyssec >= Lsecofday Then
Reset Ventil1
Starta1_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec1 = 0
Bhour1 = Program_a1(4)
Bmin1 = Program_a1(5)
Runtime_starta1 = Program_a1(6)
For A = 13 To 19
If Weekday = Program_a1(a) Then
If Program_a1(4) <> 0 Then
'Sec_runtimea1 = Runtime_starta1 * 60
Set Ventil1
End If
If Lsyssec >= Lsecofday Then
Reset Ventil1
'Runtime1 = 0
Starta1_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec1 = 0
Bhour1 = Program_a1(7)
Bmin1 = Program_a1(8)
Runtime_starta1 = Program_a1(9)
For A = 13 To 19
If Weekday = Program_a1(a) Then
If Program_a1(7) <> 0 Then
'Sec_runtimea1 = Runtime_starta1 * 60
Set Ventil1
End If
If Lsyssec >= Lsecofday Then
Reset Ventil1
Starta1_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec1 = 0
Bhour1 = Program_a1(10)
Bmin1 = Program_a1(11)
Runtime_starta1 = Program_a1(12)
For A = 13 To 19
If Weekday = Program_a1(a) Then
If Program_a1(10) <> 0 Then
'Sec_runtimea1 = Runtime_starta1 * 60
Set Ventil1
End If
If Lsyssec >= Lsecofday Then
Reset Ventil1
Starta1_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta2_true
Case 1
Bsec2 = 0
Bhour2 = Program_a2(1)
Bmin2 = Program_a2(2)
Runtime_starta2 = Program_a2(3)
For A = 13 To 19
If Weekday = Program_a2(a) Then
If Program_a2(1) <> 0 Then
'Sec_runtimea2 = Runtime_starta2 * 60
Set Ventil2
End If
If Lsyssec >= Lsecofday2 Then
Reset Ventil2
Starta2_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec2 = 0
Bhour2 = Program_a2(4)
Bmin2 = Program_a2(5)
Runtime_starta2 = Program_a2(6)
For A = 13 To 19
If Weekday = Program_a2(a) Then
If Program_a2(4) <> 0 Then
'Sec_runtimea2 = Runtime_starta2 * 60
Set Ventil2
End If
If Lsyssec >= Lsecofday2 Then
Reset Ventil2
Starta2_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec2 = 0
Bhour2 = Program_a2(7)
Bmin2 = Program_a2(8)
Runtime_starta2 = Program_a2(9)
For A = 13 To 19
If Weekday = Program_a2(a) Then
If Program_a2(7) <> 0 Then
' Sec_runtimea2 = Runtime_starta2 * 60
Set Ventil2
End If
If Lsyssec >= Lsecofday2 Then
Reset Ventil2
Starta2_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec2 = 0
Bhour2 = Program_a2(10)
Bmin2 = Program_a2(11)
Runtime_starta2 = Program_a2(12)
For A = 13 To 19
If Weekday = Program_a2(a) Then
If Program_a2(10) <> 0 Then
' Sec_runtimea2 = Runtime_starta2 * 60
Set Ventil2
End If
If Lsyssec >= Lsecofday2 Then
Reset Ventil2
Starta2_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta3_true
Case 1
Bsec3 = 0
Bhour3 = Program_a3(1)
Bmin3 = Program_a3(2)
Runtime_starta3 = Program_a3(3)
For A = 13 To 19
If Weekday = Program_a3(a) Then
If Program_a3(1) <> 0 Then
'Sec_runtimea3 = Runtime_starta3 * 60
Set Ventil3
'Incr Runtime1
End If
If Lsyssec >= Lsecofday3 Then
Reset Ventil3
'Runtime1 = 0
Starta3_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec3 = 0
Bhour3 = Program_a3(4)
Bmin3 = Program_a3(5)
Runtime_starta3 = Program_a3(6)
For A = 13 To 19
If Weekday = Program_a3(a) Then
If Program_a3(4) <> 0 Then
'Sec_runtimea3 = Runtime_starta3 * 60
Set Ventil3
'Incr Runtime1
End If
If Lsyssec >= Lsecofday3 Then
Reset Ventil3
'Runtime1 = 0
Starta3_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec3 = 0
Bhour3 = Program_a3(7)
Bmin3 = Program_a3(8)
Runtime_starta3 = Program_a3(9)
For A = 13 To 19
If Weekday = Program_a3(a) Then
If Program_a3(7) <> 0 Then
'Sec_runtimea3 = Runtime_starta3 * 60
Set Ventil3
'Incr Runtime1
End If
If Lsyssec >= Lsecofday3 Then
Reset Ventil3
'Runtime1 = 0
Starta3_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec3 = 0
Bhour3 = Program_a3(10)
Bmin3 = Program_a3(11)
Runtime_starta3 = Program_a3(12)
For A = 13 To 19
If Weekday = Program_a3(a) Then
If Program_a3(10) <> 0 Then
'Sec_runtimea3 = Runtime_starta3 * 60
Set Ventil3
'Incr Runtime1
End If
If Lsyssec >= Lsecofday3 Then
Reset Ventil3
'Runtime1 = 0
Starta3_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta4_true
Case 1
Bsec4 = 0
Bhour4 = Program_a4(1)
Bmin4 = Program_a4(2)
Runtime_starta4 = Program_a4(3)
For A = 13 To 19
If Weekday = Program_a4(a) Then
If Program_a4(1) <> 0 Then
'Sec_runtimea4 = Runtime_starta4 * 60
Set Ventil4
'Incr Runtime1
End If
If Lsyssec >= Lsecofday4 Then
Reset Ventil4
'Runtime1 = 0
Starta4_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec4 = 0
Bhour4 = Program_a4(4)
Bmin4 = Program_a4(5)
Runtime_starta4 = Program_a4(6)
For A = 13 To 19
If Weekday = Program_a4(a) Then
If Program_a4(4) <> 0 Then
'Sec_runtimea4 = Runtime_starta4 * 60
Set Ventil4
'Incr Runtime1
End If
If Lsyssec >= Lsecofday4 Then
Reset Ventil4
'Runtime1 = 0
Starta4_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec4 = 0
Bhour4 = Program_a4(7)
Bmin4 = Program_a4(8)
Runtime_starta4 = Program_a4(9)
For A = 13 To 19
If Weekday = Program_a4(a) Then
If Program_a4(7) <> 0 Then
'Sec_runtimea4 = Runtime_starta4 * 60
Set Ventil4
'Incr Runtime1
End If
If Lsyssec >= Lsecofday4 Then
Reset Ventil4
'Runtime1 = 0
Starta4_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec4 = 0
Bhour4 = Program_a4(10)
Bmin4 = Program_a4(11)
Runtime_starta4 = Program_a4(12)
For A = 13 To 19
If Weekday = Program_a4(a) Then
If Program_a4(10) <> 0 Then
'Sec_runtimea4 = Runtime_starta4 * 60
Set Ventil4
'Incr Runtime1
End If
If Lsyssec >= Lsecofday4 Then
Reset Ventil4
'Runtime1 = 0
Starta4_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta5_true
Case 1
Bsec5 = 0
Bhour5 = Program_a5(1)
Bmin5 = Program_a5(2)
Runtime_starta5 = Program_a5(3)
For A = 13 To 19
If Weekday = Program_a5(a) Then
If Program_a5(1) <> 0 Then
'Sec_runtimea5 = Runtime_starta5 * 60
Set Ventil5
'Incr Runtime1
End If
If Lsyssec >= Lsecofday5 Then
Reset Ventil5
'Runtime1 = 0
Starta5_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec5 = 0
Bhour5 = Program_a5(4)
Bmin5 = Program_a5(5)
Runtime_starta5 = Program_a5(6)
For A = 13 To 19
If Weekday = Program_a5(a) Then
If Program_a5(4) <> 0 Then
'Sec_runtimea5 = Runtime_starta5 * 60
Set Ventil5
'Incr Runtime1
End If
If Lsyssec >= Lsecofday5 Then
Reset Ventil5
'Runtime1 = 0
Starta5_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec5 = 0
Bhour5 = Program_a5(7)
Bmin5 = Program_a5(8)
Runtime_starta5 = Program_a5(9)
For A = 13 To 19
If Weekday = Program_a5(a) Then
If Program_a5(7) <> 0 Then
'Sec_runtimea5 = Runtime_starta5 * 60
Set Ventil5
'Incr Runtime1
End If
If Lsyssec >= Lsecofday5 Then
Reset Ventil5
'Runtime1 = 0
Starta5_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec5 = 0
Bhour5 = Program_a5(10)
Bmin5 = Program_a5(11)
Runtime_starta5 = Program_a5(12)
For A = 13 To 19
If Weekday = Program_a5(a) Then
If Program_a5(10) <> 0 Then
'Sec_runtimea5 = Runtime_starta5 * 60
Set Ventil5
'Incr Runtime1
End If
If Lsyssec >= Lsecofday5 Then
Reset Ventil5
'Runtime1 = 0
Starta5_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta6_true
Case 1
Bsec6 = 0
Bhour6 = Program_a6(1)
Bmin6 = Program_a6(2)
Runtime_starta6 = Program_a6(3)
For A = 13 To 19
If Weekday = Program_a6(a) Then
If Program_a6(1) <> 0 Then
'Sec_runtimea6 = Runtime_starta6 * 60
Set Ventil6
'Incr Runtime1
End If
If Lsyssec >= Lsecofday6 Then
Reset Ventil6
'Runtime1 = 0
Starta6_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec6 = 0
Bhour6 = Program_a6(4)
Bmin6 = Program_a6(5)
Runtime_starta6 = Program_a6(6)
For A = 13 To 19
If Weekday = Program_a6(a) Then
If Program_a6(4) <> 0 Then
'Sec_runtimea6 = Runtime_starta6 * 60
Set Ventil6
'Incr Runtime1
End If
If Lsyssec >= Lsecofday6 Then
Reset Ventil6
'Runtime1 = 0
Starta6_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec6 = 0
Bhour6 = Program_a6(7)
Bmin6 = Program_a6(8)
Runtime_starta6 = Program_a6(9)
For A = 13 To 19
If Weekday = Program_a6(a) Then
If Program_a6(7) <> 0 Then
'Sec_runtimea6 = Runtime_starta6 * 60
Set Ventil6
'Incr Runtime1
End If
If Lsyssec >= Lsecofday6 Then
Reset Ventil6
'Runtime1 = 0
Starta6_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec6 = 0
Bhour6 = Program_a6(10)
Bmin6 = Program_a6(11)
Runtime_starta6 = Program_a6(12)
For A = 13 To 19
If Weekday = Program_a6(a) Then
If Program_a6(10) <> 0 Then
'Sec_runtimea6 = Runtime_starta6 * 60
Set Ventil6
'Incr Runtime1
End If
If Lsyssec >= Lsecofday6 Then
Reset Ventil6
'Runtime1 = 0
Starta6_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta7_true
Case 1
Bsec7 = 0
Bhour7 = Program_a7(1)
Bmin7 = Program_a7(2)
Runtime_starta7 = Program_a7(3)
For A = 13 To 19
If Weekday = Program_a7(a) Then
If Program_a7(1) <> 0 Then
'Sec_runtimea7 = Runtime_starta7 * 60
Set Ventil7
'Incr Runtime1
End If
If Lsyssec >= Lsecofday7 Then
Reset Ventil7
'Runtime1 = 0
Starta7_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec7 = 0
Bhour7 = Program_a7(4)
Bmin7 = Program_a7(5)
Runtime_starta7 = Program_a7(6)
For A = 13 To 19
If Weekday = Program_a7(a) Then
If Program_a7(4) <> 0 Then
'Sec_runtimea7 = Runtime_starta7 * 60
Set Ventil7
'Incr Runtime1
End If
If Lsyssec >= Lsecofday7 Then
Reset Ventil7
'Runtime1 = 0
Starta7_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec7 = 0
Bhour7 = Program_a7(7)
Bmin7 = Program_a7(8)
Runtime_starta7 = Program_a7(9)
For A = 13 To 19
If Weekday = Program_a7(a) Then
If Program_a7(7) <> 0 Then
'Sec_runtimea7 = Runtime_starta7 * 60
Set Ventil7
'Incr Runtime1
End If
If Lsyssec >= Lsecofday7 Then
Reset Ventil7
'Runtime1 = 0
Starta7_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec7 = 0
Bhour7 = Program_a7(10)
Bmin7 = Program_a7(11)
Runtime_starta7 = Program_a7(12)
For A = 13 To 19
If Weekday = Program_a7(a) Then
If Program_a7(10) <> 0 Then
'Sec_runtimea7 = Runtime_starta7 * 60
Set Ventil7
'Incr Runtime1
End If
If Lsyssec >= Lsecofday7 Then
Reset Ventil7
'Runtime1 = 0
Starta7_true = 0
End If
Exit For
End If
Next A
End Select
Select Case Starta8_true
Case 1
Bsec8 = 0
Bhour8 = Program_a8(1)
Bmin8 = Program_a8(2)
Runtime_starta8 = Program_a8(3)
For A = 13 To 19
If Weekday = Program_a8(a) Then
If Program_a8(1) <> 0 Then
'Sec_runtimea8 = Runtime_starta8 * 60
Set Ventil8
'Incr Runtime1
End If
If Lsyssec >= Lsecofday8 Then
Reset Ventil8
'Runtime1 = 0
Starta8_true = 0
End If
Exit For
End If
Next A
Case 2
Bsec8 = 0
Bhour8 = Program_a8(4)
Bmin8 = Program_a8(5)
Runtime_starta8 = Program_a8(6)
For A = 13 To 19
If Weekday = Program_a8(a) Then
If Program_a8(4) <> 0 Then
'Sec_runtimea8 = Runtime_starta8 * 60
Set Ventil8
End If
If Lsyssec >= Lsecofday8 Then
Reset Ventil8
Starta8_true = 0
End If
Exit For
End If
Next A
Case 3
Bsec8 = 0
Bhour8 = Program_a8(7)
Bmin8 = Program_a8(8)
Runtime_starta8 = Program_a8(9)
For A = 13 To 19
If Weekday = Program_a8(a) Then
If Program_a8(7) <> 0 Then
'Sec_runtimea8 = Runtime_starta8 * 60
Set Ventil8
End If
If Lsyssec >= Lsecofday8 Then
Reset Ventil8
Starta8_true = 0
End If
Exit For
End If
Next A
Case 4
Bsec8 = 0
Bhour8 = Program_a8(10)
Bmin8 = Program_a8(11)
Runtime_starta8 = Program_a8(12)
For A = 13 To 19
If Weekday = Program_a8(a) Then
If Program_a8(10) <> 0 Then
'Sec_runtimea8 = Runtime_starta8 * 60
Set Ventil8
End If
If Lsyssec >= Lsecofday8 Then
Reset Ventil8
Starta8_true = 0
End If
Exit For
End If
Next A
End Select
End If
Return
End
$include "font8x8.font"
$include "my6_8.font"
$include "font16x16.font"
$include "my12_16.font"
$include "Font5x5.font"
'Triska:
'$bgf "Triska.bgf"[/code:1:4ab90fe45b]
↧