'Piornik02.bas

'Różnica pomiędzy 01: w czasie pisania tekstu pozostaje on cały czas w okienku wyświetlacza

'oraz buzer przepełnienia pamięci jest z własnym generatorem (buzer z Portd.7 do +).

'Program do wyświetlania ściągi.

'Pozwoli zapisać treść w postaci 94 znaków.

'Aby zapisać tekst, należy w Portc.3 ustawić 1 i nacisnąć RESET.

'Aby odczytać zapisany tekst, należy ustawić 0 w Portc.3, nacisnąć RESET

'oraz przycisk w Portc.4. Wyświetli się pierwsza paczka tekstu, czyli 32 znaki.

'Ponowne naciśnięcie przycisku w Portc.4 wyświetli następną paczkę tekstu.

'Opracował Henryk Wydmuch.

'Pamięć zajęta w 96%

'Fusebit ustawiony na generator wewnętrzny 4MHz (0011).

'Schemat: Piornik01.png.

 

$regfile = "m8def.dat"                                      'Dyrektyway dla kompilatora.

 $crystal = 4000000                                         'Zastosujemy generator wewnętrzny 4MHz.

 Config Lcd = 16 * 2                                        'Konfiguracja Lcd.

Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , Db6 = Portd.4 , Db7 = Portd.6 , E = Portd.1 , Rs = Portd.0

                                       'LCD dłączony do Portd. 2, 3, 4, 6, 1, 0.

 

Config Timer0 = Timer , Prescale = 1024                     'Konfiguruj Timer0, jako czasomierz, podział wstępny orzez 1024.

 

Config Pinc.3 = Input                                       'Przełącznik: zapis albo odczyt.

Set Portc.3                                                 'Podciągnij Port.

Config Pinc.4 = Input                                       'Przycisk przsuwania napisu na Lcd.

Set Portc.4                                                 'Podciągnij Port.

Config Pinc.5 = Output                                      'Lcd.

Set Portc.5                                                 'Podciągnij Port.

Config Pind.7 = Output                                      'Synał dźwiękowy (alarm przepełnienia pamięci).

Set Portd.7                                                 'Podciągnij Port.

 

Dim Kodklaw As Byte                                         'Jeden bajt dla Kodklaw (znaki ASCI klawiatury).

Dim Q As Byte                                               'Jeden bajt dla Q (kolejność naciskania klawisza).

Dim Suma As Byte                                            'Jeden bajt dla Suma (numer klawisza w ASCI).

Dim Przep As Byte                                           'Zmienna zawierająca ilość zajętych okienek Lcd.

Dim Policzlcd As Byte

 

Enable Interrupts                                           'Odblokuj przerwania.

Enable Timer0                                               'Odblokuj przerwania Timer0.

 

Config Keyboard = Pinc.0 , Data = Pinc.1 , Keydata = Keydata       'Konfiguruj klawiaturę.

On Timer0 Mig                                               'Włącz podprogram Mig Timera.

Cls                                                         'Czyść.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Do                                                          'Pierwsza pętla.

  If Pinc.3 = 1 Then                                        'Jeśli przełącznik w Pinc.3 = 1...

  Gosub Druga                                               'Skocz do podprogramu zapisującego Druga.

  Else                                                      'W przeciewnym razie (gdy Pinc.3 = 0)...

  Gosub Odczyt                                              'Skocz do podprogramu odczytującego.

  End If                                                    'Koniec warunku.

Loop                                                        'Powtarzaj pętlę.

End                                                         'Koniec tej pętli.

 

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Druga:                                                      'Podprogram drugiej pętli.

