$regfile = "m16def.dat"
$crystal = 4000000
' DESINGED BY A.N.T
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = Pinc.0 , E = Pinc.4 , Rs = Pinc.5
Cursor Off
Cls : Lcd " DESINGED BY " : Home L : Lcd " A . N . T " : Wait 2
Config Portb = Output
Config Pind.7 = Output , Pind.6 = Output , Pind.5 = Output , Pind.4 = Output
Config Pind.3 = Input , Pind.2 = Input , Pind.2 = Input , Pind.0 = Input
Config Adc = Single , Prescaler = Auto
Deflcdchar 0 , 24 , 24 , 32 , 32 , 15 , 8 , 8 , 15 ' .C
Deflcdchar 2 , 4 , 14 , 31 , 4 , 4 , 4 , 4 , 4 'UP
Deflcdchar 3 , 4 , 4 , 4 , 4 , 4 , 31 , 14 , 4 'DOWN
Deflcdchar 1 , 1 , 29 , 29 , 29 , 9 , 9 , 8 , 8 'zang
Dim Cc As Byte , Mm As Byte , Ss As Byte , Ct As Byte , Mt As Byte , W As Word
Dim Ecc As Eram Byte , Emm As Eram Byte , Ect As Eram Byte , Emt As Eram Byte
Dim A0 As Word , Stimer As Byte , F As Byte , Cup As Byte , Cdown As Byte , Mz As Byte
Dim Roz As Byte , Mah As Byte , Sal As Byte , Hafteh As Byte , B As Byte , Z As Byte
Dim Eb As Eram Byte , Eroz As Eram Byte , Emah As Eram Byte , Esal As Eram Byte
Dim Ehafteh As Eram Byte , Ecup As Eram Byte , Ecdown As Eram Byte , Ett5 As Eram Byte
Dim Tt1 As Byte , Tt2 As Byte , Tt3 As Byte , Tt4 As Byte , Tt5 As Byte , Kk As Byte
Dim Ett1 As Eram Byte , Ett2 As Eram Byte , Ett3 As Eram Byte , Ett4 As Eram Byte
Cc = Ecc : Mm = Emm : Ct = Ect : Mt = Emt : B = Eb : Cdown = Ecdown
Roz = Eroz : Mah = Emah : Sal = Esal : Hafteh = Ehafteh : Cup = Ecup
Tt1 = Ett1 : Tt2 = Ett2 : Tt3 = Ett3 : Tt4 = Ett4 : Tt5 = Ett5
Const T1 = 100
Config Timer2 = Timer , Async = On , Prescale = 32
Enable Interrupts
Enable Timer2
On Timer2 Sectic
Cls
If Cc < 10 Then : Lcd " " ; Cc
Elseif Cc < 24 Then : Lcd Cc
Else : Cc = 10 : Lcd "10"
End If
Lcd ":"
If Mm < 10 Then : Lcd "0" ; Mm
Elseif Mm < 60 Then : Lcd Mm
Else : Mm = 0 : Lcd "00"
End If
Lcd ":00" : Locate 1 , 12
If Ct < 10 Then : Lcd " " ; Ct
Elseif Ct < 24 Then : Lcd Ct
Else : Ct = 6 : Lcd " 6"
End If
Lcd ":"
If Mt < 10 Then : Lcd "0" ; Mt
Elseif Mt < 60 Then : Lcd Mt
Else : Mt = 30 : Lcd "30"
End If
Locate 1 , 10
If B = 1 Then : Lcd Chr(1) : Set Portb.3
Elseif B = 0 Then : Lcd " " : Reset Portb.3
Else : B = 1 : Lcd Chr(1) : Set Portb.3
End If
Home L
If Sal < 10 Then : Lcd " " ; Sal
Elseif Sal < 100 Then : Lcd Sal
Else : Sal = 87 : Lcd "87"
End If
Locate 2 , 3 : Lcd "/"
If Mah < 10 Then : Lcd "0" ; Mah
Elseif 13 > Mah Then : Lcd Mah
Else : Mah = 1 : Lcd "01"
End If
Locate 2 , 6 : Lcd "/"
If Roz < 10 Then : Lcd "0" ; Roz
Elseif Roz < 32 Then : Lcd Roz
Else : Roz = 1 : Lcd "01"
End If
If Cup > 99 Then : Cup = 40 : End If
If Cdown > 99 Then : Cdown = 10 : End If
If Tt1 > 15 Then Tt1 = 1
If Tt2 > 15 Then Tt2 = 1
If Tt3 > 15 Then Tt3 = 1
If Tt4 > 15 Then Tt4 = 1
If Tt5 > 15 Then Tt5 = 1
Locate 2 , 9
Select Case Hafteh
Case 1 : Lcd " SAT"
Case 2 : Lcd " SUN"
Case 3 : Lcd " MON"
Case 4 : Lcd " TUE"
Case 5 : Lcd " WED"
Case 6 : Lcd " THU"
Case 7 : Lcd " FRI"
Case Else
Hafteh = 6 : Lcd " THU"
End Select
' SHORO BARNAMEH
Star:
F = 0 : Waitms T1 : Kk = 0
Do
Debounce Pind.0 , 1 , Ct
Debounce Pind.3 , 1 , Tt
If Pind.1 = 1 Then :
If Pind.2 = 1 Then Exit Do
End If
Loop
For W = 0 To 40000
If Pind.1 = 0 Then Goto Star
If Pind.2 = 0 Then Goto Star
Debounce Pind.3 , 1 , D7 , Sub
Waitus 60
Next
Goto Dama1
Tt:
Kk = 1
For W = 0 To 40000
If Pind.3 = 0 Then Goto D7
Waitus 63
Next
Goto Tt1
' HAR 0.25 SANEH YEKBAR BE IN VAGHFEH MORAJEEH MISHAVAD
' BARAY BE ROOZ KARDAN ZAMAN
Sectic:
Select Case Stimer
Case 0
Gosub Offlcd
If Ss = 20 Then :
If A0 >= Cup Then : Set Portb.0
Else : Reset Portb.0
End If
If Cdown >= A0 Then : Set Portb.2
Else : Reset Portb.2
End If
If Cup > A0 Then :
If A0 > Cdown Then : Set Portb.1
Else : Reset Portb.1
End If
Else : Reset Portb.1
End If
If A0 > 99 Then : Reset Portb.0 : Reset Portb.1 : Reset Portb.2
End If
Elseif Ss = 50 Then :
If A0 >= Cup Then : Set Portb.0
Else : Reset Portb.0
End If
If Cdown >= A0 Then : Set Portb.2
Else : Reset Portb.2
End If
If Cup > A0 Then :
If A0 > Cdown Then : Set Portb.1
Else : Reset Portb.1
End If
Else : Reset Portb.1
End If
If A0 > 99 Then : Reset Portb.0 : Reset Portb.1 : Reset Portb.2
End If
End If
If Z = 1 Then : Reset Portd.5 : Set Portd.6
Elseif Z = 3 Then : Reset Portd.5 : Set Portd.6
Else :
If Z = 5 Then : Set Portd.5 : Set Portd.6
Else : Reset Portd.5 : Reset Portd.6
End If
End If
' DESINGED BY A.N.T
Case 1 :
Toggle Portd.4 : Gosub Onlcd
If Z = 1 Then : Reset Portd.5
Elseif Z = 3 Then : Reset Portd.5
Else :
If Z = 5 Then : Reset Portd.5
Else : Reset Portd.5 : Reset Portd.6
End If
End If
Start Adc : A0 = Getadc(0) : Stop Adc
A0 = A0 / 2 : Locate 2 , 13
If F <> 11 Then :
If F <> 12 Then :
If A0 < 10 Then : Lcd " " ; A0 ; Chr(0)
Elseif A0 > 99 Then : Lcd " ERR"
Else : Lcd " " ; A0 ; Chr(0)
End If
End If
End If
Case 2 :
Gosub Offlcd
Select Case B
Case 1 :
If Cc = Ct Then
If Mm = Mt Then :
If Z = 0 Then :
Set Portd.5 : Set Portd.6 : Set Portd.7
Mz = Mm + Tt1 : Z = 1
If Mz > 59 Then : Mz = Mz - 60 : End If
End If
Else : Reset Portd.5
End If
End If
Case Else :
Reset Portd.5
End Select
If Mz = Mm Then :
If Z = 1 Then :
Z = 2 : Mz = Mm + Tt2
If Mz > 59 Then Mz = Mz - 60
Elseif Z = 2 Then:
Z = 3 : Mz = Mm + Tt3
If Mz > 59 Then Mz = Mz - 60
Else :
If Z = 3 Then :
Z = 4 : Mz = Mm + Tt4
If Mz > 59 Then Mz = Mz - 60
Elseif Z = 4 Then:
Z = 5 : Mz = Mm + Tt5
If Mz > 59 Then Mz = Mz - 60
Else : Z = 0
End If
End If
End If
If Z = 1 Then : Set Portd.5 : Set Portd .6
Elseif Z = 3 Then : Set Portd.5 : Set Portd .6
Else :
If Z = 5 Then : Set Portd.5
Else : Reset Portd.5
End If
End If
' DESINGED BY A.N.T
Case 3 :
Toggle Portd.4 : Ss = Ss + 1
If Ss > 59 Then :
Ss = 0 : Mm = Mm + 1
If Mm > 59 Then
Mm = 0 : Cc = Cc + 1 : Ecc = Cc
If Cc > 23 Then
Cc = 0 : Roz = Roz + 1 : Hafteh = Hafteh + 1
If Hafteh > 7 Then Hafteh = 1
If Mah > 6 Then
If Roz > 30 Then
Roz = 1 : Mah = Mah + 1
If Mah > 12 Then :
Mah = 1 : Sal = Sal + 1
If Sal > 99 Then Sal = 0
If Sal < 10 Then : Home L : Lcd " " ; Sal ; "/"
Else : Home L : Lcd Sal
End If
Esal = Sal
End If
If Mah < 10 Then : Locate 2 , 4 : Lcd "0" ; Mah ; "/"
Else : Locate 2 , 4 : Lcd Mah
End If
Emah = Mah
End If
Elseif 7 > Mah Then :
If Roz > 31 Then
Roz = 1 : Mah = Mah + 1
If Mah > 12 Then
Mah = 1 : Sal = Sal + 1
If Sal < 10 Then : Home L : Lcd " " ; Sal ; "/"
Else : Home L : Lcd Sal ; "/"
End If
Esal = Sal
End If
If Mah < 10 Then : Locate 2 , 4 : Lcd "0" ; Mah ; "/"
Else : Locate 2 , 4 : Lcd Mah
End If
Emah = Mah
End If
Eroz = Roz : Ehafteh = Hafteh
End If
Locate 2 , 9
Select Case Hafteh
Case 1 : Lcd " SAT"
Case 2 : Lcd " SUN"
Case 3 : Lcd " MON"
Case 4 : Lcd " TUE"
Case 5 : Lcd " WED"
Case 6 : Lcd " THU"
Case 7 : Lcd " FRI"
End Select
Locate 2 , 7
If Roz < 10 Then : Lcd "0" ; Roz
Else : Lcd Roz
End If
End If
If Cc < 10 Then : Home : Lcd " " ; Cc ; ":"
Else : Home : Lcd Cc ; ":"
End If
Ecc = Cc
End If
If Mm < 10 Then : Locate 1 , 4 : Lcd "0" ; Mm ; ":"
Else : Locate 1 , 4 : Lcd Mm ; ":"
End If
Emm = Mm
End If
Locate 1 , 7
If Ss < 10 Then : Lcd "0" ; Ss
Else : Lcd Ss
End If
Lcd " "
Gosub Onlcd : Stimer = 255
If Z = 1 Then : Reset Portd.5
Elseif Z = 3 Then : Set Portd.5
Else :
If Z = 5 Then : Set Portd.5 : Set Portd.6
Else : Reset Portd.5
End If
End If
End Select
Incr Stimer : Locate 2 , 20
Return
' BARAY TANZIM SA@
Cc:
F = 1 : Locate 1 , 12
If Ct < 10 Then : Lcd " " ; Ct ; ":"
Else : Lcd Ct ; ":"
End If
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Mm
Debounce Pind.1 , 1 , Cc8
Debounce Pind.2 , 1 , Cc9
Loop
Cc8:
Cc = Cc + 1 : If Cc > 23 Then Cc = 0 : Goto Cc
Cc9:
Cc = Cc - 1 : If Cc > 100 Then Cc = 23 : Goto Cc
Return
' BARAY TANZIM DAGHIGHEH
Mm:
Ecc = Cc : F = 2 : Home
If Cc < 10 Then : Lcd " " ; Cc ; ":"
Else : Lcd Cc ; ":"
End If
Mm1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Ss
Debounce Pind.1 , 1 , Mm8
Debounce Pind.2 , 1 , Mm9
Loop
Mm8:
Mm = Mm + 1 : If Mm > 59 Then Mm = 0 : Goto Mm1
Mm9:
Mm = Mm - 1 : If Mm > 200 Then Mm = 59 : Goto Mm1
Return
' BARAY TANZIM SANIYEH
Ss:
Emm = Mm : F = 3 : Locate 1 , 4
If Mm < 10 Then : Lcd "0" ; Mm ; ":"
Else : Lcd Mm ; ":"
End If
Ss1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Ssal
Debounce Pind.1 , 1 , Ss8
Debounce Pind.2 , 1 , Ss9
Loop
' DESINGED BY A.N.T
Ss9:
Timer2 = 0 : Stimer = 0 : Ss = 0 : Locate 1 , 7 : Lcd "00" : Goto Ss1
Ss8:
Timer2 = 0 : Stimer = 0
If Ss > 29 Then Mm = Mm + 1
If Mm > 59 Then
Mm = 0 : Cc = Cc + 1 : Ecc = Cc
If Cc > 23 Then
Cc = 0 : Roz = Roz + 1 : Hafteh = Hafteh + 1
If Hafteh > 7 Then Hafteh = 1
If Mah > 6 Then
If Roz > 30 Then
Roz = 1 : Mah = Mah + 1
If Mah > 12 Then
Mah = 1 : Sal = Sal + 1
If Sal > 99 Then Sal = 0
If Sal < 10 Then : Home L : Lcd " " ; Sal ; "/"
Else : Home L : Lcd Sal
End If
Esal = Sal
End If
If Mah < 10 Then : Locate 2 , 4 : Lcd "0" ; Mah ; "/"
Else : Locate 2 , 4 : Lcd Mah
End If
Emah = Mah
End If
Elseif 7 > Mah Then :
If Roz > 31 Then
Roz = 1 : Mah = Mah + 1
If Mah > 12 Then
Mah = 1 : Sal = Sal + 1
If Sal < 10 Then : Home L : Lcd " " ; Sal ; "/"
Else : Home L : Lcd Sal ; "/"
End If
Esal = Sal
End If
If Mah < 10 Then : Locate 2 , 4 : Lcd "0" ; Mah ; "/"
Else : Locate 2 , 4 : Lcd Mah
End If
Emah = Mah
End If
Eroz = Roz : Ehafteh = Hafteh
End If
Locate 2 , 9
Select Case Hafteh
Case 1 : Lcd " SAT"
Case 2 : Lcd " SUN"
Case 3 : Lcd " MON"
Case 4 : Lcd " TUE"
Case 5 : Lcd " WED"
Case 6 : Lcd " THU"
Case 7 : Lcd " FRI"
End Select
Locate 2 , 7
If Roz < 10 Then : Lcd "0" ; Roz
Else : Lcd Roz
End If
End If
If Cc < 10 Then : Home : Lcd " " ; Cc ; ":"
Else : Home : Lcd Cc ; ":"
End If
Ecc = Cc
End If
Locate 1 , 4
If Mm < 10 Then : Lcd "0" ; Mm ; "/00"
Else : Lcd Mm ; "/00"
End If
Ss = 0 : Goto Ss1
Return
' BARAT TANZIM SA@ TIMER
Ct:
F = 4
For W = 0 To 40000
If Pind.0 = 0 Then : Goto Ct1 : End If
Waitus 60
Debounce Pind.3 , 1 , D7 , Sub
Next
Goto Cc
Ct1:
Waitms T1 : Z = 10 : Reset Portb.3
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Mt
Debounce Pind.1 , 1 , Ct8
Debounce Pind.2 , 1 , Ct9
Loop
Ct8:
Ct = Ct + 1 : If Ct > 23 Then Ct = 0 : Goto Ct1
Ct9:
Ct = Ct - 1 : If Ct > 200 Then Ct = 23 : Goto Ct1
Return
' BARAT TANZIM DAGHIGHEH TIMER
Mt:
Ect = Ct : F = 5 : Locate 1 , 12 : Z = 10
If Ct < 10 Then : Lcd " " ; Ct ; ":"
Else : Lcd Ct ; ":"
End If
Mt1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Mt2
Debounce Pind.1 , 1 , Mt8
Debounce Pind.2 , 1 , Mt9
Loop
Mt8:
Mt = Mt + 1 : If Mt > 59 Then Mt = 0 : Goto Mt1
Mt9:
Mt = Mt - 1 : If Mt > 200 Then Mt = 59 : Goto Mt1
Mt2:
Emt = Mt : Locate 1 , 15
If Mt < 10 Then : Lcd "0" ; Mt
Else : Lcd Mt
End If
Z = 0 : If B = 1 Then Set Portb.3 : Goto Star
Return
' BARAY FAAL VA GHER FAAL KARDAN TIMER
D7:
Locate 1 , 10
If B = 0 Then : B = 1 : Lcd Chr(1) : Set Portb.3
Elseif B = 1 Then : B = 0 : Lcd " " : Reset Portb.3
Else : B = 1 : Lcd Chr(1) : Set Portb.3
End If
Eb = B : Locate 2 , 20 : Reset Portd.7 : Z = 0
Reset Portd.5 : Reset Portd.6 : If Kk = 1 Then Goto Star
Waitms T1
Return
Return
' BARAY TANZIM TARIKH SAL
Ssal:
F = 6 : Locate 1 , 7
If Ss < 10 Then : Lcd "0" ; Ss
Else : Lcd Ss
End If
Ssal1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Mmah
Debounce Pind.1 , 1 , Ssal8
Debounce Pind.2 , 1 , Ssal9
Loop
Ssal8:
Sal = Sal + 1 : If Sal > 99 Then Sal = 0 : Goto Ssal1
Ssal9:
Sal = Sal - 1 : If Sal > 200 Then Sal = 99 : Goto Ssal1
Return
' BARAY TANZIM TARIKH MAH
Mmah:
F = 7 : Esal = Sal : Home L
If 10 > Sal Then : Lcd " " ; Sal ; "/"
Else : Lcd Sal ; "/"
End If
Mmah1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Rroz
Debounce Pind.1 , 1 , Mmah8:
Debounce Pind.2 , 1 , Mmah9
Loop
Mmah8:
Mah = Mah + 1 : If Mah > 12 Then Mah = 1 : Goto Mmah1
Mmah9:
Mah = Mah - 1 : If Mah = 0 Then Mah = 12 : Goto Mmah1
Return
' BARAY TANZIM TARIKH ROZ
Rroz:
F = 8 : Emah = Mah : Locate 2 , 4
If 10 > Mah Then : Lcd "0" ; Mah ; "/"
Else : Lcd Mah ; "/"
End If
Rroz1:
Waitms T1
Select Case Mah :
Case Is > 6 :
If Roz > 30 Then : Roz = 1
Elseif Roz = 0 Then : Roz = 30
End If
Case Is < 7 :
If Roz > 31 Then : Roz = 1
Elseif Roz = 0 Then : Roz = 31
End If
End Select
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Hhafteh
Debounce Pind.1 , 1 , Rroz8
Debounce Pind.2 , 1 , Rroz9
Loop
Rroz8:
Roz = Roz + 1 : Goto Rroz1
Rroz9:
Roz = Roz - 1 : Goto Rroz1
Return
' BARAY TANZIM ROOZ HAFTEH
Hhafteh:
F = 9 : Eroz = Roz : Locate 2 , 7
If Roz < 10 Then : Lcd "0" ; Roz
Else : Lcd Roz
End If
Hhafteh1:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Hhafteh2
Debounce Pind.1 , 1 , Hhafteh8
Debounce Pind.2 , 1 , Hhafteh9
Loop
Hhafteh8:
Hafteh = Hafteh + 1 : If Hafteh > 7 Then Hafteh = 1 : Goto Hhafteh1
Hhafteh9:
Hafteh = Hafteh - 1 : If Hafteh = 0 Then Hafteh = 7 : Goto Hhafteh1
Hhafteh2:
Ehafteh = Hafteh : Locate 2 , 9
Select Case Hafteh:
Case 1 : Lcd " SAT"
Case 2 : Lcd " SUN"
Case 3 : Lcd " MON"
Case 4 : Lcd " TUE"
Case 5 : Lcd " WED"
Case 6 : Lcd " THU"
Case 7 : Lcd " FRI"
End Select
Goto Star
Return
' BARAY TANZIM DAMAY BALA
Dama1:
F = 11
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Dama2
If Pind.1 = 0 Then :
If Pind.2 = 0 Then Exit Do
End If
Loop
Dama15:
Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Dama2
Debounce Pind.1 , 1 , Dama18
Debounce Pind.2 , 1 , Dama19
Loop
Dama18:
Cup = Cup + 1 : If Cup > 99 Then Cup = 0 : Goto Dama15
Dama19:
Cup = Cup - 1 : If Cup > 200 Then Cup = 99 : Goto Dama15
Return
' BARAY TANZIM DAMAY PAEEN
Dama2:
F = 12 : Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Dama22
Debounce Pind.1 , 1 , Dama28
Debounce Pind.2 , 1 , Dama29
Loop
Dama28:
Cdown = Cdown + 1 : If Cdown > 99 Then Cdown = 0 : Goto Dama2
Dama29:
Cdown = Cdown - 1 : If Cdown > 200 Then Cdown = 99 : Goto Dama2
Dama22:
Ecdown = Cdown : Ecup = Cup : Locate 2 , 13
If A0 < 10 Then : Lcd " " ; A0 ; Chr(0)
Elseif A0 > 99 Then : Lcd " ERR"
Else : Lcd " " ; A0 ; Chr(0)
End If
Goto Star
Return
' BARAY TANZIM ZAMAN T1
Tt1:
F = 21 : Waitms T1 : Kk = 0
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Tt13
Debounce Pind.1 , 1 , Tt11
Debounce Pind.2 , 1 , Tt12
Loop
Tt11:
Tt1 = Tt1 + 1 : If Tt1 > 15 Then Tt1 = 0 : Goto Tt1
Tt12:
Tt1 = Tt1 - 1 : If Tt1 = 255 Then Tt1 = 15 : Goto Tt1
Tt13:
Ett1 = Tt1 : Goto Tt2
Return
' BARAY TANZIM ZAMAN T2
Tt2:
F = 22 : Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Tt23
Debounce Pind.1 , 1 , Tt21
Debounce Pind.2 , 1 , Tt22
Loop
Tt21:
Tt2 = Tt2 + 1 : If Tt2 > 15 Then Tt2 = 0 : Goto Tt2
Tt22:
Tt2 = Tt2 - 1 : If Tt2 = 255 Then Tt2 = 15 : Goto Tt2
Tt23:
Ett2 = Tt2 : Goto Tt3
Return
' BARAY TANZIM ZAMAN T3
Tt3:
F = 23 : Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Tt33
Debounce Pind.1 , 1 , Tt31
Debounce Pind.2 , 1 , Tt32
Loop
Tt31:
Tt3 = Tt3 + 1 : If Tt3 > 15 Then Tt3 = 0 : Goto Tt3
Tt32:
Tt3 = Tt3 - 1 : If Tt3 = 255 Then Tt3 = 15 : Goto Tt3
Tt33:
Ett3 = Tt3 : Goto Tt4
Return
' BARAY TANZIM ZAMAN T4
Tt4:
F = 24 : Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Tt43
Debounce Pind.1 , 1 , Tt41
Debounce Pind.2 , 1 , Tt42
Loop
Tt41:
Tt4 = Tt4 + 1 : If Tt4 > 15 Then Tt4 = 0 : Goto Tt4
Tt42:
Tt4 = Tt4 - 1 : If Tt4 = 255 Then Tt4 = 15 : Goto Tt4
Tt43:
Ett4 = Tt4 : Goto Tt5
Return
' BARAY TANZIM ZAMAN T5
Tt5:
F = 25 : Waitms T1
Do
Debounce Pind.3 , 1 , D7 , Sub
Debounce Pind.0 , 1 , Tt53
Debounce Pind.1 , 1 , Tt51
Debounce Pind.2 , 1 , Tt52
Loop
Tt51:
Tt5 = Tt5 + 1 : If Tt5 > 15 Then Tt5 = 0 : Goto Tt5
Tt52:
Tt5 = Tt5 - 1 : If Tt5 = 255 Then Tt5 = 15 : Goto Tt5
Tt53:
F = 0 : Ett5 = Tt5 : Locate 1 , 12 :
If Ct < 10 Then : Lcd " " ; Ct
Else : Lcd Ct
End If
Lcd ":" : Locate 1 , 15 :
If Mt < 10 Then : Lcd "0" ; Mt
Else : Lcd Mt
End If
Goto Star
Return
' BARAY KHAMOSH KARDAN ETELAAT LCD DAR ZAMAN CHESHMAK ZADAN HENGAM ENTEKHAB GOZINEH MARBOTEH
Offlcd:
If F <> 0 Then :
If F = 1 Then : Home : Lcd " "
Elseif F = 2 Then : Locate 1 , 4 : Lcd " "
Else :
If F = 3 Then : Locate 1 , 7 : Lcd " "
Elseif F = 4 Then : Locate 1 , 12 : Lcd " "
End If
End If
If F = 5 Then : Locate 1 , 15 : Lcd " "
Elseif F = 6then : Locate 2 , 1 : Lcd " "
Else :
If F = 7 Then : Locate 2 , 4 : Lcd " "
Elseif F = 8then : Locate 2 , 7 : Lcd " "
End If
End If
If F = 9 Then : Locate 2 , 9 : Lcd " "
Elseif F = 25 Then : Locate 1 , 15 : Lcd " "
Else :
If F = 11 Then : Locate 2 , 13 : Lcd " " ; Chr(2)
Elseif F = 12 Then : Locate 2 , 13 : Lcd " " ; Chr(3)
End If
End If
' DESINGED BY A.N.T
If F = 21 Then : Locate 1 , 15 : Lcd " "
Elseif F = 22 Then : Locate 1 , 15 : Lcd " "
Else :
If F = 23 Then : Locate 1 , 15 : Lcd " "
Elseif F = 24 Then : Locate 1 , 15 : Lcd " "
End If
End If
End If
Return
' BARAY NAMAYESH ETELAAT MORED NIYAZ DAR ZAMAN MONASEB BAR ROY LCD
Onlcd:
If F <> 0 Then :
Home
If Cc < 10 Then : Lcd " " ; Cc
Else : Lcd Cc
End If
Locate 1 , 4
If Mm < 10 Then : Lcd "0" ; Mm
Else : Lcd Mm
End If
Locate 1 , 7
If Ss < 10 Then : Lcd "0" ; Ss
Else : Lcd Ss
End If
Home L
If Sal < 10 Then : Lcd " " ; Sal
Else : Home L : Lcd Sal
End If
If F = 5 Then
Locate 1 , 15 :
If Mt < 10 Then : Lcd "0" ; Mt
Else : Lcd Mt
End If
Elseif F = 4 Then
Locate 1 , 12 :
If Ct < 10 Then : Lcd " " ; Ct
Else : Lcd Ct
End If
End If
Locate 2 , 4
If Mah < 10 Then : Lcd "0" ; Mah
Else : Lcd Mah
End If
Locate 2 , 7
If Roz < 10 Then : Lcd "0" ; Roz
Else : Lcd Roz
End If
Locate 2 , 9
Select Case Hafteh
Case 1 : Lcd " SAT"
Case 2 : Lcd " SUN"
Case 3 : Lcd " MON"
Case 4 : Lcd " TUE"
Case 5 : Lcd " WED"
Case 6 : Lcd " THU"
Case 7 : Lcd " FRI"
End Select
If F = 25 Then
Locate 1 , 12 : : Lcd "T5="
If Tt5 < 10 Then : Lcd "0" ; Tt5
Else : Lcd Tt5
End If
End If
If F = 11 Then
Locate 2 , 14
If Cup < 10 Then : Lcd "0" ; Cup
Else : Lcd Cup
End If
Elseif F = 12 Then :
Locate 2 , 14
If Cdown < 10 Then : Lcd "0" ; Cdown
Else : Lcd Cdown
End If
End If
If F = 21 Then
Locate 1 , 12 : Lcd "T1="
If Tt1 < 10 Then : Lcd "0" ; Tt1
Else : Lcd Tt1
End If
Elseif F = 22 Then
Locate 1 , 12 : : Lcd "T2="
If Tt2 < 10 Then : Lcd "0" ; Tt2
Else : Lcd Tt2
End If
End If
If F = 23 Then
Locate 1 , 12 : Lcd "T3="
If Tt3 < 10 Then : Lcd "0" ; Tt3
Else : Lcd Tt3
End If
Elseif F = 24 Then
Locate 1 , 12 : : Lcd "T4="
If Tt4 < 10 Then : Lcd "0" ; Tt4
Else : Lcd Tt4
End If
End If
End If
Return
' DESINGED BY A.N.T
End
' terip2008@yahoo.com