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

Kod do obsługi LCD PCF8833 w Bascomie - brak reakcji wyświetlacza

pmmisiek 07 Cze 2007 09:23 7584 3
REKLAMA
  • #1 3961295
    pmmisiek
    Poziom 15  
    Posty: 234
    Pomógł: 7
    Ocena: 4
    Wiatm.
    Czy widział ktoś gdzieś kod do obsługi LCD PCF8833 w bascomie, mam taki wyświetlacz i bascoma z bibliotekami do jego obsługi, niestety coś w tej bibliotece (lcd-pcf8833.lbx) jest chyba nie tak bo wyświetlacz nie reaguje.

    Na elektrodzie znalazłem kawałek kodu który wyświetla kolorowe paski i ten kod działa. Teraz pytanie czy komukolwiek działa PCF8833 z zaimplementowaną w bacomie jego obsługą?

    Czy jest gdzieś przykładowy kod do bascoma podobny do tego słynnego EGIPTDEMO na lcd z nokii 3310?


    ps. oto inicjalizacja lcd znaleziona ne elektrodzie która działa:
    
    'Controller PCF8833
    
    'Display Pin 1 VDIGITAL          3 Volt
    '            2 Reset => AVR Pin  C2
    '            3 SDATA             C4
    '            4 SCLK              C5
    '            5 CS                C3
    '            6 VDISPLAY          3 Volt
    '            7 NC
    '            8 GND
    
    
    Ddrc = &B11111111                                           'Port C als Output
    Dim A As Byte , B As Byte , R As Integer , S As Byte
    
    Portc.3 = 0
    Portc.4 = 0
    Portc.5 = 0
    
    Waitms 5
    Portc.3 = 1
    Waitms 5
    
    'Initialisierung Reset
    Portc.2 = 1
    Waitms 10
    Portc.2 = 0
    Waitms 20
    Portc.2 = 1
    Waitms 10
    
    Portc.3 = 1
    Portc.4 = 1
    Portc.5 = 1
    
    Waitms 5
    
    'Software Reset
    A = &H01
    Gosub Command
    Gosub Cs
    
    
    'Sleep Out
    A = &H11
    Gosub Command
    Gosub Cs
    
    
    
    'Booster ON
    A = &H03
    Gosub Command
    Gosub Cs
    
    'Booster Voltage muss stabil sein, sonst geht Display nicht an
    Waitms 50
    
    'Display On
    A = &H29
    Gosub Command
    Gosub Cs
    
    Wait 3
    
    'Normal display mode
    A = &H23
    Gosub Command
    Gosub Cs
    
    'Display inversion off
    A = &H20
    Gosub Command
    Gosub Cs
    
    'Data order
    A = &HBA
    Gosub Command
    Gosub Cs
    
    'Memory data access control
    A = &H36
    Gosub Command
    A = 8                                                       'bgr
    Gosub Parameter
    Gosub Cs
    
    
    'Set interface colour pixel format
    'A = &H3A
    'Gosub Command
    'A = 2     '8 bit
    'Gosub Parameter
    'Gosub Cs
    
    'x
    A = &H2A
    Gosub Command
    A = 7
    Gosub Parameter
    A = 118
    Gosub Parameter
    Gosub Cs
    
    'y
    A = &H2B
    Gosub Command
    A = 4
    Gosub Parameter
    A = 122
    Gosub Parameter
    Gosub Cs
    
    
    ' Bascom Demo-Version ist speicherlimitiert, daher einige Schleifen löschen
    
    'Write pixel
    A = &H2C
    Gosub Command
    
    S = 0
    'roter Balken
    For R = 1 To 1998
     If S = 0 Then A = 15
     If S = 1 Then A = 240
     If S = 2 Then A = 255
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
    Next R
    
    
    S = 0
    'grüner Balken
    For R = 1 To 1998
     If S = 0 Then A = 240
     If S = 1 Then A = 255
     If S = 2 Then A = 15
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
    Next R
    
     S = 0
    'blauer Balken
    For R = 1 To 1998
     If S = 0 Then A = 255
     If S = 1 Then A = 15
     If S = 2 Then A = 240
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
     Next R
    
    
    S = 0
    'gelber Balken
    For R = 1 To 1998
     If S = 0 Then A = 0
     If S = 1 Then A = 240
     If S = 2 Then A = 15
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
    Next R
    
    
    S = 0
    'magenta Balken
    For R = 1 To 1998
     If S = 0 Then A = 15
     If S = 1 Then A = 0
     If S = 2 Then A = 240
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
    Next R
    
     S = 0
    'cyan Balken
    For R = 1 To 1998
     If S = 0 Then A = 240
     If S = 1 Then A = 15
     If S = 2 Then A = 0
     Gosub Parameter
     S = S + 1
     If S = 3 Then S = 0
     Next R
    
    'weißer Balken
    A = 0
    For R = 1 To 1998
    Gosub Parameter
    Next R
    
    'schwarzer Balken
    A = 255
    For R = 1 To 1998
    Gosub Parameter
    Next R
    
    Gosub Cs
    
    
    End
    
    
    'Unterprogramme, Timing der Datenleitungen
    
    
    'Senden eines Befehls
    
    Command:
    Portc.5 = 0
    Portc.3 = 0                                                 'Cs auf 0  Start der Sequenz
    
    Portc.5 = 0
    Portc.4 = 0                                                 '0 für Command
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 128
    If B = 128 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 64
    If B = 64 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 32
    If B = 32 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 16
    If B = 16 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 8
    If B = 8 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 4
    If B = 4 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 2
    If B = 2 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 1
    If B = 1 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Return
    
    'Senden eines Wertes
    
    Parameter:
    Portc.5 = 0
    Portc.3 = 0                                                 'Cs auf 0  Start der Sequenz
    
    Portc.5 = 0
    Portc.4 = 1                                                 '1 für Parameter
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 128
    If B = 128 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 64
    If B = 64 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 32
    If B = 32 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 16
    If B = 16 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 8
    If B = 8 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 4
    If B = 4 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 2
    If B = 2 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Portc.5 = 0
    B = A And 1
    If B = 1 Then Portc.4 = 1
    If B = 0 Then Portc.4 = 0
    Portc.5 = 1
    
    Return
    
    Cs:
    Portc.3 = 1
    Return
    
  • REKLAMA
  • #2 4643007
    Duch__
    Poziom 31  
    Posty: 2338
    Pomógł: 33
    Ocena: 1598
    Witam. Wznawiam temat. Udało Ci się coś z tym wyświetlaczem zmajstrować? Bo ja jak narazie nie umiem nic zaincjować na wyświetlaczu.
  • REKLAMA
  • #3 4643957
    pmmisiek
    Poziom 15  
    Posty: 234
    Pomógł: 7
    Ocena: 4
    Tak jak napisałem wcześniej, udało mi się tylko wyświetlić kolorowe paski przy pomocy kodu który zamieściłem wcześniej.

    Moim zdaniem trzeba przejść na C, bo z tym bascomem to nie ma przyszłości.

    Pozdrawiam
  • #4 4648104
    Duch__
    Poziom 31  
    Posty: 2338
    Pomógł: 33
    Ocena: 1598
    Udało mi się wyświetlić pierwszą grafikę w formie tekstu przygotowaną w programie LCD Converter (pakiet Bascoma) :D

    Kod do obsługi LCD PCF8833 w Bascomie - brak reakcji wyświetlacza
REKLAMA