Do                                                          'Pętla.

  Kodklaw = Getatkbd()                                      '

  If Kodklaw > 0 And Kodklaw < 127 Then                     'Jeśli naciśnięto klawisz, a liczba ASCI jest od 0 do 127...

  Lcd Chr(kodklaw)

  Incr Q                                                    'Po naciśnięciu klawisza powiększ Q o jeden.

     Incr Policzlcd                                         'Po naciśnięciu klawisza powiększ Policzlcd o jeden.

     Select Case Policzlcd                                  'Sprawdzanie zawartości Policzlcd.                                     'Pokazuj znak klawisza.

     Case 16 : Locate 2 , 1                                 'Jeśli Policzlcd zawiera 16, ustaw kursor w drugiej linii, pozycja 1.

     Case 32 : Locate 1 , 1                                 '                                         '                                              '

     Cls

     Case 48 : Locate 2 , 1                                 '

     Case 64 : Locate 1 , 1                                 '                                              '

     Cls

     Case 80 : Locate 2 , 1                                 '

     End Select

                                            'Koniec przeglądu zmiennej.

  If Kodklaw = 1 Then                                       'Jeśli naciśnięto Esc...

  Gosub Kasuj                                               'Skocz do podprogramu kasującego.

  End If                                                    '

 

  If Kodklaw = 5 Then                                       'Jeśli naciśnięto F1...

  Q = 0                                                     'Zeruj Q.

  Gosub Odczyt                                              'Skocz do podprogramu odczytującego Eprom.

  End If                                                    '

 

  Gosub Zapis                                               'Skocz do podprogramu zapisującego naciśnięty klawisz w Eprom.

 

  If Kodklaw = 13 Then                                      'Jeśli naciśnięto Enter...

  Lowerline                                                 'Skocz do drugiej linii.

  End If                                                    '

 

  If Kodklaw = 127 Then                                     'Jeśli naciśnięto Delete...

  Cls                                                       'Czyść Lcd.

  End If                                                    '

 

End If                                                      'Koniec warunku "gdy naciśnięto klawisz".

Loop                                                        'Powtarzaj pętlę.

End                                                         'Koniec tej pętli.

Return                                                      'Wróć do pierwszej pętli.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Odczyt:                                                     'Podprogram odczytujący z Eprom.

Waitms 300                                                  'Czekaj 300 mS.

Bitwait Pinc.4 , Reset                                      'Reaguj, kiedy Pinc.4 = 0.

Cls                                                         'Czyść Lcd.

Locate 1 , 1                                                'Pisz w Lcd w pierwszej linii od początku.

  Readeeprom Suma , 1                                       'Odczytaj z Eprom, z pierwszej komórki zawartość Suma.

  Lcd Chr(suma)                                             'Pokaż na Lcd zawartość Suma i zamień ją na znak klawiatury.

  Readeeprom Suma , 2                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 3                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 4                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 5                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 6                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 7                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 8                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 9                                       '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 10                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 11                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 12                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 13                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 14                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 15                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 16                                      '

  Lcd Chr(suma)                                             '

Locate 2 , 1                                                '

  Readeeprom Suma , 17                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 18                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 19                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 20                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 21                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 22                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 23                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 24                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 25                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 26                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 27                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 28                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 29                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 30                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 31                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 32                                      '

  Lcd Chr(suma)                                             '

Waitms 300                                                  '

Bitwait Pinc.4 , Reset                                      '

Cls                                                         '

Locate 1 , 1                                                '

  Readeeprom Suma , 33                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 34                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 35                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 36                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 37                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 38                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 39                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 40                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 41                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 42                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 43                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 44                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 45                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 46                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 47                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 48                                      '

  Lcd Chr(suma)                                             '

Locate 2 , 1                                                '

  Readeeprom Suma , 49                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 50                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 51                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 52                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 53                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 54                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 55                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 56                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 57                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 58                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 59                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 60                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 61                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 62                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 63                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 64                                      '

  Lcd Chr(suma)                                             '

Waitms 300                                                  '

Bitwait Pinc.4 , Reset                                      '

Cls                                                         '

Locate 1 , 1                                                '

  Readeeprom Suma , 65                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 66                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 67                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 68                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 69                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 70                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 71                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 72                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 73                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 74                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 75                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 76                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 77                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 78                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 79                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 80                                      '

  Lcd Chr(suma)                                             '

