Witam, napisałem program minutnik w BASCOMIE na mikroukłady. Mam taki problem, że mogę ustawić minutnik ale jak już wszytko ustawię i uruchomię odliczanie to czas w ogóle nie jest zmniejszany. Problem z procedurą zmniejszającą (nie sądzę, bo używałem jej w minutniku bez timera) czy może jej wywołaniem, a może coś innego. Program testowany w symulatorze, nie sugeruje się wyświetlaczem tylko samym monitorem zmiennych. Z góry dziękuje z pomoc, pozdrawiam.
$regfile = "m128def.dat"
$crystal = 16000000
$sim
Dim M As Byte
Dim S As Byte
Dim Key As Byte
Declare Sub Set_time
Declare Sub Display_time
Config Timer1 = Timer , Prescale = 256
On Timer1 On_sec
Config Kbd = Portc
Ddrb = &B0011111
Portb = &B1101111
Key_start Alias Pinb.6
Key_set Alias Pinb.7
Gong Alias Portb.5
Enable Interrupts
Cls
Do
Key = Getkbd()
If Key = 3 Then Call Set_time
If Key = 7 Then
'If Key_set = 0 Then Call Set_time
'If Key_start = 0 Then
Load Timer1 , 62500
Enable Timer1
End If
Loop
End 'end program
Sub Set_time
Incr S
If S >= 59 Then
M = 1
S = 0
If M >= 30 Then M = 0
Call Display_time
Waitms 400
End If
End Sub
Sub Display_time
Locate 1 , 1
If M < 10 Then : Lcd "0" : End If : Lcd M ; ":"
If S < 10 Then : Lcd "0" : End If : Lcd S ;
End Sub
On_sec:
Do
Disable Timer1
If S = 0 Then
If M = 0 Then
Exit Do
Else
S = 59
Decr M
End If
End If
Decr S
Enable Timer1
Loop
Return