⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd128.a30

📁 瑞萨(Renesas)M16C系列芯片的函数库
💻 A30
📖 第 1 页 / 共 2 页
字号:
;                 	: 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            $_lcd12864__wr_dreg
                                        ; global declaration
$_lcd12864__wr_dreg:
        ;---- select data ----
        bset:g  LCD_RS                 ; select data 
                                        ; (set RS port of LCD module as "H")

        ;---- set as writing to LCD ----
        bclr:g  LCD_RW                ; set LCD module as input
        ;                               ; (set RW of LCD as "L" to WRITE)
        mov.b:s #0ffH, pd0         ; set CPU as output
                                        ; (set P0_0 to P0_7 as output)
		nop
        ;---- write 8bit ----
        bset:g  LCD_E                  ; set E port of LCD module as "H"
        mov.b:g R1L, R0L                ; write parameter (R1) to LCD
        mov.b   R0L, p0                 ; transfer lower 8bit (P0 = R1L)
		nop
        bclr:g  LCD_E                  ; set E port of LCD module as "L"
		nop
		nop
        ;---- set port as initial status ----
        mov.b:s #00H, pd0          ; set P0_0 to P0_7 as input
        rts


;""SUBR COMMENT""**************************************************************
; ID              	: ---
; Subroutine  		: int _lcd12864__rd_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            __lcd12864__rd_creg
                                        ; global declaration
__lcd12864__rd_creg:
        ;---- select command ----
        bclr:g  LCD_RS                 ; select command
                                        ; (set RS port of LCD module as "L")

        ;---- set as reading from LCD ----
        bset:g  LCD_RW                 ; set LCD module as output
                                        ; (set RW of LCD as "H" to READ)

        ;---- read 8bit ----
        bset:g  LCD_E                  ; set E port of LCD module as "H"
        nop                             ; match time
        nop                             ; match time
        mov.b:g p0, R0L                 ; set the value read from LCD to R0
        bclr:g  LCD_E                  ; set E port of LCD module as "L"

        ;---- set port as initial status ----
        bclr:g  LCD_RW                 ; set LCD module as input
                                        ; (set L as WRITE)
        rts


;""SUBR COMMENT""**************************************************************
; ID              	: 
; Subroutine  		: int _lcd12864__rd_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    __lcd12864__rd_dreg  ; global declaration
__lcd12864__rd_dreg:
        ;---- select data ----
        bset:g  LCD_RS                 ; select data
                                        ; (set RS port of LCD module as "H")

        ;---- set as reading from LCD ----
        bset:g  LCD_RW                 ; set LCD module as output
                                        ; (set RW of LCD as "H" to READ)

        ;---- read 8bit ----
        bset:g  LCD_E                  ; set E port of LCD module as "H"
        nop                             ; match time
        nop                             ; match time
        mov.b:g p0, R0L                 ; set the value read from LCD to R0
        bclr:g  LCD_E                  ; set E port of LCD module as "L"

        ;---- set port as initial status ----
        bclr:g  LCD_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 + -