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

📄 ks0108.s

📁 用avr控制的ks0108型128×64显示程序
💻 S
📖 第 1 页 / 共 5 页
字号:
	lds R30,_LCD_EN_PORT
	lds R31,_LCD_EN_PORT+1
	ldd R3,z+0
	or R3,R2
	std z+0,R3
	.dbline 169
;     asm("nop");	
	nop
	.dbline 170
;     asm("nop");
	nop
	.dbline 171
;     asm("nop");
	nop
	.dbline 172
;     asm("nop");
	nop
	.dbline 173
;     data=*LCD_IP_PORT;
	lds R30,_LCD_IP_PORT
	lds R31,_LCD_IP_PORT+1
	ldd R20,z+0
	.dbline 174
;     CLEAR_LCD_E;
	lds R2,_LCD_EN_BIT
	com R2
	lds R30,_LCD_EN_PORT
	lds R31,_LCD_EN_PORT+1
	ldd R3,z+0
	and R3,R2
	std z+0,R3
	.dbline 175
;     SET_LCD_WRITE;
	lds R2,_LCD_RW_BIT
	com R2
	lds R30,_LCD_RW_PORT
	lds R31,_LCD_RW_PORT+1
	ldd R3,z+0
	and R3,R2
	std z+0,R3
	.dbline 177
; 
;     asm("sei");
	sei
	.dbline 178
;     return data;
	mov R16,R20
	.dbline -2
L26:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r data 20 c
	.dbsym r lr 22 c
	.dbend
	.dbfunc e set_start_line_L _set_start_line_L fV
;           line -> R20
	.even