Locate 2 , 1                                                '

  Readeeprom Suma , 81                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 82                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 83                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 84                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 85                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 86                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 87                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 88                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 89                                      '

  Lcd Chr(suma)                                             '

  Readeeprom Suma , 90                                      '

  Lcd Chr(suma)                                             '

Bitwait Pinc.4 , Reset                                      '

Return                                                      'Wróć do Druga.

 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Zapis:                                                      'Podprogram zapisywania do Eprom.

  If Q = 1 Then                                             'Jeśli w zmiennej Q jest 1 (pierwsze naciśnięcie klawisza)...

  Suma = Kodklaw                                            'Przenieś numer ASCI klawisza do zmiennej Suma.

  Writeeeprom Suma , 1                                      'Zapisz ten numer do Eprom, komórka 1.

  Suma = 0                                                  'Po zapisaniu wyzeruj Suma.

  End If                                                    'Koniec warunku "gdy naciśnięto pierwszy klawisz".

 

  If Q = 2 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 2                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 3 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 3                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 4 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 4                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 5 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 5                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 6 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 6                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 7 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 7                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 8 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 8                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 9 Then                                             '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 9                                      '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 10 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 10                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 11 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 11                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 12 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 12                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 13 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 13                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 14 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 14                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 15 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 15                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 16 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 16                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 17 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 17                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 18 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 18                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 19 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 19                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 20 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 20                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 21 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 21                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 22 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 22                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 23 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 23                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 24 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 24                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 25 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 25                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 26 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 26                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 27 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 27                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 28 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 28                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 29 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 29                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 30 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 30                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 31 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 31                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 32 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 32                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 33 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 33                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 34 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 34                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 35 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 35                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 36 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 36                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 37 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 37                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 38 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 38                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 39 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 39                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 40 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 40                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 41 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 41                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 42 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 42                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 43 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 43                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 44 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 44                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 45 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 45                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 46 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 46                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 47 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 47                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 48 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 48                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 49 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 49                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 50 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 50                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 51 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 51                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 52 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 52                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 53 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 53                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 54 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 54                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 55 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 55                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 56 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 56                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 57 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 57                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 58 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 58                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 59 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 59                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 60 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 60                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 61 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 61                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 62 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 62                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 63 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 63                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 64 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 64                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 65 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 65                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 66 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 66                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 67 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 67                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 68 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 68                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 69 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 69                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 70 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 70                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 71 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 71                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 72 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 72                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 73 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 73                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 74 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 74                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 75 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 75                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 76 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 76                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 77 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 77                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 78 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 78                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 79 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 79                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 80 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 80                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 81 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 81                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 82 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 82                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 83 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 83                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 84 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 84                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 85 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 85                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 86 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 86                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 87 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 87                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 88 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 88                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 89 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 89                                     '

  Suma = 0                                                  '

  End If                                                    '

 

  If Q = 90 Then                                            '

  Suma = Kodklaw                                            '

  Writeeeprom Suma , 90                                     '

  Suma = 0                                                  '

  Gosub Alarm                                               '

  End If                                                    '

 

