$regfile = "m32def.dat" $crystal = 11059200 Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Porta.2 , Rs = Porta.0 Config Lcd = 16 * 2 Cursor Off Config Pinc.1 = Input '+ output timer Config Pinc.0 = Input '- output timer Config Kbd = Portd Set Ddra.3 'seting as output for lcd light Set Porta.3 'lcd light on Set Ddrc.0 'seting as output for timer puls Set Ddrc.1 Reset Portc.1 Declare Sub Incr_hour Declare Sub Incr_minut Declare Sub Incr_day Declare Sub Incr_mount Declare Sub Incr_hour_t1 Declare Sub Incr_minut_t1 Declare Sub Incr_day_t1 Declare Sub Incr_mount_t1 Dim Second As Byte , Minut As Byte , Hour As Byte Dim Second_t1 As Byte , Minut_t1 As Byte , Hour_t1 As Byte Dim Mount As Byte , Day As Byte , Year As Integer Dim Mount_t1 As Byte , Day_t1 As Byte Dim Setmode As Bit , Demomode As Bit , Delaydemo As Bit , Dtshow As Bit , Showtime As Bit Dim Showdate As Bit , T1 As Bit , T1on As Bit , T1_clear As Bit Dim T1_blank As Bit Dim Demostep As Byte Hour = 0 : Minut = 0 : Second = 0 Year = 1386 : Mount = 1 : Day = 1 Mount_t1 = 1 : Day_t1 = 1 Reset Setmode Reset Demomode Reset Delaydemo Reset T1 Reset T1_clear Set T1_blank Set Dtshow Set Showdate Set Showtime Demostep = 0 Main: Cls : Home Do If Getkbd() = 15 And Demomode = 0 Then Toggle Setmode If Getkbd() = 11 And Setmode = 0 Then Toggle Demomode Demostep = 0 End If If Getkbd() = 12 And Demomode = 0 And Setmode = 0 Then Toggle T1 If Getkbd() = 7 Then Reset Setmode Reset Demomode Reset T1 End If If Getkbd() = 0 And Setmode = 1 And Demomode = 0 And T1 = 0 Then Call Incr_minut If Getkbd() = 1 And Setmode = 1 And Demomode = 0 And T1 = 0 Then Call Incr_hour If Getkbd() = 2 And Setmode = 1 And Demomode = 0 And T1 = 0 Then Call Incr_day If Getkbd() = 3 And Setmode = 1 And Demomode = 0 And T1 = 0 Then Call Incr_mount If Getkbd() = 0 And Setmode = 0 And Demomode = 0 And T1 = 0 Then Toggle Dtshow If Getkbd() = 1 And Setmode = 0 And Demomode = 0 And T1 = 0 Then Toggle Showtime If Getkbd() = 2 And Setmode = 0 And Demomode = 0 And T1 = 0 Then Toggle Showdate If Getkbd() = 3 And Setmode = 0 And Demomode = 0 And T1 = 0 Then Toggle Porta.3 If Getkbd() = 0 And T1 = 1 And Setmode = 0 Then Toggle T1on Reset T1_clear End If If Getkbd() = 0 And T1 = 1 And Setmode = 1 Then Call Incr_minut_t1 If Getkbd() = 1 And T1 = 1 And Setmode = 1 Then Call Incr_hour_t1 If Getkbd() = 2 And T1 = 1 And Setmode = 1 Then Call Incr_day_t1 If Getkbd() = 3 And T1 = 1 And Setmode = 1 Then Call Incr_mount_t1 Cls If Demomode = 0 And Dtshow = 0 And Showtime = 1 And T1 = 0 Then Lcd "" ; Hour ; ":" ; Minut ; ":" ; Second If Demomode = 0 And Dtshow = 1 And Showtime = 1 And T1 = 0 Then Lcd "Time: " ; Hour ; ":" ; Minut ; ":" ; Second Locate 2 , 1 If Demomode = 0 And Dtshow = 0 And Showdate = 1 And T1 = 0 Then Lcd "" ; Year ; "/" ; Mount ; "/" ; Day If Demomode = 0 And Dtshow = 1 And Showdate = 1 And T1 = 0 Then Lcd "Date: " ; Year ; "/" ; Mount ; "/" ; Day Locate 1 , 1 If Demomode = 0 And T1 = 1 Then Lcd "T: " ; Hour_t1 ; ":" ; Minut_t1 ; ":" ; Second_t1 Locate 2 , 1 If Demomode = 0 And T1 = 1 Then Lcd "D: " ; Year ; "/" ; Mount_t1 ; "/" ; Day_t1 Locate 2 , 16 If Demomode = 0 And T1 = 1 Then Lcd "T" If Setmode = 1 Then Locate 1 , 15 Lcd "SM" End If If Setmode = 0 And T1on = 1 And Demomode = 0 And Portc.0 = 1 Then Toggle T1_blank If Setmode = 0 And T1on = 1 And Demomode = 0 And T1_blank = 1 Then Locate 1 , 15 Lcd "T1" End If If Demomode = 1 And Setmode = 0 And Demostep = 0 Then Cls Locate 1 , 5 Lcd "Designer" Locate 2 , 3 Lcd "Rasool Shiri" End If If Demomode = 1 And Setmode = 0 And Demostep = 1 Then Cls Locate 1 , 4 Lcd "Student ID" Locate 2 , 5 Lcd "84817743" End If If Demomode = 1 And Setmode = 0 And Demostep = 2 Then Cls Locate 1 , 5 Lcd "Teacher" Locate 2 , 4 Lcd "Mr.Razavi" End If If Demomode = 1 And Setmode = 0 And Demostep = 3 Then Cls Locate 1 , 4 Lcd "Uneversity" Locate 2 , 1 Lcd "azad kermanshah" End If If Demomode = 1 And Setmode = 0 And Demostep = 4 Then Cls Locate 1 , 5 Lcd "Lectuer" Locate 2 , 1 Lcd "Architectuer Lab" End If Waitms 942 Incr Second If Second > 59 Then Second = 0 Incr Minut End If If Minut > 59 Then Minut = 0 Incr Hour End If If Hour > 23 Then Hour = 0 Incr Day End If If Mount < 7 And Day > 31 Then Incr Mount Day = 1 End If If Mount > 7 And Mount < 12 And Day > 30 Then Incr Mount Day = 1 End If If Mount = 12 And Day > 29 Then Mount = 1 Day = 1 Incr Year End If If Demomode = 1 And Delaydemo = 1 Then Incr Demostep If Demostep = 5 Then Demostep = 0 Toggle Delaydemo If Mount = Mount_t1 And Day = Day_t1 And Hour = Hour_t1 And Minut = Minut_t1 And T1on = 1 Then Set Portc.0 Set T1_clear Else Reset Portc.0 Set T1_blank End If If T1_clear = 1 And T1on = 1 And Portc.0 = 0 Then Reset T1on jmp main Loop End Incr_minut: Incr Minut If Minut > 59 Then Minut = 0 Return Incr_hour: Incr Hour If Hour > 23 Then Hour = 0 Return Incr_day: Incr Day If Mount < 7 And Day > 31 Then Day = 1 If Mount > 7 And Mount < 12 And Day > 30 Then Day = 1 If Mount = 12 And Day > 29 Then Day = 1 Return Incr_mount: Incr Mount If Mount > 12 Then Mount = 1 Return Incr_minut_t1: Incr Minut_t1 If Minut_t1 > 59 Then Minut_t1 = 0 Return Incr_hour_t1: Incr Hour_t1 If Hour_t1 > 23 Then Hour_t1 = 0 Return Incr_day_t1: Incr Day_t1 If Mount_t1 < 7 And Day_t1 > 31 Then Day_t1 = 1 If Mount_t1 > 7 And Mount_t1 < 12 And Day_t1 > 30 Then Day_t1 = 1 If Mount_t1 = 12 And Day_t1 > 29 Then Day_t1 = 1 Return Incr_mount_t1: Incr Mount_t1 If Mount_t1 > 12 Then Mount_t1 = 1 Return