_set_start_line_L::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 182
; }
; 
; void set_start_line_L(unsigned char line) /*设置显示起始行*/ //0-63
; {
	.dbline 183
;     write_LCD(LEFT,CMD,0xc0|line); 
	mov R24,R20
	ori R24,192
	std y+0,R24
	clr R18
	clr R16
	xcall _write_LCD
	.dbline -2
L27:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r line 20 c
	.dbend
	.dbfunc e set_start_line_R _set_start_line_R fV
;           line -> R20
	.even
_set_start_line_R::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 187
; }
; 
; void set_start_line_R(unsigned char line) /*设置显示起始行*/ //0-63
; {
	.dbline 188
;     write_LCD(RIGHT,CMD,0xc0|line); 
	mov R24,R20
	ori R24,192
	std y+0,R24
	clr R18
	ldi R16,1
	xcall _write_LCD
	.dbline -2
L28:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r line 20 c
	.dbend
	.dbfunc e set_page_L _set_page_L fV
;           page -> R20
	.even
_set_page_L::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 192
; }
; 
; void set_page_L(unsigned char page)	/*设置X地址 设置页*/  //0-7
; {
	.dbline 193
;     write_LCD(LEFT,CMD,0xb8|page);                     
	mov R24,R20
	ori R24,184
	std y+0,R24
	clr R18
	clr R16
	xcall _write_LCD
	.dbline -2
L29:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r page 20 c
	.dbend
	.dbfunc e set_page_R _set_page_R fV
;           page -> R20
	.even
_set_page_R::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 196
; }
; void set_page_R(unsigned char page)	/*设置X地址 设置页*/ //0-7
; {
	.dbline 197
;     write_LCD(RIGHT,CMD,0xb8|page);                     
	mov R24,R20
	ori R24,184
	std y+0,R24
	clr R18
	ldi R16,1
	xcall _write_LCD
	.dbline -2
L30:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r page 20 c
	.dbend
	.dbfunc e set_col_addr_L _set_col_addr_L fV
;            col -> R20
	.even
_set_col_addr_L::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 201
; }
; 
; void set_col_addr_L(unsigned char col) /*设置Y地址*/ //0-63
; {
	.dbline 202
;     write_LCD(LEFT,CMD,0x40|col);                     
	mov R24,R20
	ori R24,64
	std y+0,R24
	clr R18
	clr R16
	xcall _write_LCD
	.dbline -2
L31:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r col 20 c
	.dbend
	.dbfunc e set_col_addr_R _set_col_addr_R fV
;            col -> R20
	.even
_set_col_addr_R::
	xcall push_gset1
	mov R20,R16
	sbiw R28,1
	.dbline -1
	.dbline 206
; }
; 
; void set_col_addr_R(unsigned char col) /*设置Y地址*/ //0-63
; {
	.dbline 207
;     write_LCD(RIGHT,CMD,0x40|col);                     
	mov R24,R20
	ori R24,64
	std y+0,R24
	clr R18
	ldi R16,1
	xcall _write_LCD
	.dbline -2
L32:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r col 20 c
	.dbend
	.dbfunc e init_lcd _init_lcd fV
	.even
_init_lcd::
	sbiw R28,1
	.dbline -1
	.dbline 211
; }
; 
; void init_lcd(void) /*初始化函数*/
; {    delay_nms(1000);
	.dbline 211
	ldi R16,1000
	ldi R17,3
	xcall _delay_nms
	.dbline 212
;     REST_LCD;  
	lds R2,_LCD_RES_BIT
	lds R30,_LCD_RES_PORT
	lds R31,_LCD_RES_PORT+1
	ldd R3,z+0
	or R3,R2
	std z+0,R3
	.dbline 213
; 	delay_nms(1000);
	ldi R16,1000
	ldi R17,3
	xcall _delay_nms
	.dbline 214
;     set_start_line_L(0); /*显示起始行为0*/
	clr R16
	xcall _set_start_line_L
	.dbline 215
;     set_start_line_R(0); /*显示起始行为0*/
	clr R16
	xcall _set_start_line_R
	.dbline 216
;     write_LCD(LEFT,CMD,DISPLAY_ON); /*  开显示  */
	ldi R24,63
	std y+0,R24
	clr R18
	clr R16
	xcall _write_LCD
	.dbline 217
;     write_LCD(RIGHT,CMD,DISPLAY_ON); /*  开显示  */
	ldi R24,63
	std y+0,R24
	clr R18
	ldi R16,1
	xcall _write_LCD
	.dbline -2
L33:
	adiw R28,1
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e clr_lcd _clr_lcd fV
;          pages -> R20
;              i -> R22
	.even
_clr_lcd::
	xcall push_gset2
	sbiw R28,1
	.dbline -1
	.dbline 221
; }
; 
; void clr_lcd(void) /*清屏函数*/
; {
	.dbline 223
;     unsigned char pages,i;
;     for(pages=0;pages<8;pages++)
	clr R20
	xjmp L38
L35:
	.dbline 224
;     {
	.dbline 225
;         set_page_L(pages);  /* X 页地址 */
	mov R16,R20
	xcall _set_page_L
	.dbline 226
;         set_page_R(pages);  /* X 页地址 */
	mov R16,R20
	xcall _set_page_R
	.dbline 227
;         for(i=0;i<64;i++)   
	clr R22
	xjmp L42
L39:
	.dbline 228
	.dbline 229
	mov R16,R22
	xcall _set_col_addr_L
	.dbline 230
	mov R16,R22
	xcall _set_col_addr_R
	.dbline 231
	clr R2
	std y+0,R2
	ldi R18,1
	clr R16
	xcall _write_LCD
	.dbline 232
	clr R2
	std y+0,R2
	ldi R18,1
	ldi R16,1
	xcall _write_LCD
	.dbline 233
L40:
	.dbline 227
	inc R22
L42:
	.dbline 227
	cpi R22,64
	brlo L39
	.dbline 234
L36:
	.dbline 223
	inc R20
L38:
	.dbline 223
	cpi R20,8
	brlo L35
	.dbline -2
L34:
	adiw R28,1
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r pages 20 c
	.dbsym r i 22 c
	.dbend
	.area lit(rom, con, rel)
_ASC_16::
	.byte 49
	.byte 0,0
	.byte 8,8
	.byte 252,0
	.byte 0,0
	.byte 0,0
	.byte 4,4
	.byte 7,4
	.byte 4,0
	.byte 50
	.byte 0,0
	.byte 8,4
	.byte 132,'D
	.byte 56,0
	.byte 0,0
	.byte 6,5
	.byte 4,4
	.byte 4,0
	.byte 51
	.byte 0,0
	.byte 8,4
	.byte 'D,'D
	.byte 184,0
	.byte 0,0
	.byte 2,4
	.byte 4,4
	.byte 3,0
	.byte 52
	.byte 0,0
	.byte 128,96
	.byte 24,252
	.byte 0,0
	.byte 0,0
	.byte 1,1
	.byte 5,7
	.byte 5,0
	.byte 53
	.byte 0,0
	.byte 124,'D
	.byte 'D,'D
	.byte 132,0
	.byte 0,0
	.byte 2,4
	.byte 4,4
	.byte 3,0
	.byte 54
	.byte 0,0
	.byte 240,'H
	.byte 'D,'D
	.byte 128,0
	.byte 0,0
	.byte 3,4
	.byte 4,4
	.byte 3,0
	.byte 55
	.byte 0,0
	.byte 12,4
	.byte 132,'d
	.byte 28,0
	.byte 0,0
	.byte 0,6
	.byte 1,0
	.byte 0,0
	.byte 56
	.byte 0,0
	.byte 184,'D
	.byte 'D,'D
	.byte 184,0
	.byte 0,0
	.byte 3,4
	.byte 4,4
	.byte 3,0
	.byte 57
	.byte 0,0
	.byte 56,'D
	.byte 'D,'D
	.byte 248,0
	.byte 0,0
	.byte 0,4
	.byte 4,2
	.byte 1,0
	.byte 48
	.byte 0,0
	.byte 248,4
	.byte 4,4
	.byte 248,0
	.byte 0,0
	.byte 3,4
	.byte 4,4
	.byte 3,0
	.byte 46
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 4,0
	.byte 0,0
	.byte 44
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,8
	.byte 4,0
	.byte 0,0
	.byte 58
	.byte 0,0
	.byte 0,0
	.byte 32,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 4,0
	.byte 0,0
	.byte 59
	.byte 0,0
	.byte 0,0
	.byte 32,0
	.byte 0,0
	.byte 0,0
	.byte 0,8
	.byte 4,0
	.byte 0,0
	.byte 45
	.byte 0,128
	.byte 128,128
	.byte 128,128
	.byte 128,128
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 95
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 16,16
	.byte 16,16
	.byte 16,16
	.byte 16,16
	.byte 'A
	.byte 0,0
	.byte 128,'d
	.byte 28,96
	.byte 128,0
	.byte 0,4
	.byte 7,5
	.byte 1,5
	.byte 7,4
	.byte 'B
	.byte 0,4
	.byte 252,'D
	.byte 'D,'D
	.byte 'D,184
	.byte 0,4
	.byte 7,4
	.byte 4,4
	.byte 4,3
	.byte 'C
	.byte 0,240
	.byte 8,4
	.byte 4,4
	.byte 4,8
	.byte 0,1
	.byte 2,4
	.byte 4,4
	.byte 4,2
	.byte 'D
	.byte 0,4
	.byte 252,4
	.byte 4,4
	.byte 8,240
	.byte 0,4
	.byte 7,4
	.byte 4,4
	.byte 2,1
	.byte 'E
	.byte 0,4
	.byte 252,'D
	.byte 'D,228
	.byte 4,12
	.byte 0,4
	.byte 7,4
	.byte 4,4
	.byte 4,6
	.byte 'F
	.byte 0,4
	.byte 252,'D
	.byte 'D,228
	.byte 4,12
	.byte 0,4
	.byte 7,4
	.byte 4,0
	.byte 0,0
	.byte 32
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 61
	.byte 0,0
	.byte 160,160
	.byte 160,160
	.byte 160,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 40
	.byte 0,0
	.byte 0,224
	.byte 24,4
	.byte 0,0
	.byte 0,0
	.byte 0,3
	.byte 12,16
	.byte 0,0
	.byte 41
	.byte 0,0
	.byte 0,4
	.byte 24,224
	.byte 0,0
	.byte 0,0
	.byte 0,16
	.byte 12,3
	.byte 0,0
	.byte 'V
	.byte 0,4
	.byte 60,196
	.byte 0,196
	.byte 60,4
	.byte 0,0
	.byte 0,1
	.byte 6,1
	.byte 0,0
	.byte 'm
	.byte 0,32
	.byte 224,32
	.byte 192,32
	.byte 192,0
	.byte 0,4
	.byte 7,0
	.byte 7,0
	.byte 7,4
	.byte 'H
	.byte 0,4
	.byte 252,'D
	.byte 64,'D
	.byte 252,4
	.byte 0,4
	.byte 7,4
	.byte 0,4
	.byte 7,4
	.byte 42
	.byte 144,144
	.byte 96,252
	.byte 96,144
	.byte 144,0
	.byte 0,0
	.byte 0,3
	.byte 0,0
	.byte 0,0
	.dbstruct 0 17 typFNT_ASC16
	.dbfield 0 Index A[1:1]c
	.dbfield 1 Msk A[16:16]c
	.dbend
	.dbsym e ASC_16 _ASC_16 A[510:30]kS[typFNT_ASC16]
_GB_16::
	.byte 191,198
	.byte 138,'j
	.byte 254,41
	.byte 'I,128
	.byte 146,164
	.byte 128,255
	.byte 64,0
	.byte 1,0
	.byte 7,0
	.byte 0,0
	.byte 0,0
	.byte 0,7
	.byte 0,0
	.byte 188,188
	.byte 'D,'D
	.byte 255,36
	.byte 0,'d
	.byte 164,63
	.byte 164,'d
	.byte 4,0
	.byte 4,4
	.byte 7,0
	.byte 4,4
	.byte 2,1
	.byte 2,4
	.byte 4,0
	.byte 211,208
	.byte 'B,34
	.byte 18,250
	.byte 'N,'K
	.byte 'J,'J
	.byte 250,2
	.byte 2,0
	.byte 0,0
	.byte 0,7
	.byte 1,1
	.byte 1,5
	.byte 7,0
	.byte 0,0
	.byte 207,222
	.byte 255,129
	.byte 153,231
	.byte 0,255
	.byte 37,229
	.byte 37,191
	.byte 64,0
	.byte 7,0
	.byte 0,0
	.byte 0,7
	.byte 4,2
	.byte 1,2
	.byte 4,0
	.byte 185,171
	.byte 32,16
	.byte 8,7
	.byte 192,48
	.byte 131,12
	.byte 16,32
	.byte 32,0
	.byte 0,4
	.byte 6,5
	.byte 4,4
	.byte 2,3
	.byte 6,0
	.byte 0,0
	.byte 203,190
	.byte 8,9
	.byte 233,41
	.byte 41,41
	.byte 237,9
	.byte 1,255
	.byte 0,0
	.byte 0,0
	.byte 1,1
	.byte 1,1
	.byte 1,4
	.byte 4,7
	.byte 0,0
	.byte 210,186
	.byte 25,226
	.byte 20,'B
	.byte 242,46
	.byte 'r,143
	.byte 170,'z
	.byte 2,0
	.byte 1,7
	.byte 0,0
	.byte 7,4
	.byte 4,2
	.byte 1,2
	.byte 4,0
	.byte 190,167
	.byte 0,192
	.byte 64,95
	.byte 213,21
	.byte 213,'U
	.byte 95,64
	.byte 192,0
	.byte 0,7
	.byte 5,5
	.byte 7,0
	.byte 7,5
	.byte 5,5
	.byte 7,0
	.byte 207,212
	.byte 0,64
	.byte 159,21
	.byte 213,21
	.byte 213,21
	.byte 31,192

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -