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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/23/01 00:55
Read: times


 
#15934 - RE: lcd (graphic)

My Code is;


;The processor clock speed is 12MHz.
;Cycle time is 1uS.
;HD61202 demo software to DIsplay
;the Hantronix logoon a 128 x 64 LCD.



;LcdRst BIT 4
;LcdOnOff BIT 5
;LcdBusy BIT 7
CltP2 EQU P2 ; porta p2 usada como controle
DI BIT P2.0
RW BIT P2.1
E BIT P2.2
CS1 BIT P2.3
CS2 BIT P2.4
Reset BIT P1.0
datas EQU P3 ; P0RT P0





org 00h
ljmp start
;org100h
;Initialize the 64gs12


Start: mov CltP2,#00H
clr Reset
nop
nop
nop
setb Reset
call Check_Reset
mov sp,#30h

mov r0,#00H ;set64gs12left
mov dptr,#Msgi1 ;initializationbytes
lcall command
mov r0,#01h ;set64gs12RSght
mov dptr,#Msgi1 ;initializationbytes
lcall command

mov r4,#0b8h ;pagecommand
mov r5,#08h ;;pagecount

Loop1:
mov r0,#00h ;set64gs12left
mov dptr,#Msg11
lcall byte

clr DI ;setcommand
inc r4 ;bumppageadd
mov a,r4
mov r1,a
lcall Write
djnz r5,loop1

mov r4,#0b8h ;pageadd.Command
mov r5,#08h ;pagecount
Loop2:
mov r0,#01h ;set64gs12RSght
mov dptr,#Msg1r
lcall byte
clr DI ;setcommand
inc r4 ;bumppageadd
mov a,r4
mov r1,a
lcall Write

djnz r5,loop2
;repeat 8times
pisca: mov r0,#20 ;end
volto: call delay
djnz r0,volto
cpl p2.6
ljmp pisca

;*************************************************
;SUBROUTINES
;COMMANDsendsthebytepointedtoby
;theDPTRtothegraphicsmodule
;as aseRSesofcommands.

Command:
clr DI ;set command
Command2:
clr a
movc a,@a+dptr
mov r1,a
cjne a,#99h,command1 ;done?
Ret
Command1:
lcall Write ;senDIt
inc dptr
sjmp command2
;BYTE sends the byte pointed to by
;the DPTR to the graphics module
;as ase RS esof data bytes.
Byte:
setb DI
clr Rw ;set data
sjmp command2
;WRSTEsendsthebyteinR1tothe
;DIsplay.

Write:
mov a,r0 ;CS the DIsplay
jnz Write1 ;RS ght half
setb CS1


Write2:
call check_Busy
setb E
nop
mov a,r1
mov datas,a
nop
clr E
nop
clr CS1 ;de-selectmodule
clr CS2
Ret
Write1:
setb CS2

sjmp Write2


;********************************************************************************************************
;TABLES AND DATA
;Initialization bytes

Msgi1: db 03fh,03fh,0b8h,40h,0c0h,99h

;"Hantronix",lefthalf

Msg11:
db 0h,0feh,10h,10h,10h,0feh,0h ;H
db 0fch,12h,12h,12h,0fch,0h ;A
db 0feh,08h,10h,20h,0feh,0h ;N
db 02h,02h,0feh,02h,02h,0h ;T
db 0feh,12h,32h,52h,8ch,0h ;R
db 7ch,82h,82h,82h,7ch,0h ;O
db 0feh,08h,10h,20h,0feh,0h, ;N
db 0h,0,82h,0feh,82h,0h ;I
db 0h,0c6h,28h,10h,28h,0c6h,0h ;X
db 0h,38h,7ch,0f8h,7ch,38h,0h ;heart
db 0h,99h
;"Hantronix",RSghthalf(reversevideo)
Msg1r:
db 0ffh,0c7h,83h,07h,83h,0c7h,0ffh ;heart
db 0ffh,39h,0d7h,0efh,0d7h,39h,0ffh ;X
db 0ffh,0ffh,7dh,01h,7dh,0ffh ;I
db 01h,0dfh,0efh,0f7h,01h,0ffh ;N
db 83h,7dh,7dh,7dh,83h,0ffh ;O
db 073h,0adh,0cdh,0edh,01h,0ffh ;R
db 0fdh,0fdh,01h,0fdh,0fdh,0ffh ;T
db 01h,0dfh,0efh,0f7h,01h,0ffh ;N
db 03h,0edh,0edh,0edh,03h,0ffh ;A
db 0ffh,01h,0efh,0efh,0efh,01h,0ffh ;H
db 0ffh,99h

delay: clr tf1
MOV TMOD,#11H
MOV TCON,#0H
MOV TH1,#0H
MOV TL1,#0H
setb tr1
jnb tf1,$
clr tf1
ret

;==============================================================================================================
Check_Busy:
push CltP2
clr E
nop
setb Rw ; set to read
clr DI ; set to command
clr CS2
setb CS1
Re_Check_CS1: nop
setb E
nop
clr E
mov a,Datas
anl a,#10000000B ; Busy, On_off, Reset
jnz Re_Check_CS1 ; 1 0 1 1 0 0 0 0
clr CS1
setb CS2
nop
Re_Check_CS2: setb E
nop
clr E
mov a,datas
anl a,#10000000B ; Busy, On_off, Reset
jnz Re_Check_CS2 ; 1 0 1 1 0 0 0 0
pop CltP2

ret


;=============================================================================================================================
Check_Reset:
push CltP2
setb Rw ; set to read
clr DI ; set to command
clr CS2
setb CS1
Re_Check_Rst_CS1:
nop
setb E
nop
mov a,datas
nop
clr E
anl a,#00010000B ; Busy, On_off, Reset
jnz Re_Check_Rst_CS1 ; 1 0 1 1 0 0 0 0
clr CS1
setb CS2
Re_Check_Rst_CS2:
nop
setb E
nop
mov a,datas
nop
clr E
anl a,#00010000B ; Busy, On_off, Reset
jnz Re_Check_Rst_CS2 ; 1 0 1 1 0 0 0 0
pop CltP2

ret

List of 6 messages in thread
TopicAuthorDate
lcd (graphic)            01/01/70 00:00      
RE: lcd (graphic)            01/01/70 00:00      
RE: lcd (graphic)            01/01/70 00:00      
RE: lcd (graphic)            01/01/70 00:00      
RE: lcd (graphic)            01/01/70 00:00      
RE: lcd (graphic)            01/01/70 00:00      

Back to Subject List