logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

[tiny2313][Bascom] Zegar widmowy.

skalsky5000 25 Mar 2009 17:02 2307 6
REKLAMA
  • #1 6331157
    skalsky5000
    Poziom 21  
    Nie chce zakładać owego tematu wiec napisze w starym.Napisałem taki soft do zegarka miałem pod ręka tylko polski help do bascoma i soft do innego zegarka tylko na AT89C405. Proszę o pomoc i wyrozumiałość ponieważ bascoma znam bardzo krotko. Nie wyświetla tego co powinien na początku widać cyfry odlicza sekundy potem się coś rypie i już nic nie wyświetla.Z góry dziekuje.:
     
    $regfile "Attiny2313.dat"
    $crystal = 1000000
    Config Portb = &B11111111
    Portb = &B00000000
    Config Portd = &B0000000
    Portd = &B1111111
    Dim Sek_jedn As Byte , Sek_dzies As Byte , Min_jedn As Byte,
    Dim Min_dzies As Byte , Godz_jedn As Byte , Godz_dzies As Byte
    Dim A As Byte , B As Byte
    Dim Licznik As Integer
    B = 0
    Sek_jedn = 0
    Sek_dzies = 0
    Min_jedn = 0
    Min_dzies = 0
    Godz_jedn = 0
    Godz_dzies = 0
    A = 1.5
    Config Timer0 = Timer , Prescale = 64
    
    On Timer0 Przerwanie_co_2ms
    Enable Interrupts
    Enable Timer0
    Timer0 = 6
    Licznik = 0
    Start Timer0
    Do
    Do
    Loop Until Pind.6 = 1
    
    
    If Sek_jedn = 10 Then
    Sek_jedn = 0
    Incr Sek_dzies
    End If
    
    If Sek_dzies = 6 Then
    Sek_dzies = 0
    Incr Min_jedn
    End If
    
    If Min_jedn = 10 Then
    Min_jedn = 0
    Incr Min_dzies
    End If
    
    If Min_dzies = 6 Then
    Min_dzies = 0
    Incr Godz_jedn
    
    End If
    
    If Godz_jedn = 10 Then
    Godz_jedn = 0
    Incr Godz_dzies
    End If
    
    If Godz_dzies = 2 Then
    Godz_dzies = 0
    Godz_jedn = 0
    End If
    
    '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    If Sek_jedn = 0 Then
          Gosub Zero
    End If
    
    If Sek_jedn = 1 Then
          Gosub Jeden
    End If
    
    If Sek_jedn = 2 Then
          Gosub Dwa
    End If
    
    If Sek_jedn = 3 Then
          Gosub Trzy
    End If
    
    If Sek_jedn = 4 Then
          Gosub Cztery
    End If
    
    If Sek_jedn = 5 Then
          Gosub Piec
    End If
    
    If Sek_jedn = 6 Then
          Gosub Szesc
    End If
    
    If Sek_jedn = 7 Then
          Gosub Siedem
       End If
    
    If Sek_jedn = 8 Then
          Gosub Osiem
       End If
    
    If Sek_jedn = 9 Then
          Gosub Dziewiec
       End If
    '############################
    If sek_dzies = 0 Then
          Gosub Zero
       End If
    
    If Sek_dzies = 1 Then
          Gosub Jeden
       End If
    
    If Sek_dzies = 2 Then
          Gosub Dwa
       End If
    
    If Sek_dzies = 3 Then
          Gosub Trzy
       End If
    
    If Sek_dzies = 4 Then
          Gosub Cztery
       End If
    
    If Sek_dzies = 5 Then
          Gosub Piec
       End If
    
    If Sek_dzies = 6 Then
          Gosub Szesc
       End If
    
    If Sek_dzies = 7 Then
          Gosub Siedem
       End If
    
    If Sek_dzies = 8 Then
          Gosub Osiem
       End If
    
    If Sek_dzies = 9 Then
          Gosub Dziewiec
       End If
    '***********************************
    If Min_jedn = 0 Then
          Gosub Zero
    End If
    
    If Min_jedn = 1 Then
          Gosub Jeden
    End If
    
    If Min_jedn = 2 Then
          Gosub Dwa
    End If
    
    If Min_jedn = 3 Then
          Gosub Trzy
    End If
    
    If Min_jedn = 4 Then
          Gosub Cztery
    End If
    
    If Min_jedn = 5 Then
          Gosub Piec
    End If
    
    If Min_jedn = 6 Then
          Gosub Szesc
    End If
    
    If Min_jedn = 7 Then
          Gosub Siedem
       End If
    
    If Min_jedn = 8 Then
          Gosub Osiem
       End If
    
    If Min_jedn = 9 Then
          Gosub Dziewiec
       End If
    '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    If Min_dzies = 0 Then
          Gosub Zero
       End If
    
    If Min_dzies = 1 Then
          Gosub Jeden
       End If
    
    If Min_dzies = 2 Then
          Gosub Dwa
       End If
    
    If Min_dzies = 3 Then
          Gosub Trzy
       End If
    
    If Min_dzies = 4 Then
          Gosub Cztery
       End If
    
    If Min_dzies = 5 Then
          Gosub Piec
       End If
    
    If Min_dzies = 6 Then
          Gosub Szesc
       End If
    
    If Min_dzies = 7 Then
          Gosub Siedem
       End If
    
    If Min_dzies = 8 Then
          Gosub Osiem
       End If
    
    If Min_dzies = 9 Then
          Gosub Dziewiec
       End If
    
    '&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    If godz_jedn = 0 Then
          Gosub Zero
    End If
    
    If Godz_jedn = 1 Then
          Gosub Jeden
    End If
    
    If Godz_jedn = 2 Then
          Gosub Dwa
    End If
    
    If Godz_jedn = 3 Then
          Gosub Trzy
    End If
    
    If Godz_jedn = 4 Then
          Gosub Cztery
    End If
    
    If Godz_jedn = 5 Then
          Gosub Piec
    End If
    
    If Godz_jedn = 6 Then
          Gosub Szesc
    End If
    
    If Godz_jedn = 7 Then
          Gosub Siedem
       End If
    
    If Godz_jedn = 8 Then
          Gosub Osiem
       End If
    
    If Godz_jedn = 9 Then
          Gosub Dziewiec
       End If
    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    If Godz_dzies = 1 Then
          Gosub Jeden
       End If
    
    If Godz_dzies = 2 Then
          Gosub Jeden
       End If
    Loop
    End
    
    Przerwanie_co_2ms:
    Counter0 = Counter0 + 6
    
    
    Incr Licznik
    If Licznik = 500 Then
    
    Licznik = 0                                                 'wyzeruj zmienną licznik
    Incr Sek_jedn
    End If
    Return
    
    Odstep:
    Delay : Delay : Delay : Delay : Delay : Delay : Delay : Delay : Delay : Delay
    
    Zero:
    Portb = 255
    Waitms A
    Portb = 129
    Waitms A
    Portb = 129
    Waitms A
    Portb = 255
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    
    
    
    Jeden:
    Portb = 4
    Waitms A
    Portb = 2
    Waitms A
    Portb = 255
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Dwa:
    Portb = 249
    Waitms A
    Portb = 137
    Waitms A
    Portb = 137
    Waitms A
    Portb = 143
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Trzy:
    Portb = 129
    Waitms A
    Portb = 137
    Waitms A
    Portb = 137
    Waitms A
    Portb = 255
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Cztery:
    Portb = 15
    Waitms A
    Portb = 8
    Waitms A
    Portb = 252
    Waitms A
    Portb = 8
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Piec:
    Portb = 143
    Waitms A
    Portb = 137
    Waitms A
    Portb = 137
    Waitms A
    Portb = 249
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Szesc:
    Portb = 255
    Waitms A
    Portb = 145
    Waitms A
    Portb = 145
    Waitms A
    Portb = 241
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Siedem:
    Portb = 1
    Waitms A
    Portb = 241
    Waitms A
    Portb = 9
    Waitms A
    Portb = 7
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Osiem:
    Portb = 255
    Waitms A
    Portb = 137
    Waitms A
    Portb = 137
    Waitms A
    Portb = 255
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep
    
    Dziewiec:
    Portb = 143
    Waitms A
    Portb = 137
    Waitms A
    Portb = 137
    Waitms A
    Portb = 255
    Waitms A
    Portb = 0
    Waitms A
    Gosub Odstep



    Poprawiłem tytuł - Regulamin. [c_p]
  • REKLAMA
  • #2 6336063
    M. S.
    Poziom 34  
    Brak RETURN'ów w podprogramach (na końcu) wywoływanych przez GOSUB. Procek skacze i nie zdejmuje danych ze stosu. Po przepełnieniu stosu idzie w maliny.
  • REKLAMA
  • #3 6337295
    skalsky5000
    Poziom 21  
    Kiedy dodałem return wszystko całkiem się popsuło. Czy ma ktoś soft do zegara widmowego na attiny2313 ? albo ktoś by pomógł napisać ?.
  • REKLAMA
  • #4 6337951
    Konto nie istnieje
    Konto nie istnieje  
  • REKLAMA
  • #5 6339098
    skalsky5000
    Poziom 21  
    A mógłbyś mi podpowiedzieć jak to zrobić na tablicach ?
  • #6 6339891
    wader_669
    Poziom 28  
    do tego masz helpa, ksiazki i rozne kursy.
  • Pomocny post
    #7 6339918
    LED5W
    Poziom 34  
    Za końcem programu:
    Nazwatablicy:
    data 'wartości kolejnych kolumn oddzielone przecinkami

    Odczytujesz poleceniem lookup. Np.:
    For X = 0 To 4   cyfra z 5 kolumn
    Portb = Lookup(x , Cyfra)
    Waitms Czaskol
    Next
    Portb = 0    'kolumna odstępu
    Waitms Czaskol

    Zauważ, że tu zmienna "cyfra" decyduje z ktorej tablicy odczytamy dane. ;)
REKLAMA