Witam, byłby ktoś w stanie wrzucić tutaj gotowy listing programu pod Bascoma? Dokładnie pod ten schemat jaki przedstawił joboo...
Pozdrawiam.
PS: Da mi ktoś punkcik?
Pozdrawiam.
PS: Da mi ktoś punkcik?

Do you prefer the English version of the page elektroda?
No, thank you Send me over thereQuote:Jak ustawić w bascom atmege żeby działał z generatorem 16mhz ?
'zegar binarny joboo
$regfile = "m8def.DAT"
$crystal = 16000000
Dim Sekjed As Byte , Sekdzies As Byte , Minjed As Byte , Mindzies As Byte , Maxi As Byte
Dim Godzjed As Byte , Godzdzies As Byte , Wyswietl As Byte , Migaj As Bit , Uniwersalny As Byte
Config Portd = 255
Portd = &B255
Config Portc = &B0000000
Portc = &B0000000
Config Portb.2 = Output
Config Portb.3 = Output
Config Portb.4 = Output
Config Timer0 = Timer , Prescale = 64
Config Timer1 = Timer , Prescale = 256
Enable Interrupts
Enable Timer0
Enable Timer1
On Timer0 Co4ms
On Timer1 Co1s
Sekjed = 9 : Sekdzies = 5 : Minjed = 9 : Mindzies = 5 : Godzjed = 3 : Godzdzies = 2
Uniwersalny = 6 : Maxi = 100
Do
Loop
End
Co1s: ' przerwanie co 1 sek
Timer1 = 3036
Incr Sekjed
Toggle Migaj
Return
Co4ms: 'przerwanie co 4 mili sek
Decr Uniwersalny 'obsluga wyswietlaczy i przyciskow
If Pinb.3 = 0 And Pinb.2 = 1 Then 'przycisk s1 nacisniety
If Uniwersalny = 0 Then
Uniwersalny = Maxi : Incr Minjed : Sekjed = 0 : Sekdzies = 0
Maxi = Maxi - 8
If Maxi < 8 Then Maxi = 8 'coraz szybciej
End If
End If
If Pinb.2 = 0 And Pinb.3 = 1 Then 'przycisk s2nacisniety
If Uniwersalny = 0 Then
Uniwersalny = Maxi : Incr Godzjed
Maxi = Maxi - 8 'coraz szybciej
If Maxi < 12 Then Maxi = 12
End If
Else 'oba nacisniete lub zwolnione
If Uniwersalny = 0 Then
Uniwersalny = 6
Maxi = 100
End If
End If
'co 4ms korygujemy stany licznikow
If Sekjed = 10 Then
Sekjed = 0
Incr Sekdzies
End If
If Sekdzies = 6 Then
Sekdzies = 0
Incr Minjed
End If
If Minjed = 10 Then
Minjed = 0
Incr Mindzies
End If
If Mindzies = 6 Then
Mindzies = 0
Incr Godzjed
End If
If Godzjed = 10 Then
Godzjed = 0
Incr Godzdzies
End If
' co 4ms sprawdzamy czy nie jest polnoc jesli tak skracamy cykl
If Godzdzies = 2 And Godzjed = 4 Then
Godzdzies = 0
Godzjed = 0
End If
'wyswietlamy
Wyswietl = Uniwersalny And &B111
Portc = &B0000000
Select Case Wyswietl ' obsluga wyswietlacza
Case 1: ' wyswietl zawart. licznika jedn min
Portd = Lookup(sekjed , Tabela )
Portc.0 = 1
Case 2: ' zawart licz. dzies min
Portd = Lookup(sekdzies , Tabela)
Portc.1 = 1
Case 3: ' jedn godz
Portd = Lookup(minjed , Tabela)
Portc.2 = 1
'Portb.4 = Migaj
Case 4: ' dzies godz
Portd = Lookup(mindzies , Tabela)
Portc.3 = 1
Case 5:
Portd = Lookup(godzjed , Tabela)
Portc.4 = 1
Case 6:
Portd = Lookup(godzdzies , Tabela)
Portc.5 = 1
End Select
Return
Tabela:
'Data 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 'w negatywie
Data 255 , 254 , 253 , 252 , 251 , 250 , 249 , 248 , 247 , 246 ' w pozytywie
Quote:Tabela:
'Data 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 'w negatywie
Data 255 , 254 , 253 , 252 , 251 , 250 , 249 , 248 , 247 , 246 ' w pozytywie
Quote:Do czego jest ta komenda?
Quote:Nie prościej kupić rezonator za złotówke? Albo skorzystać z wbudowanego? Atmega8 chyba nie potrzebuje taktowania zewnętrznym stuffem... ...chyba
Config Portd = 255
Portd = &B255
Config Portc = &B0000000
Portc = &B0000000
Config Portb.2 = Output
Config Portb.3 = Output
Config Portb.4 = Output
Config Portc = Output
Config Portd = Output
'S1 - godziny
'S2 - minuty
$regfile = "m8def.DAT"
$crystal = 4000000
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 , Uniwers As Byte
Config Portd = 255 : Portd = &B255 : Config Portc = &B11111111 : Portc = &B11111111
Config Portb.2 = Input
Portb.2 = 1
Config Portb.3 = Input
Portb.3 = 1
Config Timer0 = Timer , Prescale = 64
Config Timer1 = Timer , Prescale = 64
Enable Interrupts : Enable Timer0 : Enable Timer1
On Timer0 Co4ms : On Timer1 Co1s
Sekjed = 5 : Sekdzies = 5 : Minjed = 1 : Mindzies = 0 : Godzjed = 1 : Godzdzies = 1
Uniwers = 6
Maxi = 100
Do
Loop
End
Co1s:
Timer1 = 3036
Incr Sekjed
Return
Co4ms:
Decr Uniwers
If Pinb.3 = 0 And Pinb.2 = 1 Then
If Uniwers = 0 Then
Uniwers = Maxi : Incr Minjed : Sekjed = 0 : Sekdzies = 0
Maxi = Maxi - 8 : If Maxi < 8 Then Maxi = 8
End If : End If
If Pinb.2 = 0 And Pinb.3 = 1 Then
If Uniwers = 0 Then
Uniwers = Maxi : Incr Godzjed
Maxi = Maxi - 8 : If Maxi < 12 Then Maxi = 12
End If : Else
If Uniwers = 0 Then
Uniwers = 6 : Maxi = 100
End If : End If
If Sekjed = 10 Then
Sekjed = 0 : Incr Sekdzies
End If
If Sekdzies = 6 Then
Sekdzies = 0 : Incr Minjed
End If
If Minjed = 10 Then
Minjed = 0 : Incr Mindzies
End If
If Mindzies = 6 Then
Mindzies = 0 : Incr Godzjed
End If
If Godzjed = 10 Then
Godzjed = 0 : Incr Godzdzies
End If
If Godzdzies = 2 And Godzjed = 4 Then
Godzdzies = 0 : Godzjed = 0
End If
Mux = Uniwers And &B111 : Portc = &B111111
Select Case Mux
Case 1:
Portd = Lookup(sekjed , Tabela) : Portc.0 = 0
Case 2:
Portd = Lookup(sekdzies , Tabela) : Portc.1 = 0
Case 3:
Portd = Lookup(minjed , Tabela) : Portc.2 = 0
Case 4:
Portd = Lookup(mindzies , Tabela) : Portc.3 = 0
Case 5:
Portd = Lookup(godzjed , Tabela) : Portc.4 = 0
Case 6:
Portd = Lookup(godzdzies , Tabela) : Portc.5 = 0
End Select : Return
Tabela:
Data 255 , 254 , 253 , 252 , 251 , 250 , 249 , 248 , 247 , 246 'pozytyw
'Data 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 'negatyw
$regfile = "m8def.DAT"