$regfile = "m8def.dat".dat " $crystal = 8000000 Config Adc = Single , Prescaler = Auto , Reference = Internal Config Timer0 = Timer , Prescale = 1024 Enable Interrupts Enable Timer0 On Timer0 Onesec Stop Timer0 Config Pinb.0 = Output Config Pinb.1 = Input Config Pinb.2 = Input Config Pinb.3 = Input Config Pinb.4 = Input Config Pinb.5 = Input Config Portd = Output Config Portc = Output Speaker Alias Pinb.0 Keyset Alias Pinb.1 Keyup Alias Pinb.2 Keydown Alias Pinb.3 Keyalarm Alias Pinb.4 Keychange Alias Pinb.5 Dataport Alias Portd Comm Alias Portc Dim Shor As Byte , Smin As Byte , Ahor As Byte , Amin As Byte Dim Sal As Byte , Mah As Byte , Roz As Byte , Dot1 As Bit , B1 As Byte Dim B As Byte , Csec As Byte , W As Word , E As Word , Temp As Word Dim Strdis As String * 1 , Dot As Bit , L As Byte , Setindex As Byte Dim Tonset As Byte , Ss1 As String * 2 , Ss2 As String * 2 , Ss3 As String * 2 Dim Vv1 As Byte , Vv2 As Byte , Vv3 As Byte Declare Sub Adddate Declare Sub Ring Mah = 1 : Roz = 1 Strdis = "T" Start Adc Start Timer0 Offset: Do If Strdis = "T" Then If Shor < 10 Then Comm = &B10111 Dataport = Lookup(0 , Segdata) Delay Comm = &B11011 Dataport = Lookup(shor , Segdata) Delay Elseif Shor > 9 Then Ss1 = Str(shor) Ss2 = Str(shor) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B10111 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11011 Dataport = Lookup(vv2 , Segdata) Delay End If Comm = &B01111 If Dot = 1 Then Dataport = Lookup(10 , Segdata) If Dot = 0 Then Dataport = Lookup(11 , Segdata) Delay If Smin < 10 Then Comm = &B11101 Dataport = Lookup(0 , Segdata) Delay Comm = &B11110 Dataport = Lookup(smin , Segdata) Delay Elseif Smin > 9 Then Ss1 = Str(smin) Ss2 = Str(smin) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B11101 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11110 Dataport = Lookup(vv2 , Segdata) Delay End If Elseif Strdis = "D" Then If Mah < 10 Then Comm = &B10111 Dataport = Lookup(0 , Segdata) Delay Comm = &B11011 Dataport = Lookup(mah , Segdata) Delay Elseif Mah > 9 Then Ss1 = Str(mah) Ss2 = Str(mah) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B10111 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11011 Dataport = Lookup(vv2 , Segdata) Delay End If Comm = &B11011 Dataport = Lookup(12 , Segdata) Delay If Roz < 10 Then Comm = &B11101 Dataport = Lookup(0 , Segdata) Delay Comm = &B11110 Dataport = Lookup(roz , Segdata) Delay Elseif Roz > 9 Then Ss1 = Str(roz) Ss2 = Str(roz) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B11101 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11110 Dataport = Lookup(vv2 , Segdata) Delay End If Elseif Strdis = "C" Then If Temp < 10 Then Comm = &B11101 Dataport = Lookup(temp , Segdata) Delay Comm = &B01111 Dataport = Lookup(13 , Segdata) Delay Comm = &B11110 Dataport = Lookup(14 , Segdata) Delay Elseif Temp > 9 And Temp < 100 Then Ss1 = Str(temp) Ss2 = Str(temp) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B11011 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11101 Dataport = Lookup(vv2 , Segdata) Delay Comm = &B01111 Dataport = Lookup(13 , Segdata) Delay Comm = &B11110 Dataport = Lookup(14 , Segdata) Delay Elseif Temp > 99 And Temp < 1000 Then Ss1 = Str(temp) Ss2 = Str(temp) Ss3 = Str(temp) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Ss3 = Mid(ss3 , 3 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Vv3 = Val(ss3) Comm = &B10111 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11011 Dataport = Lookup(vv2 , Segdata) Delay Comm = &B11101 Dataport = Lookup(vv3 , Segdata) Delay Comm = &B01111 Dataport = Lookup(13 , Segdata) Delay Comm = &B11110 Dataport = Lookup(14 , Segdata) Delay End If Elseif Strdis = "A" Then If Ahor < 10 Then Comm = &B10111 Dataport = Lookup(0 , Segdata) Delay Comm = &B11011 Dataport = Lookup(ahor , Segdata) Delay Elseif Ahor > 9 Then Ss1 = Str(ahor) Ss2 = Str(ahor) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B10111 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11011 Dataport = Lookup(vv2 , Segdata) Delay End If Comm = &B01111 Dataport = Lookup(10 , Segdata) Delay If Amin < 10 Then Comm = &B11101 Dataport = Lookup(0 , Segdata) Delay Comm = &B11110 Dataport = Lookup(amin , Segdata) Delay Elseif Amin > 9 Then Ss1 = Str(amin) Ss2 = Str(Amin) Ss1 = Mid(ss1 , 1 , 1) Ss2 = Mid(ss2 , 2 , 1) Vv1 = Val(ss1) Vv2 = Val(ss2) Comm = &B11101 Dataport = Lookup(vv1 , Segdata) Delay Comm = &B11110 Dataport = Lookup(vv2 , Segdata) Delay End If End If If Keychange = 0 Then Goto Change Back: 'If Keyset = 0 Then 'Goto Onset 'End If Loop Change: If Strdis = "T" Then Strdis = "D" Waitms 5 Elseif Strdis = "D" Then Strdis = "C" Waitms 5 Elseif Strdis = "C" Then Strdis = "A" Waitms 5 Elseif Strdis = "A" Then Strdis = "T" Waitms 5 End If Goto Back Onesec: Incr B W = Getadc(5) E = E + W If B > 3 Then Incr Csec If Csec > 59 Then Csec = 0 Incr Smin If Smin > 59 Then Smin = 0 Incr Shor If Shor > 23 Then Shor = 0 'Call Adddate End If End If End If Temp = E / 16 W = 0 E = 0 If Dot = 0 Then Dot = 1 Else Dot = 0 End If 'If Shor = Ahor And Smin = Amin Then Call Ring B = 0 End If Return Segdata: Data &B11111100 , &B01100000 , &B11011010 , &B11110010 , &B01100110 , &B10110110 , _ &B10111110 , &B11100000 , &B11111110 , &B11110110 , &B11000000 , &B00000000 , _ &B00000001 , &B00100000 , &B10011100 ' 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , : , , . , ^ , C