📄 lcddisplay.asm
字号:
;***********************************
;1621 drive lcd
initdisplay:
b0bclr ptcs ;select the cs1621 ic
mov_ lcdcommandbuf,#10000000B ;command
mov_ lcdcodebuf,#00000001B ;sys en
call SendLCDCommand
call SendLCDCode
mov_ lcdcodebuf,#00000011B ;LCD on
call SendLCDCode
mov_ lcdcodebuf,#00011000B ;RC oscillator
call SendLCDCode
mov_ lcdcodebuf,#00101000b ;set bias 1/2 3com
;// mov_ lcdcodebuf,#00100101b ;set bias 1/2 3com
call sendlcdcode
mov_ lcdcodebuf,#10000000b ;disable IRQ output
call SendLCDCode
b0bset ptcs ;not select the cs1621
initdisplay90:
ret
;********************************************
SendLoop_LCD:
SendWRAgain:
b0bclr FC
rlcm lcdsenddatabuf
jc AAA
call SendData0
L_SWRC:
decms temp1
jmp SendWRAgain
ret
AAA: call SendData1
jmp L_SWRC
;----------------------------
SendData1:
b0bset ptdata
nop
b0bclr ptwr
nop
b0bset ptwr
nop
ret
;----------------------------
SendData0:
b0bclr ptdata
NOP
b0bclr ptwr
nop
b0bset ptwr
nop
ret
;----------------------------
SendLCDCode:
mov_ temp1,#8
mov_ lcdsenddatabuf,lcdcodebuf
call SendLoop_LCD
call SendData1
ret
;----------------------------
;SendLCDData:
; mov_ lcdsenddatabuf,lcddatabuf
; mov_ temp1,#8
;SendWRAgain00:
; b0bclr FC
; rrcm lcdsenddatabuf
; jc senddatahigh00
; call SendData0
;L_SWRC00:
; decms temp1
; jmp SendWRAgain00
; ret
;senddatahigh00:
; call SendData1
; jmp L_SWRC00
;----------------------------
SendLCDData4bit:
mov_ lcdsenddatabuf,lcddatabuf
mov_ temp1,#4
SendWRAgain01:
b0bclr FC
rlcm lcdsenddatabuf
b0bts0 fc
jmp senddatahigh01
call SendData0
L_SWRC01:
decms temp1
jmp SendWRAgain01
ret
senddatahigh01:
call SendData1
jmp L_SWRC01
;----------------------------
SendLCDAddress:
bclr fc
rlcm lcdaddressbuf
rlcm lcdaddressbuf
mov_ lcdsenddatabuf,lcdaddressbuf
mov_ temp1,#6
jmp SendLoop_LCD
;----------------------------
SendLCDCommand:
mov_ lcdsenddatabuf,lcdcommandbuf
mov_ temp1,#3
jmp SendLoop_LCD
;**********************************************
;Name :LCDON
;Function:
;Input :
;Output :
;Register Used:
;Subroutine:
;***********************************************
LCDON:
b0bclr ptcs ;select the cs1621 ic
mov_ lcdcommandbuf,#10000000B ;command
mov_ lcdcodebuf,#00000001B ;sys en
call SendLCDCommand
call SendLCDCode
mov_ lcdcodebuf,#00000011B ;LCD on
call SendLCDCode
mov_ lcdcodebuf,#00011000B ;RC oscillator
call SendLCDCode
mov_ lcdcodebuf,#00100100b ;set bias 1/2 3com
;// mov_ lcdcodebuf,#00100101b
call sendlcdcode
mov_ lcdcodebuf,#10000000b ;disable IRQ output
call SendLCDCode
b0bset ptcs ;not select the cs1621
ret
/*
SendData1:
b0bset ptdata
nop
b0bclr ptwr
nop
b0bset ptwr
nop
ret
*/
;**********************************************
;Name :ClearLCD、SetLCD
;Function:
;Input :
;Output :
;Register Used: temp3 temp2
;Subroutine:
;***********************************************
;熄灭LCD的全部点
turnofflcd:
ClearLCD:
mov_ temp3,#0
jmp L_SET0
;----------------------------
;点亮LCD的全部点
SetLCD:
mov_ temp3,#0xff
L_SET0:
b0bclr ptcs
mov_ temp2,#32 ;32
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#0
call SendLCDAddress
L_SET1:
mov_ lcddatabuf,temp3
call SendLCDData4bit
decms temp2
jmp L_SET1
b0bset ptcs
ret
;***********************************************
display:
b0bclr ptcs
mov_ temp2,#18
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#1
call SendLCDAddress
mov a,#seg1$m
mov y,a
mov a,#seg1$l
mov z,a
display1:
mov a,@yz
mov lcddatabuf,a
call SendLCDData4bit
incms z
jmp display2
incms y
nop
display2:
decms temp2
jmp display1
b0bset ptcs
/*
mov a,#seg1$m
mov ww1,a
mov a,#seg1$l
mov ww0,a
mov a,#18
mov r4,a
mov a,#1
or a,#01000000b
mov r0,a
call writeconti
*/
b0bts1 lcdt1flag
jmp display5
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#0
call SendLCDAddress
b0bts1 lcdt1firf
jmp display3
mov a,#10000000b
jmp display4
display3:
mov a,#01000000b
display4:
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display10
display5:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#0
call SendLCDAddress
mov a,#0
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display10:
b0bts1 lcdt2flag
jmp display15
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#21
call SendLCDAddress
b0bts1 lcdt2firf
jmp display13
mov a,#10000000b
jmp display14
display13:
mov a,#01000000b
display14:
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display20
display15:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#21
call SendLCDAddress
mov a,#0
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display20:
b0bts1 lcdt3flag
jmp display25
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#20
call SendLCDAddress
b0bts1 lcdt1firf
jmp display23
mov a,#00100000b
jmp display24
display23:
mov a,#00010000b
display24:
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display30
display25:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#20
call SendLCDAddress
mov a,#0
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display30:
b0bts1 lcdt4flag
jmp display35
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#19
call SendLCDAddress
mov a,#00010000b
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display40
display35:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#19
call SendLCDAddress
mov a,#0
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display40:
b0bts1 lcdt5flag
jmp display45
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
or a,#00100000b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display50
display45:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
and a,#11011111b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display50:
b0bts1 lcdt7flag
jmp display55
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
or a,#10000000b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display60
display55:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
and a,#01111111b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display60:
b0bts1 lcdt6flag
jmp display65
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
or a,#01000000b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
mov a,t6abcbuf
or a,#00010000b
; mov a,#11110000b
mov seg14,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
jmp display70
display65:
b0bclr ptcs
mov_ lcdcommandbuf,#10100000B ;write command
call SendLCDCommand
mov_ lcdaddressbuf,#13
call SendLCDAddress
mov a,seg13
and a,#10111111b
mov seg13,a
mov lcddatabuf,a
call SendLCDData4bit
mov a,#00010000b
mov seg14,a
mov lcddatabuf,a
call SendLCDData4bit
b0bset ptcs
display70:
display90:
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -