X
تبلیغات
پیکان - برنامه ساعت به زبان بسکام

$regfile = "M32def.dat"
$crystal = 1000000
Config Lcdpin = Pin , Db4 = Pina.3 , Db5 = Pina.4 , Db6 = Pina.5 , Db7 = _ Pina.6 , E = Pina.2 , Rs = Pina.1
Config Lcd = 16 * 2
Config Kbd = Portb , Debounce = 50 , Delay = 100
Config Timer0 = Timer , Prescale = 1
Dim S As Byte , M As Byte , H As Byte , Day As Byte , Mon As Byte , Y As Integer , D As Byte , A As Byte , N As Integer
Y = 2000
Cursor Off
Enable Ovf0
Enable Interrupts
Enable Timer0
Stop Timer0
Start Timer0
On Ovf0 L1
Mn:
Do
 A = Getkbd()
 If A = 0 Then
 jmp Tanzemat
 End If
 If A = 1 Then
 jmp Tanzemat
 End If
 If A = 4 Then
 jmp Tanzemat
 End If
 If A = 5 Then
 jmp Tanzemat
 End If
 If A = 6 Then
 jmp Tanzemat
 End If
Loop
End
Tanzemat:
D = A
Do
 A = Getkbd()
 If D = 0 Then
    If A = 0 Then
     Incr H
     A = 16
     If H > 24 Then
      Incr Day
      H = 1
     End If
    End If
 End If
 If D = 1 Then
    If A = 1 Then
    Incr M
    A = 16
     If M > 60 Then
      Incr H
      M = 1
     End If
    End If
 End If
 If D = 4 Then
    If A = 4 Then
     Incr Y
     A = 16
    End If
 End If
 If D = 5then
    If A = 5 Then
    Incr Mon
    A = 16
     If Mon > 12then
      Incr Y
      Mon = 1
     End If
    End If
 End If
 If D = 6 Then
    If A = 6 Then
     Incr Day
     A = 16
      If Day > 30 Then
       Incr Mon
       Day = 1
      End If
    End If
 End If
 If A = 2 Then
   jmp Mn
 End If
Loop
Return                                                      'end program
L1:                                                         '
N = N + 1
If N = 3921 Then
   Incr S
   If S > 60 Then
   S = 1
   Incr M
   End If
   If M > 60 Then
   M = 1
   Incr H
   End If
   If H > 24 Then
   H = 1
   Incr Day
   End If
   If Day > 30 Then
   Day = 1
   Incr Mon
   Locate 2 , 9
   Lcd Mon
   End If
   If Mon > 12 Then
   Mon = 1
   Incr Y
   End If
   N = 0
   Cls : Home : Lcd "Time:"
   Lcd "   " ; H ; ":" ; M ; ":" ; S
   Locate 2 , 1
   Lcd "Date:" ; " " ; Y ; "/" ; Mon ; "/" ; Day
End If
Return

+ نوشته شده توسط محمد رسول کُر در یکشنبه ششم بهمن 1387 و ساعت 14:11 |


Powered By
BLOGFA.COM