📄 display.s
字号:
.byte 3,0
.byte 181,218
.byte 4,234
.byte 171,174
.byte 170,252
.byte 170,171
.byte 174,186
.byte 130,0
.byte 4,4
.byte 2,1
.byte 0,7
.byte 0,2
.byte 2,2
.byte 1,0
.byte 210,187
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,48
.byte 32,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 208,208
.byte 'H,36
.byte 243,8
.byte 9,9
.byte 9,9
.byte 249,9
.byte 8,0
.byte 0,0
.byte 7,0
.byte 0,4
.byte 4,4
.byte 7,0
.byte 0,0
.byte 182,254
.byte 0,4
.byte 4,4
.byte 4,4
.byte 4,4
.byte 6,4
.byte 0,0
.byte 2,2
.byte 2,2
.byte 2,2
.byte 2,2
.byte 2,2
.byte 2,0
.byte 200,253
.byte 0,2
.byte 34,34
.byte 34,34
.byte 34,34
.byte 35,2
.byte 0,0
.byte 4,4
.byte 4,4
.byte 4,4
.byte 4,4
.byte 4,6
.byte 4,0
.byte 203,196
.byte 0,255
.byte 129,'A
.byte 63,1
.byte 1,255
.byte 129,129
.byte 255,0
.byte 0,7
.byte 2,2
.byte 2,2
.byte 2,2
.byte 2,2
.byte 7,0
.byte 206,229
.byte 0,17
.byte 17,145
.byte 127,17
.byte 17,17
.byte 241,1
.byte 0,0
.byte 4,4
.byte 4,7
.byte 4,4
.byte 4,4
.byte 7,4
.byte 4,0
.dbstruct 0 26 typFNT_GB16
.dbfield 0 Index A[2:2]c
.dbfield 2 Msk A[24:24]c
.dbend
.dbsym e GB_16 _GB_16 A[468:18]kS[typFNT_GB16]
.area text(rom, con, rel)
.dbfile E:\PROTEU~1.7\User\MEGA32-LCM\MEGA32-LCM\DISPLAY.C
.dbfunc e GetPage _GetPage fc
.even
_GetPage::
.dbline -1
.dbline 295
;
; //ASCII 字模宽度及高度
; #define ASC_CHR_WIDTH 8
; #define ASC_CHR_HEIGHT 12
;
; typedef struct typFNT_ASC16 /* 汉字字模显示数据结构 */
; {
; char Index[1];
; char Msk[16];
; };
; const struct typFNT_ASC16 ASC_16[] =
; { /* 显示为8*16 Curier 10 常规*/
; "1",0x00,0x00,0x08,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x07,0x04,0x04,0x00,
; "2",0x00,0x00,0x08,0x04,0x84,0x44,0x38,0x00,0x00,0x00,0x06,0x05,0x04,0x04,0x04,0x00,
; "3",0x00,0x00,0x08,0x04,0x44,0x44,0xB8,0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x03,0x00,
; "4",0x00,0x00,0x80,0x60,0x18,0xFC,0x00,0x00,0x00,0x00,0x01,0x01,0x05,0x07,0x05,0x00,
; "5",0x00,0x00,0x7C,0x44,0x44,0x44,0x84,0x00,0x00,0x00,0x02,0x04,0x04,0x04,0x03,0x00,
; "6",0x00,0x00,0xF0,0x48,0x44,0x44,0x80,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,
; "7",0x00,0x00,0x0C,0x04,0x84,0x64,0x1C,0x00,0x00,0x00,0x00,0x06,0x01,0x00,0x00,0x00,
; "8",0x00,0x00,0xB8,0x44,0x44,0x44,0xB8,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,
; "9",0x00,0x00,0x38,0x44,0x44,0x44,0xF8,0x00,0x00,0x00,0x00,0x04,0x04,0x02,0x01,0x00,
; "0",0x00,0x00,0xF8,0x04,0x04,0x04,0xF8,0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x00,
; ".",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
; ",",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,
; ":",0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
; ";",0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00,
; "-",0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; "_",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
; "A",0x00,0x00,0x80,0x64,0x1C,0x60,0x80,0x00,0x00,0x04,0x07,0x05,0x01,0x05,0x07,0x04,
; "B",0x00,0x04,0xFC,0x44,0x44,0x44,0x44,0xB8,0x00,0x04,0x07,0x04,0x04,0x04,0x04,0x03,
; "C",0x00,0xF0,0x08,0x04,0x04,0x04,0x04,0x08,0x00,0x01,0x02,0x04,0x04,0x04,0x04,0x02,
; "D",0x00,0x04,0xFC,0x04,0x04,0x04,0x08,0xF0,0x00,0x04,0x07,0x04,0x04,0x04,0x02,0x01,
; "E",0x00,0x04,0xFC,0x44,0x44,0xE4,0x04,0x0C,0x00,0x04,0x07,0x04,0x04,0x04,0x04,0x06,
; "F",0x00,0x04,0xFC,0x44,0x44,0xE4,0x04,0x0C,0x00,0x04,0x07,0x04,0x04,0x00,0x00,0x00,
; " ",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; "=",0x00,0x00,0xA0,0xA0,0xA0,0xA0,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; "(",0x00,0x00,0x00,0xE0,0x18,0x04,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x10,0x00,0x00,
; ")",0x00,0x00,0x00,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x00,0x10,0x0C,0x03,0x00,0x00,
; "V",0x00,0x04,0x3C,0xC4,0x00,0xC4,0x3C,0x04,0x00,0x00,0x00,0x01,0x06,0x01,0x00,0x00,
; "m",0x00,0x20,0xE0,0x20,0xC0,0x20,0xC0,0x00,0x00,0x04,0x07,0x00,0x07,0x00,0x07,0x04,
; "H",0x00,0x04,0xFC,0x44,0x40,0x44,0xFC,0x04,0x00,0x04,0x07,0x04,0x00,0x04,0x07,0x04,
; "*",0x90,0x90,0x60,0xFC,0x60,0x90,0x90,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,
; };
;
; #define ASC_HZ_WIDTH 12
; //#define ASC_HZ_HEIGHT 12
;
; typedef struct typFNT_GB16 /*12*16 汉字字模显示数据结构 */
; {
; char Index[2];
; char Msk[24];
; };
; const struct typFNT_GB16 GB_16[] = { /* 宋体 9 显示为12*16 */
; "科",0x8A,0x6A,0xFE,0x29,0x49,0x80,0x92,0xA4,0x80,0xFF,0x40,0x00,0x01,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,
; "技",0x44,0x44,0xFF,0x24,0x00,0x64,0xA4,0x3F,0xA4,0x64,0x04,0x00,0x04,0x04,0x07,0x00,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x00,
; "有",0x42,0x22,0x12,0xFA,0x4E,0x4B,0x4A,0x4A,0xFA,0x02,0x02,0x00,0x00,0x00,0x00,0x07,0x01,0x01,0x01,0x05,0x07,0x00,0x00,0x00,
; "限",0xFF,0x81,0x99,0xE7,0x00,0xFF,0x25,0xE5,0x25,0xBF,0x40,0x00,0x07,0x00,0x00,0x00,0x00,0x07,0x04,0x02,0x01,0x02,0x04,0x00,
; "公",0x20,0x10,0x08,0x07,0xC0,0x30,0x83,0x0C,0x10,0x20,0x20,0x00,0x00,0x04,0x06,0x05,0x04,0x04,0x02,0x03,0x06,0x00,0x00,0x00,
; "司",0x08,0x09,0xE9,0x29,0x29,0x29,0xED,0x09,0x01,0xFF,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x04,0x04,0x07,0x00,0x00,
; "液",0x19,0xE2,0x14,0x42,0xF2,0x2E,0x72,0x8F,0xAA,0x7A,0x02,0x00,0x01,0x07,0x00,0x00,0x07,0x04,0x04,0x02,0x01,0x02,0x04,0x00,
; "晶",0x00,0xC0,0x40,0x5F,0xD5,0x15,0xD5,0x55,0x5F,0x40,0xC0,0x00,0x00,0x07,0x05,0x05,0x07,0x00,0x07,0x05,0x05,0x05,0x07,0x00,
; "显",0x00,0x40,0x9F,0x15,0xD5,0x15,0xD5,0x15,0x1F,0xC0,0x00,0x00,0x04,0x04,0x05,0x04,0x07,0x04,0x07,0x06,0x05,0x04,0x04,0x00,
; "示",0x10,0x12,0x92,0x52,0x12,0xF2,0x12,0x12,0x53,0x92,0x10,0x00,0x02,0x01,0x00,0x04,0x04,0x07,0x00,0x00,0x00,0x00,0x03,0x00,
; "的",0xFC,0x44,0x46,0x45,0xFC,0x10,0x2C,0xC7,0x04,0x04,0xFC,0x00,0x07,0x02,0x02,0x02,0x07,0x00,0x00,0x04,0x04,0x04,0x03,0x00,
; "第",0x04,0xEA,0xAB,0xAE,0xAA,0xFC,0xAA,0xAB,0xAE,0xBA,0x82,0x00,0x04,0x04,0x02,0x01,0x00,0x07,0x00,0x02,0x02,0x02,0x01,0x00,
; "一",0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; "行",0x48,0x24,0xF3,0x08,0x09,0x09,0x09,0x09,0xF9,0x09,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x04,0x04,0x04,0x07,0x00,0x00,0x00,
; "二",0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x06,0x04,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,
; "三",0x00,0x02,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x02,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x06,0x04,0x00,
; "四",0x00,0xFF,0x81,0x41,0x3F,0x01,0x01,0xFF,0x81,0x81,0xFF,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x07,0x00,
; "五",0x00,0x11,0x11,0x91,0x7F,0x11,0x11,0x11,0xF1,0x01,0x00,0x00,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x04,0x07,0x04,0x04,0x00,
; };
;
; unsigned char GetPage(void) /*得到当前页*/
; {
.dbline 296
; return CurPage;
lds R16,_CurPage
.dbline -2
L43:
.dbline 0 ; func end
ret
.dbend
.dbfunc e GetCol _GetCol fc
.even
_GetCol::
.dbline -1
.dbline 300
; }
;
; unsigned char GetCol(void) /*得到当前列*/
; {
.dbline 301
; return CurCol;
lds R16,_CurCol
.dbline -2
L44:
.dbline 0 ; func end
ret
.dbend
.dbfunc e SetPageCol _SetPageCol fV
; ucol -> R20
; upage -> R22
.even
_SetPageCol::
xcall push_gset2
mov R20,R18
mov R22,R16
.dbline -1
.dbline 305
; }
;
; void SetPageCol(unsigned char upage, unsigned char ucol) /* 设置液晶的页和列 */
; {
.dbline 306
; CurPage = upage;
sts _CurPage,R22
.dbline 307
; CurCol = ucol;
sts _CurCol,R20
.dbline 308
; if(ucol<64)
cpi R20,64
brsh L46
.dbline 309
; {
.dbline 310
; set_page_L(upage);
mov R16,R22
xcall _set_page_L
.dbline 311
; set_col_addr_L(ucol);
mov R16,R20
xcall _set_col_addr_L
.dbline 312
; }
xjmp L47
L46:
.dbline 314
.dbline 315
mov R16,R22
xcall _set_page_R
.dbline 316
mov R16,R20
subi R16,64
xcall _set_col_addr_R
.dbline 317
L47:
.dbline -2
.dbline 318
; else
; {
; set_page_R(upage);
; set_col_addr_R(ucol-64);
; }
; }
L45:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r ucol 20 c
.dbsym r upage 22 c
.dbend
.dbfunc e SetRowCol _SetRowCol fV
; page -> R20
; ucol -> R22
; urow -> R20
.even
_SetRowCol::
xcall push_gset2
mov R22,R18
mov R20,R16
.dbline -1
.dbline 322
;
; /* 设置当前显示的页和列 */
; void SetRowCol(unsigned char urow, unsigned char ucol)
; {
.dbline 324
; unsigned char page;
; CurRow = urow;
sts _CurRow,R20
.dbline 325
; CurCol = ucol;
sts _CurCol,R22
.dbline 327
;
; switch(urow)
clr R21
cpi R20,1
ldi R30,0
cpc R21,R30
breq L52
cpi R20,2
ldi R30,0
cpc R21,R30
breq L53
cpi R20,3
ldi R30,0
cpc R21,R30
breq L54
cpi R20,4
ldi R30,0
cpc R21,R30
breq L55
cpi R20,5
ldi R30,0
cpc R21,R30
breq L56
xjmp L49
X0:
.dbline 328
; {
L52:
.dbline 330
; case 1:
; page=0;
clr R20
.dbline 331
; CurOffset=1;
ldi R24,1
sts _CurOffset,R24
.dbline 332
; break;
xjmp L50
L53:
.dbline 334
; case 2:
; page=1;
ldi R20,1
.dbline 335
; CurOffset=2;
ldi R24,2
sts _CurOffset,R24
.dbline 336
; break;
xjmp L50
L54:
.dbline 338
; case 3:
; page=3;
ldi R20,3
.dbline 339
; CurOffset=1;
ldi R24,1
sts _CurOffset,R24
.dbline 340
; break;
xjmp L50
L55:
.dbline 342
; case 4:
; page=4;
ldi R20,4
.dbline 343
; CurOffset=2;
ldi R24,2
sts _CurOffset,R24
.dbline 344
; break;
xjmp L50
L56:
.dbline 346
; case 5:
; page=6;
ldi R20,6
.dbline 347
; CurOffset=1;
ldi R24,1
sts _CurOffset,R24
.dbline 348
; break;
L49:
L50:
.dbline 350
; }
; SetPageCol(page,ucol);
mov R18,R22
mov R16,R20
xcall _SetPageCol
.dbline -2
.dbline 351
; }
L48:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r page 20 c
.dbsym r ucol 22 c
.dbsym r urow 20 c
.dbend
.dbfunc e disp_ch _disp_ch fV
; width -> R22
; len -> R22
; uPage -> y+2
; ch_r -> R10
; uCol -> y+1
; ch_w -> R14
; k -> R20
; j -> R12
; c -> R10
.even
_disp_ch::
xcall push_gset5
mov R10,R16
sbiw R28,3
.dbline -1
.dbline 354
;
; void disp_ch(unsigned char c)
; {
.dbline 358
; unsigned char k,j,uPage,uCol,ch_r,ch_w;
; unsigned char width;
; unsigned char len;
; uPage = GetPage();
xcall _GetPage
std y+2,R16
.dbline 359
; uCol = GetCol();
xcall _GetCol
std y+1,R16
.dbline 360
; len=sizeof(ASC_16)/sizeof(ASC_16[0]);
ldi R22,30
.dbline 361
; for(k=0;k<len;k++)
clr R20
xjmp L61
L58:
.dbline 362
; {
.dbline 363
; if(c == ASC_16[k].Index[0] ) break;
ldi R24,17
mul R24,R20
movw R30,R0
ldi R24,<_ASC_16
ldi R25,>_ASC_16
add R30,R24
adc R31,R25
lpm R30,Z
cp R10,R30
brne L62
.dbline 363
xjmp L60
L62:
.dbline 364
L59:
.dbline 361
inc R20
L61:
.dbline 361
cp R20,R22
brlo L58
L60:
.dbline 365
; }
; if(k<len)
cp R20,R22
brlo X1
xjmp L64
X1:
.dbline 366
; {
.dbline 368
;
; if(c=='-'||c==':')
mov R24,R10
cpi R24,45
breq L68
cpi R24,58
brne L66
L68:
.dbline 369
; width=ASC_CHR_WIDTH-2;
ldi R22,6
xjmp L67
L66:
.dbline 370
; else if(c=='|')
mov R24,R10
cpi R24,124
brne L69
.dbline 371
; width=ASC_HZ_WIDTH-ASC_CHR_WIDTH;
ldi R22,4
xjmp L70
L69:
.dbline 373
; else
; width=ASC_CHR_WIDTH;
ldi R22,8
L70:
L67:
.dbline 375
;
; if(CurOffset==1) //下半部是写半个字节
lds R24,_CurOffset
cpi R24,1
breq X2
xjmp L71
X2:
.dbline 376
; {
.dbline 377
; for(j=0;j<width;j++)
clr R12
xjmp L76
L73:
.dbline 378
; {
.dbline 379
; SetPageCol(uPage,uCol+j);
ldd R18,y+1
add R18,R12
ldd R16,y+2
xcall _SetPageCol
.dbline 380
; ch_w=ASC_16[k].Msk[j];
ldi R24,17
mul R24,R20
movw R2,R0
ldi R24,<_ASC_16+1
ldi R25,>_ASC_16+1
add R2,R24
adc R3,R25
mov R30,R12
clr R31
add R30,R2
adc R31,R3
lpm R14,Z
.dbline 381
; if(uCol+j<64) write_LCD(LEFT,DATA,ch_w);
ldd R24,y+1
add R24,R12
cpi R24,64
brsh L78
.dbline 381
std y+0,R14
ldi R18,1
clr R16
xcall _write_LCD
xjmp L79
L78:
.dbline 382
; else write_LCD(RIGHT,DATA,ch_w);
std y+0,R14
ldi R18,1
ldi R16,1
xcall _write_LCD
L79:
.dbline 383
L74:
.dbline 377
inc R12
L76:
.dbline 377
cp R12,R22
brlo L73
.dbline 384
; }
; SetPageCol(uPage+1,uCol);
ldd R18,y+1
ldd R16,y+2
subi R16,255 ; addi 1
xcall _SetPageCol
.dbline 386
;
; for(j=0;j<width;j++)
clr R12
xjmp L83
L80:
.dbline 387
; {
.dbline 388
; SetPageCol(uPage+1,uCol+j);
ldd R18,y+1
add R18,R12
ldd R16,y+2
subi R16,255 ; addi 1
xcall _SetPageCol
.dbline 389
; if(uCol+j<64) ch_r=read_LCD(LEFT);
ldd R24,y+1
add R24,R12
cpi R24,64
brsh L84
.dbline 389
clr R16
xcall _read_LCD
mov R10,R16
xjmp L85
L84:
.dbline 390
; else ch_r=read_LCD(RIGHT);
ldi R16,1
xcall _read_LCD
mov R10,R16
L85:
.dbline 391
; ch_r&=0xf0;
mov R24,R10
andi R24,240
mov R10,R24
.dbline 392
; ch_w=ASC_16[k].Msk[ASC_CHR_WIDTH+j]&0x0f;
ldi R24,17
mul R24,R20
movw R2,R0
ldi R24,<_ASC_16+1
ldi R25,>_ASC_16+1
add R2,R24
adc R3,R25
mov R30,R12
clr R31
adiw R30,8
add R30,R2
adc R31,R3
lpm R30,Z
andi R30,15
mov R14,R30
.dbline 393
; ch_w|=ch_r;
or R14,R10
.dbline 394
; SetPageCol(uPage+1,uCol+j);
ldd R18,y+1
add R18,R12
ldd R16,y+2
subi R16,255 ; addi 1
xcall _SetPageCol
.dbline 395
; if(uCol+j<64) write_LCD(LEFT,DATA,ch_w);
ldd R24,y+1
add R24,R12
cpi R24,64
brsh L87
.dbline 395
std y+0,R14
ldi R18,1
clr R16
xcall _write_LCD
xjmp L88
L87:
.dbline 396
; else write_LCD(RIGHT,DATA,ch_w);
std y+0,R14
ldi R18,1
ldi R16,1
xcall _write_LCD
L88:
.dbline 397
L81:
.dbline 386
inc R12
L83:
.dbline 386
cp R12,R22
brsh X3
xjmp L80
X3:
.dbline 398
; }
; }
xjmp L72
L71:
.dbline 400
; else //上半部是写半个字节
; {
.dbline 401
; for(j=0;j<width;j++)
clr R12
xjmp L92
L89:
.dbline 402
; {
.dbline 403
; SetPageCol(uPage,uCol+j);
ldd R18,y+1
add R18,R12
ldd R16,y+2
xcall _SetPageCol
.dbline 404
; if(uCol+j<64) ch_r=read_LCD(LEFT);
ldd R24,y+1
add R24,R12
cpi R24,64
brsh L93
.dbline 404
clr R16
xcall _read_LCD
mov R10,R16
xjmp L94
L93:
.dbline 405
; else ch_r=read_LCD(RIGHT);
ldi R16,1
xcall _read_LCD
mov R10,R16
L94:
.dbline 406
; ch_r&=0x0f;
mov R24,R10
andi R24,15
mov R10,R24
.dbline 407
; ch_w=ASC_16[k].Msk[j];
ldi R24,17
mul R24,R20
movw R2,R0
ldi R24,<_ASC_16+1
ldi R25,>_ASC_16+1
add R2,R24
adc R3,R25
mov R30,R12
clr R31
add R30,R2
adc R31,R3
lpm R14,Z
.dbline 408
; ch_w=ch_w<<4;
mov R24,R14
andi R24,#0x0F
swap R24
mov R14,R24
.dbline 409
; ch_w|=ch_r;
or R14,R10
.dbline 410
; SetPageCol(uPage,uCol+j);
ldd R18,y+1
add R18,R12
ldd R16,y+2
xcall _SetPageCol
.dbline 411
; if(uCol+j<64) write_LCD(LEFT,DATA,ch_w);
ldd R24,y+1
add R24,R12
cpi R24,64
brsh L96
.dbline 411
std y+0,R14
ldi R18,1
clr R16
xcall _write_LCD
xjmp L97
L96:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -