📄 lcd.s
字号:
.byte 28,36
.byte 'C,128
.byte 240,0
.byte 0,16
.byte 16,144
.byte 16,16
.byte 17,22
.byte 16,16
.byte 16,208
.byte 24,16
.byte 0,0
.byte 64,64
.byte 64,64
.byte 'C,92
.byte 64,64
.byte 'P,'L
.byte 'C,64
.byte 64,96
.byte 64,0
.byte 0,0
.byte 128,158
.byte 146,146
.byte 146,146
.byte 146,146
.byte 146,223
.byte 130,0
.byte 0,0
.byte 4,132
.byte 132,'D
.byte 'D,36
.byte 28,7
.byte 12,20
.byte 36,'D
.byte 196,'F
.byte 4,0
.byte 0,0
.byte 192,94
.byte 'R,'R
.byte 'R,'R
.byte 'R,'R
.byte 'R,95
.byte 226,64
.byte 0,0
.byte 0,128
.byte 159,64
.byte 64,32
.byte 16,15
.byte 0,32
.byte 32,64
.byte 95,128
.byte 0,0
.byte 16,16
.byte 146,146
.byte 'R,50
.byte 18,254
.byte 18,50
.byte 'Q,209
.byte 'P,24
.byte 16,0
.byte 2,2
.byte 130,130
.byte 'J,'W
.byte 34,35
.byte 34,'R
.byte 'N,130
.byte 2,3
.byte 2,0
.byte 32,34
.byte 236,0
.byte 32,34
.byte 170,170
.byte 170,191
.byte 170,170
.byte 11,162
.byte 32,0
.byte 0,0
.byte 127,32
.byte 16,0
.byte 255,10
.byte 10,10
.byte 'J,138
.byte 127,0
.byte 0,0
.byte 64,'B
.byte 'D,204
.byte 0,96
.byte 94,'H
.byte 200,127
.byte 200,'H
.byte 'L,'h
.byte 64,0
.byte 0,64
.byte 32,31
.byte 32,96
.byte 144,140
.byte 131,128
.byte 143,144
.byte 144,208
.byte 92,0
.byte 16,16
.byte 16,255
.byte 144,'P
.byte 130,'F
.byte 42,146
.byte 42,'F
.byte 130,128
.byte 128,0
.byte 2,'B
.byte 129,127
.byte 0,9
.byte 8,9
.byte 9,255
.byte 9,9
.byte 12,9
.byte 0,0
.byte 0,0
.byte 252,36
.byte 36,34
.byte 227,2
.byte 252,'D
.byte 'D,'B
.byte 195,'b
.byte 64,0
.byte 64,32
.byte 31,2
.byte 2,'B
.byte 39,16
.byte 15,0
.byte 0,0
.byte 255,0
.byte 0,0
.byte 144,140
.byte 132,173
.byte 149,149
.byte 133,255
.byte 133,149
.byte 149,173
.byte 132,212
.byte 140,0
.byte 0,0
.byte 252,4
.byte 4,126
.byte 5,4
.byte 124,4
.byte 'D,132
.byte 126,4
.byte 0,0
.byte 0,248
.byte 12,11
.byte 8,8
.byte 252,40
.byte 144,15
.byte 8,8
.byte 8,252
.byte 8,0
.byte 0,127
.byte 33,33
.byte 33,33
.byte 127,0
.byte 0,1
.byte 'C,128
.byte 64,63
.byte 0,0
.byte 8,8
.byte 8,248
.byte 12,40
.byte 32,32
.byte 255,32
.byte 32,32
.byte 32,240
.byte 32,0
.byte 8,24
.byte 8,15
.byte 132,'D
.byte 32,28
.byte 3,32
.byte 64,128
.byte 64,63
.byte 0,0
.byte 16,216
.byte 'T,'S
.byte 'P,220
.byte 48,0
.byte 127,144
.byte 136,132
.byte 134,224
.byte 0,0
.byte 0,255
.byte 9,'I
.byte 137,127
.byte 0,0
.byte 126,144
.byte 136,132
.byte 134,128
.byte 224,0
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,192
.byte 128,0
.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 16,16
.byte 208,255
.byte 144,16
.byte 136,'H
.byte 168,9
.byte 10,8
.byte 168,'L
.byte 200,0
.byte 4,3
.byte 0,255
.byte 128,129
.byte 64,64
.byte 33,22
.byte 8,22
.byte 'a,192
.byte 64,0
.byte 0,2
.byte 4,236
.byte 64,32
.byte 248,'O
.byte 'H,'I
.byte 254,'H
.byte 'h,'L
.byte 8,0
.byte 2,2
.byte 127,0
.byte 0,0
.byte 255,34
.byte 34,34
.byte 63,34
.byte 35,50
.byte 32,0
.byte 0,0
.byte 8,8
.byte 8,8
.byte 8,8
.byte 8,8
.byte 8,12
.byte 8,0
.byte 0,0
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,24
.byte 16,0
.byte 128,130
.byte 130,130
.byte 254,130
.byte 130,130
.byte 130,130
.byte 254,130
.byte 131,194
.byte 128,0
.byte 0,128
.byte 64,48
.byte 15,0
.byte 0,0
.byte 0,0
.byte 255,0
.byte 0,0
.byte 0,0
.byte 16,16
.byte 240,31
.byte 16,240
.byte 64,96
.byte 'X,'G
.byte 64,64
.byte 'P,96
.byte 192,0
.byte 64,34
.byte 21,8
.byte 22,'a
.byte 0,254
.byte 'B,'B
.byte 'B,'B
.byte 'B,255
.byte 2,0
.byte 0,4
.byte 4,4
.byte 4,4
.byte 4,252
.byte 4,4
.byte 4,4
.byte 6,4
.byte 0,0
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,63
.byte 32,32
.byte 32,32
.byte 32,48
.byte 32,0
.byte 128,64
.byte 32,248
.byte 135,64
.byte 48,15
.byte 248,136
.byte 136,200
.byte 136,12
.byte 8,0
.byte 0,0
.byte 0,255
.byte 0,0
.byte 0,0
.byte 255,8
.byte 8,8
.byte 12,8
.byte 0,0
.byte 16,12
.byte 4,36
.byte 36,36
.byte 37,38
.byte 36,36
.byte 52,36
.byte 132,20
.byte 12,0
.byte 0,129
.byte 129,'A
.byte 49,15
.byte 1,1
.byte 63,'A
.byte 'A,'A
.byte 'A,'A
.byte 'p,0
.byte 0,128
.byte 255,136
.byte 'H,'H
.byte 40,0
.byte 127,136
.byte 136,132
.byte 132,224
.byte 0,0
.byte 4,4
.byte 5,4
.byte 4,4
.byte 4,255
.byte 4,4
.byte 4,4
.byte 4,6
.byte 4,0
.byte 0,2
.byte 242,'B
.byte 'B,'B
.byte 'B,'B
.byte 'B,'B
.byte 'B,255
.byte 2,0
.byte 0,0
.byte 0,0
.byte 63,64
.byte 64,64
.byte 64,64
.byte 64,64
.byte 64,64
.byte 64,'x
.byte 0,0
.byte 16,33
.byte 'b,6
.byte 36,36
.byte 36,239
.byte 36,36
.byte 239,36
.byte 52,166
.byte 4,0
.byte 4,4
.byte 254,1
.byte 255,17
.byte 9,7
.byte 9,9
.byte 7,'I
.byte 145,127
.byte 1,0
.byte 16,16
.byte 208,255
.byte 16,'P
.byte 32,'P
.byte 'L,'C
.byte 'L,'P
.byte 32,96
.byte 32,0
.byte 4,3
.byte 0,255
.byte 'A,'B
.byte 'B,92
.byte 64,95
.byte 64,'P
.byte 'N,'d
.byte 64,0
.byte 0,248
.byte 8,8
.byte 8,8
.byte 8,255
.byte 8,8
.byte 8,8
.byte 8,252
.byte 8,0
.byte 0,3
.byte 1,1
.byte 1,1
.byte 1,255
.byte 1,1
.byte 1,1
.byte 1,3
.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 0,0
.byte 0,0
.byte 51,51
.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 0,0
.byte 28,254
.byte 254,28
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,51
.byte 51,0
.byte 0,0
.byte 0,0
.byte 0,0
.dbfile C:\icc\project\LCD\code.c
.dbsym s TAB _TAB A[2272:71:32]c
.area text(rom, con, rel)
.dbfile C:\icc\project\LCD\code.c
.dbfile C:\icc\project\LCD\lcd.c
.dbfunc s WriInsn _WriInsn fI
; state -> R20
; command -> R16
.even
_WriInsn::
rcall push_gset1
.dbline -1
.dbline 34
; #include<io8515.h>
; //*********************************************
; //**the data port,use the port a,if donot change it
; #define Db PORTA
; #define DbIn PINA
; #define DbDir DDRA
; //** DB0--PA0 DB1--PA1 DB2--PA2 DB3--PA3 DB4--PA4
; //** DB5--PA5 DB6--PA6 DB7--PA7
; //*****************************************************
; //**the contral port,use the port c,if not change it
; #define ContrPort PORTC
; #define ContrIn PINC
; #define ContrDir DDRC
; //**D_I--PC0
; #define D_I 0b00000001
; //**R_W--PC1
; #define R_W 0b00000010
; //**E--PC4
; #define E 0b00010000
; //**CS1--PC7
; #define CS1 0b10000000
; //**CS2--PC6
; #define CS2 0b01000000
; //**RESET--PC5
; #define RESET 0b00100000
; #define All 0b11110011
; //*******************************************************
; /* 1 vss 2 vdd 3 vo 4 d\i 5 r\w 6 e 7 db0
; 8 db1 9 db2 10 db3 11 db4 12 db5 13 db6 14 db7
; 15 cs1 16 cs2 17 reset 18 vee 19 a 20 k */
; //*********************************************************
; #include"C:\icc\project\LCD\code.c"
; void WriInsn(unsigned char command)
; { unsigned char state;
.dbline 35
; ContrDir=ContrDir|All;//set the direction out
in R24,0x14
ori R24,243
out 0x14,R24
.dbline 36
; ContrPort=ContrPort&~D_I;//D_I=0
cbi 0x15,0
.dbline 37
; ContrPort=ContrPort|R_W;//R_w=1
sbi 0x15,1
.dbline 38
; DbDir=0b00000000;//data input module
clr R2
out 0x1a,R2
L2:
.dbline 40
; do
; {ContrPort=ContrPort|E;//E=1,read the status;
.dbline 40
sbi 0x15,4
.dbline 41
; state=DbIn;//status trans to state
in R20,0x19
.dbline 42
; ContrPort=ContrPort&~E;}//E=0,
cbi 0x15,4
.dbline 42
L3:
.dbline 43
; while(state&0b10000000);//if "busy"
sbrc R20,7
rjmp L2
.dbline 44
; ContrPort=ContrPort&~R_W;//R_w=0
cbi 0x15,1
.dbline 45
; DbDir=0b11111111;//data output module
ldi R24,255
out 0x1a,R24
.dbline 46
; Db=command;
out 0x1b,R16
.dbline 47
; ContrPort=ContrPort|E;//E=1
sbi 0x15,4
.dbline 48
; ContrPort=ContrPort&~E;//E=0,
cbi 0x15,4
.dbline -2
.dbline 50
;
; }
L1:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r state 20 c
.dbsym r command 16 c
.dbfunc s WriData _WriData fI
; state -> R20
; WriData -> R16
.even
_WriData::
rcall push_gset1
.dbline -1
.dbline 53
; //*********************************************************
; void WriData(unsigned char WriData)
; { unsigned char state;
.dbline 54
; ContrDir=ContrDir|All;//set the direction out
in R24,0x14
ori R24,243
out 0x14,R24
.dbline 55
; ContrPort=ContrPort&~D_I;//D_I=0
cbi 0x15,0
.dbline 56
; ContrPort=ContrPort|R_W;//R_w=1
sbi 0x15,1
.dbline 57
; DbDir=0b00000000;//data input module
clr R2
out 0x1a,R2
L6:
.dbline 59
; do
; {ContrPort=ContrPort|E;//E=1,read the status;
.dbline 59
sbi 0x15,4
.dbline 60
; state=DbIn;//status trans to state
in R20,0x19
.dbline 61
; ContrPort=ContrPort&~E;}//E=0,
cbi 0x15,4
.dbline 61
L7:
.dbline 62
; while(state&0b10000000);//if "busy"
sbrc R20,7
rjmp L6
.dbline 63
; ContrPort=ContrPort|D_I;//D_I=1
sbi 0x15,0
.dbline 64
; ContrPort=ContrPort&~R_W;//R_w=0
cbi 0x15,1
.dbline 65
; DbDir=0b11111111;
ldi R24,255
out 0x1a,R24
.dbline 66
; Db=WriData;
out 0x1b,R16
.dbline 67
; ContrPort=ContrPort|E;//E=1
sbi 0x15,4
.dbline 68
; ContrPort=ContrPort&~E;//E=0,
cbi 0x15,4
.dbline -2
.dbline 69
; }
L5:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r state 20 c
.dbsym r WriData 16 c
.dbfunc s ClearRam _ClearRam fI
; Clear_page -> R20
; Clear_Y -> R22
.even
_ClearRam::
rcall push_gset2
.dbline -1
.dbline 92
; /************************************************************
; unsigned char Readdata(void)
; { unsigned char state,ReadData;
; ContrDir=ContrDir|All;//set the direction out
; ContrPort=ContrPort&~D_I;//D_I=0
; ContrPort=ContrPort|R_W;//R_w=1
; DbDir=0b00000000;//data input module
; do
; {ContrPort=ContrPort|E;//E=1,read the status;
; state=DbIn;//status trans to state
; ContrPort=ContrPort&~E;}//E=0,
; while(state&0b10000000);//if "busy"
; ContrPort=ContrPort|D_I;//D_I=1
; ContrPort=ContrPort|E;//E=1
; ReadData=PINA;
; ContrPort=ContrPort&~E;//E=0,
; DbDir=0b11111111;
; return(ReadData);
; } */
; //************************************************************
; //**clear CGRAM**********
; void ClearRam(void)
; {
.dbline 95
; unsigned char Clear_page,Clear_Y;
; //***************************************************
; ContrPort=ContrPort|CS1; //cs1=1
sbi 0x15,7
.dbline 96
; ContrPort=ContrPort&~CS2;//cs2=0
cbi 0x15,6
.dbline 97
; Clear_page=8;
ldi R20,8
rjmp L11
L10:
.dbline 99
; while(Clear_page)
; {
.dbline 100
; Clear_Y=64;
ldi R22,64
rjmp L14
L13:
.dbline 102
.dbline 104
mov R16,R20
subi R16,1
subi R16,72 ; addi 184
rcall _WriInsn
.dbline 105
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -