Povezvanje DEM 16216 SGH LCD modula sa paralelnim portom

Diskusija o MSP, ARM / LPC, PLC kontrolerima.

Moderators: pedja089, stojke369, [eDo], trax

Post Reply
bojanbl
Posts: 2
Joined: 01-06-2009, 12:40

Povezvanje DEM 16216 SGH LCD modula sa paralelnim portom

Post by bojanbl »

Naime, imam zadatak da isprogramiram inerfejs za pomenuti lcd modul preko paralelnog porta u Emy8086, emulatoru za mikroprocesor 8086...

Kada spojim lcd modul na napajanje, vidim da radi i sve ok...ali kad startujem kod na lcd modulu se nista ne mijenja, mislim da ni inicijalizacija ne prodje kako treba....ne znam gdje grijesim, jel moze neko da pomogne?

Evo koda kojim pokusavam da ispisem na lcd slovo A:

Code: Select all

#masm# 


    ; Bios data area memory segment (0040:0000)
    BDA_segment       equ  40h
    BDA_timer_counter equ  6Ch   ; Timer/Counter variable
    ; This variable is updated 18.2 times in second
    ; by the system clock (8254 Counter0)

    
    ; Software delay macro (non-portable - depends on clock frequency)
soft_delay macro cycles
    
    local petlja1, petlja2
    
    mov bx, cycles
petlja2:
    mov cx, 0FFFFh
petlja1:
    nop
    nop
    loop petlja1
    dec bx
    jnz petlja2 
    
endm

    

    ; Hardware delay macro (portable)
    hard_delay macro ticks

    local again, check_timer    

    mov cx, ticks
    mov ax, BDA_segment
    mov ds, ax
again:
    mov ax, DS:BDA_timer_counter
check_timer:
    cmp ax, DS:BDA_timer_counter
    jz check_timer
    loop again

    endm
    
dseg segment 'data'
    
    Data    equ 378h   ;konstanta Data predstavlja adresu data porta
    Status  equ 379h   ;konstanta Status predstavlja adresu statusnog porta
    Control equ 37Ah   ;konstanta Control predstavlja adresu kontrolnog porta

    poruka db 'A'
    
    
    dseg ends
    
                 
sseg segment 'stack'
    
    dw 128 dup(?)
    
sseg ends


cseg segment 'code' 
    
    assume cs:cseg, ds:dseg, ss:sseg
    
start:   

      mov ax, dseg     ;inicijalizacija segmentnih registara
      mov ds, ax
      mov ax, sseg
      mov ss, ax 
                 
;prvo INICIJALIZACIJA LCD DISPLEJA                  
                 
      mov dx, Control
      mov al, 00000111b    ;koristim kontrolne portove Co0=R/W,C1=RS,C2=E.
      mov dx, Data
      mov al, 38h 
      
      soft_delay 3000
      ;hard_delay 2 
      
      mov dx, Control
      mov al, 00000111b
      mov dx, Data
      mov al, 0Fh       
      
      ;hard_delay 2 
      soft_delay 3000
      mov dx, Control
      mov al, 00000111b
      mov dx, Data
      mov al, 06h 
      
      ;hard_delay 2 
      soft_delay 3000
      mov dx, Control
      mov al, 00000111b
      mov dx, Data
      mov al, 01h 
      
       
                 


soft_delay 3000
;hard_delay 2 
      
      mov dx, Control
      mov al, 00001101b 
      
      ;hard_delay 2
      soft_delay 3000
      
      mov dx, Data
      mov al, 'A'       ;pokusavam da ispisem slovo A na lcd
      out dx,al
       
     cseg ends 



end start
      
Post Reply