Witam od jakiegoś czasu próbuję w Bascom napisać zegarek (lub coś co precyzyjnie odmierza czas), ale niestety nie wychodzi mi to, mógłby mi ktoś pomoc udzielić wskazówki bo już sie powoli gubię
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamxŁolesxxx napisał:Probowałem timer0 i timer1 ale obliczenia się nie zgadzają z rzeczywistością
Dim Sekjed As Byte
Config Portb = 255 : Portb = &B255 : Config Portd = &B1111100 : Portd = &B1111111
Config Timer0 = Timer , Prescale = 64 : Config Timer1 = Timer , Prescale = 64
Enable Interrupts : Enable Timer0 : Enable Timer1
On Timer0 Co4ms : On Timer1 Co1s
Sekjed = 0
Do : Loop : End
Co1s:
Timer1 = 3036
Cls
Lcd Sekjed
Incr Sekjed
Return
Co4ms:
Return
Cytat:
Jak ustawić zliczanie z zewnętrznego kwarcu który ma 4Mhz?
Dim Sekjed As Byte , Sekdzies As Byte , Minjed As Byte , Mindzies As Byte , Maxi As Byte
Dim , Godzjed As Byte , Godzdzies As Byte , Mux As Byte , Migaj As Bit , Uniwers As Byte
Config Portb = 255 : Portb = &B255 : Config Portd = &B1111100 : Portd = &B1111111
Config Timer1 = Timer , Prescale = 64
Enable Interrupts : Enable Timer1
On Timer1 Co1s
Sekjed = 0 : Sekdzies = 0 : Minjed = 6 : Mindzies = 5 : Godzjed = 4 : Godzdzies = 1
Uniwers = 0 : Maxi = 100
Do
'Lowerline
' Lcd
Loop : End
Co1s:
Timer1 = 3036
Incr Sekjed : Toggle Migaj
If Sekjed = 10 Then
Sekjed = 0
Incr Sekdzies
If Sekdzies = 6 Then
Sekdzies = 0
Incr Minjed
If Minjed = 10 Then
Minjed = 0
Incr Mindzies
If Mindzies = 6 Then
Mindzies = 0
Incr Godzjed
If Godzjed = 10 Then
Godzjed = 0
Incr Godzdzies
End If : End If : End If : End If : End If
If Godzdzies = 2 And Godzjed = 4 Then
Godzdzies = 0 : Godzjed = 0
End If
Cursor On Off
Cls
Lcd Godzdzies
Lcd Godzjed
Lcd ":"
Lcd Mindzies
Lcd Minjed
Lcd ":"
Lcd Sekdzies
Lcd Sekjed
Return