دوستان من این برنامه رو نوشتم ولی متاسفانه تایمر دقیق نیست مشکلش کجاست 
	
		
							
						
					
			
			
				$regfile = "m8def.dat"
$crystal = 1000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Rs = Portd.1 , E = Portd.2 , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7
''''''''&# 039;''''''' 9;'''''
Dim H As Byte , M As Byte , S As Byte
''''''''&# 039;''''''' 9;'''''
Config Portd = Output
''''''''&# 039;''''''' 9;''''''
Enable Interrupts
Config Timer1 = Timer , Prescale = 1024 , Clear Timer = 1
Enable Timer1
Start Timer1
Enable Ovf1
Timer1 = 64535
On Ovf1 Main
''''''''&# 039;''''''' 9;'''''
M = 0 : H = 0 : S = 0
''''''''&# 039;''''''' 9;'''''
Initlcd
Cursor Off
Do
Loop
End
''''''''&# 039;''''''' 9;''''
Main:
Incr S
If S = 60 Then
S = 0
Incr M
If M = 60 Then
M = 0
Incr H
If H = 24 Then
H = 0
Goto Main
End If
End If
End If
Home
If S = 5 Then Locate 1 , 14 : Lcd ""
If M < 10 Then : Locate 1 , 15 : Lcd "0" ; M ; ":"
Elseif M < 60 Then : Locate 1 , 15 : Lcd M ; ":"
Else : M = 0 : Locate 1 , 15 : Lcd "00" ; ":"
End If
If H < 10 Then : Locate 1 , 12 : Lcd "0" ; H ; ":"
Elseif H < 24 Then : Locate 1 , 12 : Lcd H ; ":"
Else : H = 0 : Locate 1 , 12 : Lcd "00" ; ":"
End If
If Pinb.3 = 1 Then
Incr M
If Pinb.4 = 1 Then
Incr H
End If
End If
Timer1 = 64535
''''''''&# 039;''''''' 9;'''''''' '''''
Return
''''''''&# 039;'''''
	$crystal = 1000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Rs = Portd.1 , E = Portd.2 , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7
''''''''&# 039;''''''' 9;'''''
Dim H As Byte , M As Byte , S As Byte
''''''''&# 039;''''''' 9;'''''
Config Portd = Output
''''''''&# 039;''''''' 9;''''''
Enable Interrupts
Config Timer1 = Timer , Prescale = 1024 , Clear Timer = 1
Enable Timer1
Start Timer1
Enable Ovf1
Timer1 = 64535
On Ovf1 Main
''''''''&# 039;''''''' 9;'''''
M = 0 : H = 0 : S = 0
''''''''&# 039;''''''' 9;'''''
Initlcd
Cursor Off
Do
Loop
End
''''''''&# 039;''''''' 9;''''
Main:
Incr S
If S = 60 Then
S = 0
Incr M
If M = 60 Then
M = 0
Incr H
If H = 24 Then
H = 0
Goto Main
End If
End If
End If
Home
If S = 5 Then Locate 1 , 14 : Lcd ""
If M < 10 Then : Locate 1 , 15 : Lcd "0" ; M ; ":"
Elseif M < 60 Then : Locate 1 , 15 : Lcd M ; ":"
Else : M = 0 : Locate 1 , 15 : Lcd "00" ; ":"
End If
If H < 10 Then : Locate 1 , 12 : Lcd "0" ; H ; ":"
Elseif H < 24 Then : Locate 1 , 12 : Lcd H ; ":"
Else : H = 0 : Locate 1 , 12 : Lcd "00" ; ":"
End If
If Pinb.3 = 1 Then
Incr M
If Pinb.4 = 1 Then
Incr H
End If
End If
Timer1 = 64535
''''''''&# 039;''''''' 9;'''''''' '''''
Return
''''''''&# 039;'''''













دیدگاه