Download Print this page

Toshiba T6963C Application Note page 5

Interfacing to a graphics module

Advertisement

Application Note
Software:
$mod51
; **************************************************
; *
; *
T6963 Application Note V1.0
; *
; **************************************************
; The processor clock speed is 16MHz.
; Cycle time is .750mS.
; Demo software to display a bit-mapped
; graphic on a 240x64 graphics display
; with a T6963C LCD controller.
org
000h
ljmp
start
org 100h
start:
; Initialize the T6963C
clr
p3.3
nop
nop
setb
p3.3
mov
dptr,#msgi1
lcall
msgc
; Start of regular program
; Display graphic
mov
dptr,#msgi2
lcall
msgc
mov
dptr,#msg1
lcall
msgd
sjmp
$
;*************************************************
;SUBROUTINES
; MSGC sends the data pointed to by
; the DPTR to the graphics module
; as a series of commands with
; two parameters each.
msgc:
mov
r0,#2
msgc2:
clr
a
movc
a,@a+dptr
cjne
a,#0a1h,msgc3
ret
msgc3: mov
r1,a
lcall
writed
*
*
*
;program start
;hardware reset
;initialization bytes
;set auto mode
;display graphic
;# of data bytes
;get byte
;done?
;send it
Page 5
inc
dptr
djnz
r0,msgc2
clr
a
movc
a,@a+dptr
mov
r1,a
lcall
writec
sjmp
msgc
; MSGD sends the data pointed to by
; the DPTR to the graphics module.
msgd:
clr
a
movc
a,@a+dptr
cjne
a,#0a1h,msgd1
ret
msgd1:
mov
r1,a
lcall
writed
inc
dptr
sjmp
msgd
; WRITEC sends the byte in R1 to a
; graphics module as a command.
writec:
lcall
status
setb
p3.2
writec1:
mov
p1,r1
clr
p3.0
setb
p3.0
ret
; WRITED sends the byte in R1 to the
; graphics module as data.
writed:
lcall
status
clr
p3.0
sjmp
writec1
; STATUS check to see that the graphic
; display is ready. It won't return
; until it is.
status:
setb
p3.2
mov
p1,#0ffh
mov
r3,#0bh
stat1:
clr
p3.1
mov
a,p1
setb
p3.1
anl
a,r3
clr
c
subb
a,r3
jnz
stat1
ret
;get command
;send command
;next command
;get byte
;done?
;send data
;display ready?
;c/d = 1
;get data
;strobe it
;display ready?
;c/d = 0
;c/d=1
;P1 to input
;status bits mask
;read it
;status OK?

Advertisement

loading