پاسخ : مشکل در TIMER 2 میکرو
قابل توجه اینکه اکثر بچه ها میگفتن برنامه شرطی باید داخل loop باشه ولی از loopکه بیرونش اوردم وگذاشتم داخلlable درست شده ولی دقیق نیست
برنامه اصلاح شده :
Config Timer0 = Timer , Prescale = 1024
Enable Interrupts
On Ovf0 Label
Enable Timer0
Start Timer0
Dim S As Byte , M As Byte , H As Byte , T As Byte
H = 23 : M = 59 : S = 10
Label:
Incr T
If T > 35 Then
Incr S
If S > 59 Then
S = 0 : Incr M
End If
If M > 59 Then
M = 0 : Incr H
End If
If H > 23 Then
H = 1
End If
T = 0
End If
Timer2 = 0
If H = 23 And M = 59 And S = 20 Then
Set Portb.4
Else
If H = 23 And M = 59 And S = 30 Then
Reset Portb.4
End If
End If
Return
نوشته اصلی توسط baby_1
برنامه اصلاح شده :
Config Timer0 = Timer , Prescale = 1024
Enable Interrupts
On Ovf0 Label
Enable Timer0
Start Timer0
Dim S As Byte , M As Byte , H As Byte , T As Byte
H = 23 : M = 59 : S = 10
Label:
Incr T
If T > 35 Then
Incr S
If S > 59 Then
S = 0 : Incr M
End If
If M > 59 Then
M = 0 : Incr H
End If
If H > 23 Then
H = 1
End If
T = 0
End If
Timer2 = 0
If H = 23 And M = 59 And S = 20 Then
Set Portb.4
Else
If H = 23 And M = 59 And S = 30 Then
Reset Portb.4
End If
End If
Return
دیدگاه