Forum: Mikrocontroller und Digitale Elektronik Atmega8515 steuert Grafikdisplay


von Jürgen (Gast)


Lesenswert?

Hallo,

ich habe mir ein Grafikdisplay von Pollin gekauft Bestnr. 120424. 
Bezeichnung TG12864B-03 komp. zu KS0108.

Nun sitze ich schon seit Tagen vor meinem Programm um das Display 
anzusteueren. Leider gibt das Ding nichts von sich. Ich kann den 
Kontrast einstellen, aber ein paar Punke darzustellen, dass habe ich 
nicht geschafft. Display ist laut dem Datenblatt von Pollin richtig 
angeschlossen. Verbindungen habe ich mehrmals nach geprüft.

Ich schicke euch mein Listing. Vielleicht sieht einer mein Denkfehler, 
oder ist das Display defekt? PS: Busybit werte ich noch nicht aus, und 
warte lieber.

Listing:

; Grafik_LCD mit KS0108 (Display von Pollin)
;
.include "m8515def.inc"
;
; PIN7  D0 -> PD0
; PIN8  D1 -> PD1
; PIN9  D2 -> PD2
; PIN10 D3 -> PD3
; PIN11 D4 -> PD4
; PIN12 D5 -> PD5
; PIN13 D6 -> PD6
; PIN14 D7 -> PD7
;
; Definition Ports
;
.equ  DI    = PB0    ;H=Daten L=Instruction     Pin4
.equ  RW    = PB1    ;H=Data read L=Data write   Pin5
.equ  E    = PB2    ;Enable           Pin6
.equ  CS1    = PB3    ;H= Left side         Pin15
.equ  CS2    = PB4    ;H= Right side         Pin16
.equ  RST    = PB5    ;L= Reset           Pin17
.equ    BF    = PD7    ;H= int.op. L= ready    Pin14
;
; Display Befehle
;
.equ  DSP_ON  = 0b00111111 ;Display ein
.equ  DSP_OFF = 0b00111110 ;Display aus
.equ  LINE  = 0b11000000 ;Start_linie
.equ  X_POS  = 0b10111000 ;Page (0-7)
.equ  Y_POS  = 0b01000000 ;Y-address (0-63)
;
; Register Bezeichnungen
;
.def  Zahl  = r0
.def   temp  = r16
.def  delay  = r17
.def  delay2  = r18
.def  delay3  = r19
;
;
;
.cseg
.org 0x00    ; Startadresse
;
; Stack festlegen
;
      ldi temp,0x5F
      out SPL,temp
      ldi temp,0x02
      out SPH,temp
;
; Ports initialisieren
;
      ldi temp,0b11111111    ;
      out DDRB,Temp        ; PortB ist Ausgang
      out DDRD,Temp        ; PortD ist Ausgang
;
; Start Test
;
start:    rcall wait
;
;
            sbi PortB,RST         ; RESET auf 5V setzen
      rcall wait
      rcall DSP_L          ; Linke Seite aktivieren
      rcall wait
      rcall DSP_AN        ; Display an
      rcall ST_LINE
      rcall X_
      rcall Y_
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN
      ldi temp,0b01010101
      rcall DATEN
      ldi temp,0b10101010
      rcall DATEN

;

ENDE:     rjmp ENDE
;
DSP_AN:    rcall WDI
      ldi temp,DSP_ON
      out PortD,temp        ; Display ein
          rcall Enable        ; Daten werden vom Display übernommen
      Ret
;
DSP_L:    sbi PortB,CS1        ; CS1 an (linke Seite)
      cbi PortB,CS2        ; CS2 aus
      Ret
;
DSP_R:    cbi PortB,CS1        ; CS1 aus
      sbi PortB,CS2        ; CS2 an  (rechte Seite)
      Ret

DSP_B:      sbi PortB,CS1        ;
      sbi PortB,CS2        ;
      Ret
;
ST_LINE:  rcall WDI
      ldi temp,LINE
      out PortD,temp        ;  Anfangsline Y=0
      rcall Enable        ; Daten werden vom Display übernommen
      Ret
;
X_:      rcall WDI
      ldi temp,X_POS
      out PortD,temp        ; X Position 0
      rcall Enable        ; Daten werden vom Display übernommen
      Ret
;
Y_:      rcall WDI
      ldi temp,Y_POS
      out PortD,temp        ; Y Position 0
      rcall Enable        ; Daten werden vom Display übernommen
      Ret
;
WDD:    cbi PortB,RW        ; 0= Schreiben    Daten schreiben 
(W)rite(D)isplay(D)ata
       sbi PortB,DI        ; 1= Daten
            Ret
;
WDI:      cbi PortB,RW        ; 0= Schreiben  Instr.schreiben 
(W)rite)(D)isplay(I)nstr.
      cbi PortB,DI        ; 0= Instruktion
      Ret
;
DATEN:    rcall WDD          ; Daten werden ans Display gesendet
      out PortD,temp
      rcall Enable
      Ret
;
;
ENABLE: rcall wait
    sbi PortB,E      ; LCD /enable (freigabe) ÜBERNAHME BEI FALLENDER 
FLANKE
    nop
    nop
    rcall wait
    cbi PortB,E       ; Übernahme
    nop
    nop
    rcall wait
    sbi PortB,E       ; Enable auf 1, damit Daten gelesen werden können
    ret

;
; Warteschleife
;
Wait:           ldi Delay3,20
loop2:          ldi Delay2,255
loop1:          ldi Delay,255
loop:          dec delay
    brne loop
    dec delay2
    brne loop1
Wait2:          dec delay3
    brne loop2
          ret

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.