Return                                                      'Wróć do Druga.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Kasuj:                                                      'Podprogram kasowania Eprom.

 Suma = 0                                                   'Zeruj zmienną Suma.

 Writeeeprom Suma , 1                                       'Wpisz wyzerowaną zmienną do Eprom, komórka 1.

 Writeeeprom Suma , 2                                       '

 Writeeeprom Suma , 3                                       '

 Writeeeprom Suma , 4                                       '

 Writeeeprom Suma , 5                                       '

 Writeeeprom Suma , 6                                       '

 Writeeeprom Suma , 7                                       '

 Writeeeprom Suma , 8                                       '

 Writeeeprom Suma , 9                                       '

 Writeeeprom Suma , 10                                      '

 Writeeeprom Suma , 11                                      '

 Writeeeprom Suma , 12                                      '

 Writeeeprom Suma , 13                                      '

 Writeeeprom Suma , 14                                      '

 Writeeeprom Suma , 15                                      '

 Writeeeprom Suma , 16                                      '

 Writeeeprom Suma , 17                                      '

 Writeeeprom Suma , 18                                      '

 Writeeeprom Suma , 19                                      '

 Writeeeprom Suma , 20                                      '

 Writeeeprom Suma , 21                                      '

 Writeeeprom Suma , 22                                      '

 Writeeeprom Suma , 23                                      '

 Writeeeprom Suma , 24                                      '

 Writeeeprom Suma , 25                                      '

 Writeeeprom Suma , 26                                      '

 Writeeeprom Suma , 27                                      '

 Writeeeprom Suma , 28                                      '

 Writeeeprom Suma , 29                                      '

 Writeeeprom Suma , 30                                      '

 Writeeeprom Suma , 31                                      '

 Writeeeprom Suma , 32                                      '

 Writeeeprom Suma , 33                                      '

 Writeeeprom Suma , 34                                      '

 Writeeeprom Suma , 35                                      '

 Writeeeprom Suma , 36                                      '

 Writeeeprom Suma , 37                                      '

 Writeeeprom Suma , 38                                      '

 Writeeeprom Suma , 39                                      '

 Writeeeprom Suma , 40                                      '

 Writeeeprom Suma , 41                                      '

 Writeeeprom Suma , 42                                      '

 Writeeeprom Suma , 43                                      '

 Writeeeprom Suma , 44                                      '

 Writeeeprom Suma , 45                                      '

 Writeeeprom Suma , 46                                      '

 Writeeeprom Suma , 47                                      '

 Writeeeprom Suma , 48                                      '

 Writeeeprom Suma , 49                                      '

 Writeeeprom Suma , 50                                      '

 Writeeeprom Suma , 51                                      '

 Writeeeprom Suma , 52                                      '

 Writeeeprom Suma , 53                                      '

 Writeeeprom Suma , 54                                      '

 Writeeeprom Suma , 55                                      '

 Writeeeprom Suma , 56                                      '

 Writeeeprom Suma , 57                                      '

 Writeeeprom Suma , 58                                      '

 Writeeeprom Suma , 59                                      '

 Writeeeprom Suma , 60                                      '

 Writeeeprom Suma , 61                                      '

 Writeeeprom Suma , 62                                      '

 Writeeeprom Suma , 63                                      '

 Writeeeprom Suma , 64                                      '

 Writeeeprom Suma , 65                                      '

 Writeeeprom Suma , 66                                      '

 Writeeeprom Suma , 67                                      '

 Writeeeprom Suma , 68                                      '

 Writeeeprom Suma , 69                                      '

 Writeeeprom Suma , 70                                      '

 Writeeeprom Suma , 71                                      '

 Writeeeprom Suma , 72                                      '

 Writeeeprom Suma , 73                                      '

 Writeeeprom Suma , 74                                      '

 Writeeeprom Suma , 75                                      '

 Writeeeprom Suma , 76                                      '

 Writeeeprom Suma , 77                                      '

 Writeeeprom Suma , 78                                      '

 Writeeeprom Suma , 79                                      '

 Writeeeprom Suma , 80                                      '

 Writeeeprom Suma , 81                                      '

 Writeeeprom Suma , 82                                      '

 Writeeeprom Suma , 83                                      '

 Writeeeprom Suma , 84                                      '

 Writeeeprom Suma , 85                                      '

 Writeeeprom Suma , 86                                      '

 Writeeeprom Suma , 87                                      '

 Writeeeprom Suma , 88                                      '

 Writeeeprom Suma , 89                                      '

 Writeeeprom Suma , 90                                      '

Return                                                      'Wróć do pętli Druga.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Z tej pętli wychodzimy przy pomocy RESET.

Alarm:                                                      'Po zapełnieniu pamięci alarm dźwiękowy.

Do                                                          'Pętla.

  Sound Portd.7 , 400 , 500                                 'Sygnał Dźwiękowy.

  Waitms 150                                                'Krótka przerwa.

  Sound Portd.7 , 400 , 400                                 'Sygnał Dźwiękowy.

  Waitms 300                                                '

  'Portd.7 = 0

  'Waitms 450

  'Portd.7 = 1

  'Waitms 900

  Cls                                                       'Czyść.

  Lcd "Memory MAX!"                                         'Komunikat o przepełnieniu pamięci.

  Lowerline                                                 '

  Lcd "RESET"                                               '

  Loop                                                      'Powtarzaj pętlę.

