📄 lcd1.a30
字号:
; :
; : timing control is as below. please note the request of time.
; : --------------------------+--+--+--+-------+----+-----
; : TIME RS RW E I/O-DIR LCD M16C
; : --------------------------+--+--+--+-------+----+-----
; : def= x 0 0 RD | IN IN
; : BSET:G RS 41.7*3=125.1 1 . . . | . .
; : MOV.B:S #W 41.7*2=83.4 . . . WR | . OUT
; : BSET:G E 41.7*3=125.1 . . 1 . | . .
; : MOV.B:G 41.7*=83.4 . . . . | . .
; : MOVLL 41.7*5=208.5 . . . . |(WR Data)
; : BCLR:G E 41.7*3=125.1 . . 0 . | . .
; : MOV.B:S #R 41.7*2=83.4 . . . RD | IN
; History : ---
;""SUBR COMMENT END""**********************************************************
.section program ; the same section as the C program section
.glb $_lcd1__wr_nibble_dreg
; global declaration
$_lcd1__wr_nibble_dreg:
;---- select data ----
bset:g p4_6_RS ; select data
; (set RS port of LCD module as "H")
;---- set as writing to LCD ----
mov.b:s #DIR_WRITE, pd4 ; set CPU as output
; (set P4_0 to P4_3 as output)
;---- write 4bit ----
bset:g p4_4_E ; set E port of LCD module as "H"
mov.b:g R1L, R0L ; write parameter (R1) to LCD
movll R0L, p4 ; transfer lower 4bit (P4 = R1L)
bclr:g p4_4_E ; set E port of LCD module as "L"
;---- set port as initial status ----
mov.b:s #DIR_READ, pd4 ; set P4_0 to P4_3 as input
rts
;""SUBR COMMENT""**************************************************************
; ID : ---
; Subroutine : int _lcd1__rd_nibble_creg(void)
; Function : read command register of LCD
; Input : none
; Output : int value (other bits are masked expect lower 4 bits)
; Subroutine used : none
; Stack : 0
; Notice : get return value from R0 according to the return value transfer rule
; :
; : timing control is as below. please note the request of time.
; : --------------------------+--+--+--+-------+----+-----
; : TIME RS RW E I/O-DIR LCD M16C
; : --------------------------+--+--+--+-------+----+-----
; : def= x 0 0 RD | IN IN
; : BCLR:G RS 41.7*3=125.1 0 . . . | . .
; : BSET:G RW 41.7*3=125.1 . 1 . . | OUT .
; : BSET:G E 41.7*3=125.1 . . 1 . | . .
; : NOP 41.7*1= 41.7 . . . . | . .
; : NOP 41.7*1= 41.7 . . . . | . .
; : MOV.B:G 41.7*2=83.4 . . . . |(RD Command)
; : AND.W:G 41.7*3=125.1 . . . . | . .
; : BCLR:G E 41.7*3=125.1 . . 0 . | . .
; : BCLR:G RW 41.7*3=125.1 . 0 . . | IN .
; History : ---
;""SUBR COMMENT END""**********************************************************
.section program ; the same section as the C program section
.glb __lcd1__rd_nibble_creg
; global declaration
__lcd1__rd_nibble_creg:
;---- select command ----
bclr:g p4_6_RS ; select command
; (set RS port of LCD module as "L")
;---- set as reading from LCD ----
bset:g p4_5_RW ; set LCD module as output
; (set RW of LCD as "H" to READ)
;---- read 4bit ----
bset:g p4_4_E ; set E port of LCD module as "H"
nop ; match time
nop ; match time
mov.b:g p4, R0L ; set the value read from LCD to R0
and.w:g #0fH, R0 ; (R0 = p4&0x0f)
bclr:g p4_4_E ; set E port of LCD module as "L"
;---- set port as initial status ----
bclr:g p4_5_RW ; set LCD module as input
; (set L as WRITE)
rts
;""SUBR COMMENT""**************************************************************
; ID :
; Subroutine : int _lcd1__rd_nibble_dreg(void)
; Function : read data register of LCD
; Input : none
; Output : int value (other bits are masked expect lower 4 bits)
; Subroutine used : none
; Stack : 0
; Notice : get return value from R0 according to the return value transfer rule
; :
; : timing control is as below. please note the request of time.
; : --------------------------+--+--+--+-------+----+-----
; : TIME RS RW E I/O-DIR LCD M16C
; : --------------------------+--+--+--+-------+----+-----
; : def= x 0 0 RD | IN IN
; : BSET:G RS 41.7*3=125.1 1 . . . | . .
; : BSET:G RW 41.7*3=125.1 . 1 . . | OUT .
; : BSET:G E 41.7*3=125.1 . . 1 . | . .
; : NOP 41.7*1= 41.7 . . . . | . .
; : NOP 41.7*1= 41.7 . . . . | . .
; : MOV.B:G 41.7*2=83.4 . . . . |(RD Data)
; : AND.W:G 41.7*3=125.1 . . . . | . .
; : BCLR:G E 41.7*3=125.1 . . 0 . | . .
; : BCLR:G RW 41.7*3=125.1 . 0 . . | IN .
; History : ---
;""SUBR COMMENT END""**********************************************************
.section program ; the same section as the C program section
.glb __lcd1__rd_nibble_dreg ; global declaration
__lcd1__rd_nibble_dreg:
;---- select data ----
bset:g p4_6_RS ; select data
; (set RS port of LCD module as "H")
;---- set as reading from LCD ----
bset:g p4_5_RW ; set LCD module as output
; (set RW of LCD as "H" to READ)
;---- read 4bit ----
bset:g p4_4_E ; set E port of LCD module as "H"
nop ; match time
nop ; match time
mov.b:g p4, R0L ; set the value read from LCD to R0
and.w:g #0fH, R0 ; (R0 = p4&0x0f)
bclr:g p4_4_E ; set E port of LCD module as "L"
;---- set port as initial status ----
bclr:g p4_5_RW ; set LCD module as input
; (set L as WRITE)
rts
.end
;******************************************************************************
; end of file
;******************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -