Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/21/02 04:03
Read: times


 
#29459 - I can't write to my optrex 16230 lcd
Hi
I am trying for a long time to write to my lcd, I found a several codes in internet, I read a datasheet for 1000 times, but seems to be imposible do that, I read a lot of posts in this forum but nothing soved my problem.
When a turn on my circuit the lcd apear with all blocks in the first line, after initialisation the blocks desapear, I try to send a character to it but nothing happen.
Here is my code for 89S8252.
May anybody says where are my mistake?
Guys sorry a big post, but I am desperade.

Thanks in advance

#include 8051.h

lcd_i .equ 8000h
lcd_d .equ 8002h

sjmp main

texto .db "Testing LCD",0

ete .equ texto

main acall lcd_int
mov DPTR, #ete
acall lcd_wt
halt sjmp halt
.end

lcd_int: mov r7,#30 ; inicjalizacja wyœwietlacza
lcall delay_ms
;ESCREVE O 1º 30
mov a,#30h
mov dptr,#lcd_i
movx @dptr,a
mov r7,#5
lcall delay_ms
;ESCREVE O 2º 30
mov a,#30h
mov dptr,#lcd_i
movx @dptr,a
mov r7,#100
lcall delay_ms
;ESCREVE O 3º 30
mov a,#30h
lcall lcd_wc

mov a,#3Ch
lcall lcd_wc

mov a,#08h
lcall lcd_wc

mov a,#01h
lcall lcd_wc

mov a,#06h
lcall lcd_wc

ret

;*****************************************************************
lcd_wc: push DPH
push DPL
mov dptr,#lcd_i ; wys³anie komndy do wyœwietlacza
lcall lcd_busy
movx @dptr,a
pop DPL
pop DPH
ret
;*****************************************************************
lcd_wd: push DPH
push DPL
lcall lcd_busy ;wys³anie danych do wyswietlacza
mov dptr,#lcd_d
movx @dptr,a
pop DPL
pop DPH
ret
;*****************************************************************
lcd_rc:
lcall lcd_busy ;pobranie pozycji kursora z wyœwietlacza
mov dptr,#lcd_i
clr a
movc a,@a+dptr
ret
;*****************************************************************
lcd_busy:
push ACC ;sprawdzenie flagi busy
test_b: clr a
mov dptr,#lcd_i
movc a,@a+dptr
jb ACC.7,test_b
pop ACC
ret
;*****************************************************************
lcd_wt: lcall clr_scr
mov r1,#0
w: mov a,r1
movc a,@a+dptr
jz text_end
lcall lcd_wd
inc r1
cjne r1,#16,w
mov a,#0c0h
lcall lcd_wc
sjmp w
text_end:
ret
;*****************************************************************
clr_scr: mov ACC,#01
lcall lcd_wc
ret
;*****************************************************************
delay_ms: ;daje opoznienie 0.5 ms * r7 przy zegarze 11 mhz
a00: mov r6,#229d
djnz r6,*
djnz r7,a00
ret



List of 2 messages in thread
TopicAuthorDate
I can't write to my optrex 16230 lcd            01/01/70 00:00      
RE: I did. this thread is finished            01/01/70 00:00      

Back to Subject List