End                                                         'Koniec tej pętli.

Return                                                      'Wróć do Zapis.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Mig:                                                        'Podprogram Timer0 (miganie diody).

 Incr Przep                                                 'Po załadowaniu Timer0, zwiększaj zmienną Przep o 1.

 If Przep = 25 Then                                         'Jeśli uzbiera się 25 przepełnień...

 Przep = 0                                                  'Zeruj zmienną.

  Portc.5 = 0                                               'Zmień poziom w Prtc.5 (zaświeć diodę).

  Waitms 100                                                'Trzymaj świecenie przez 100mS.

  Portc.5 = 1                                               'Wyłącz diodę.

 End If                                                     '

Return                                                      'Wróć do Timer0.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 'Tablica numerów przycisków klawiatury AT w kodzie ASCI:

   Keydata:                                                 'Podprogram tablicy.

     'Małe litery

   Data 0 , 5 , 0 , 3 , 4 , 5 , 6 , &H07 , 5 , 5 , 5 , &H0B , &H0C , 0,       ''''''''''''A

   Data 63 , 63 , 63 , 63 , 63 , 63 , 63 , 113 , 49 , 63 , 63 , 63 , 122,       ''''''''''B

   Data 115 , 97 , 119 , 50 , 63 , 63 , 99 , 120 , 100 , 101 , 52 ,       ''''''''''''''''C

   Data 51 , 63 , 63 , 32 , 118 , 102 , 116 , 114 , 53 , 63 , 63 , 110 ,       '''''''''''D

   Data 98 , 104 , 103 , 121 , 54 , 63 , 63 , 63 , 109 , 106 , 117 , 55 ,       ''''''''''E

   Data 56 , 63 , 63 , 44 , 107 , 105 , 111 , 48 , 57 , 63 , 63 , 46 , 47 ,       ''''''''F

   Data 108 , 59 , 112 , 95 , 63 , 63 , 63 , 63 , 63 , 63 , 61 , 63 , 63 , 63 ,       ''''G

   Data 63 , 13 , 63 , 63 , 124 , 63 , 63 , 63 , 63 , 63 , 63 , 63 , 63 , 63 , 63,       'H

   Data 63 , 49 , 63 , 52 , 55 , 63 , 63 , 63 , 48 , 127 , 50 , 53 , 54 , 56,       ''''''I

   Data 1 , 63 , 5 , 43 , 51 , 45 , 42 , 57 , 63 , 63       ''''''''''''''''''''''''''''''J

 

    'Duże litery

  Data 0 , 0 , 0 , 5 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,       ''''''''''K

  Data 0 , 0 , 0 , 0 , 0 , 0 , 81 , 33 , 03 , 0 , 0 , 90 , 83 , 65,       ''''''''L

  Data 87 , 64 , 0 , 0 , 67 , 88 , 68 , 69 , 36 , 35 , 0 , 0 , 0 , 86,       '''''M

  Data 70 , 84 , 82 , 37 , 0 , 0 , 78 , 66 , 72 , 71 , 89 , 94 , 0,       ''''''''N

  Data 0 , 0 , 77 , 74 , 85 , 38 , 42 , 0 , 0 , 60 , 75 , 73 , 79,       '''''''''O

  Data 41 , 40 , 0 , 0 , 62 , 63 , 76 , 58 , 80 , 0 , 0 , 0 , 0 , 0,       '''''''P

  Data 0 , 123 , 43 , 0 , 0 , 0 , 0 , 0 , 125 , 0 , 0 , 0 , 0 , 0 , 0,       '''''Q

  Data 0 , 0 , 0 , 0 , 0 , 0 , 49 , 49 , 0 , 52 , 55 , 0 , 0 , 0 , 48,       '''''R

  Data 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0       'S