📄 lcd1286418.s
字号:
xjmp L31
L32:
.dbline 242
; else
; return 1;
ldi R16,1
.dbline -2
L31:
.dbline 0 ; func end
ld R22,y+
ld R20,y+
ret
.dbsym r temp2 20 c
.dbsym r temp1 22 c
.dbend
.dbfunc e LcdClr _LcdClr fV
; count -> R20
; temp -> R22
.even
_LcdClr::
st -y,R20
st -y,R22
.dbline -1
.dbline 250
; }
;
; /*****************************************
; * FUNCTION NAME: LcdClr
; * DESCRIPTION: CLEAR LCD
; /*****************************************/
; void LcdClr(void)
; {
.dbline 254
; unsigned char count;
; unsigned char temp;
; /* CLEAR LEFT&RIGHT SCREEN */
; LcdWrCmd('B',0X3E); /* LCD OFF */
ldi R18,62
ldi R16,66
xcall _LcdWrCmd
.dbline 255
; LcdWrCmd('B',0XC0); /* SET ROW */
ldi R18,192
ldi R16,66
xcall _LcdWrCmd
.dbline 256
; for(count=0; count<8; count++)
clr R20
xjmp L38
L35:
.dbline 257
; {
.dbline 258
; LcdWrCmd('B',0XB8+count); /* SET PAGE */
mov R18,R20
subi R18,72 ; addi 184
ldi R16,66
xcall _LcdWrCmd
.dbline 259
; LcdWrCmd('B',0X40); /* SET Y */
ldi R18,64
ldi R16,66
xcall _LcdWrCmd
.dbline 260
; for(temp=0; temp<64; temp++)
clr R22
xjmp L42
L39:
.dbline 261
; {
.dbline 262
; LcdWrDat('B',0X00);
clr R18
ldi R16,66
xcall _LcdWrDat
.dbline 263
; }
L40:
.dbline 260
inc R22
L42:
.dbline 260
cpi R22,64
brlo L39
X12:
.dbline 264
; }
L36:
.dbline 256
inc R20
L38:
.dbline 256
cpi R20,8
brlo L35
X13:
.dbline 265
; LcdWrCmd('B',0X3F); /* LCD ON */
ldi R18,63
ldi R16,66
xcall _LcdWrCmd
.dbline -2
L34:
.dbline 0 ; func end
ld R22,y+
ld R20,y+
ret
.dbsym r count 20 c
.dbsym r temp 22 c
.dbend
.dbfunc e LcdDisplaySeg _LcdDisplaySeg fV
; data -> R10
; offset -> R20
; page -> R22
.even
_LcdDisplaySeg::
xcall push_xgsetF00C
mov R20,R18
mov R22,R16
ldd R10,y+6
.dbline -1
.dbline 278
; }
;
; /*****************************************
; * FUNCTION NAME: LcdDisplaySeg
; * DESCRIPTION: DISPLAY 8-BIT SEGMENT
; * <---------offset 0 to 127----------->
; * page0
; * |
; * page7
; * <---------offset 0 to 127----------->
; /*****************************************/
; void LcdDisplaySeg(unsigned char page,unsigned char offset,unsigned char data)
; {
.dbline 280
; /* Display at Left Part */
; if(offset < 64)
cpi R20,64
brsh L44
X14:
.dbline 281
; {
.dbline 283
; //LcdWrCmd('L',0X3F); /* LCD ON */
; LcdWrCmd('L',0XC0); /* SET ROW */
ldi R18,192
ldi R16,76
xcall _LcdWrCmd
.dbline 284
; LcdWrCmd('L',0XB8+page); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,76
xcall _LcdWrCmd
.dbline 285
; LcdWrCmd('L',0X40+offset); /* SET Y */
mov R18,R20
subi R18,192 ; addi 64
ldi R16,76
xcall _LcdWrCmd
.dbline 286
; LcdWrDat('L',data); /* WRITE SEGMENT */
mov R18,R10
ldi R16,76
xcall _LcdWrDat
.dbline 287
; }
xjmp L45
L44:
.dbline 289
; else
; {
.dbline 290
; LcdWrCmd('R',0X3F); /* LCD ON */
ldi R18,63
ldi R16,82
xcall _LcdWrCmd
.dbline 291
; LcdWrCmd('R',0XC0); /* SET ROW */
ldi R18,192
ldi R16,82
xcall _LcdWrCmd
.dbline 292
; LcdWrCmd('R',0XB8+page); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,82
xcall _LcdWrCmd
.dbline 293
; LcdWrCmd('R',0X40+offset-64); /* SET Y */
mov R18,R20
subi R18,192 ; addi 64
subi R18,64
ldi R16,82
xcall _LcdWrCmd
.dbline 294
; LcdWrDat('R',data); /* WRITE SEGMENT */
mov R18,R10
ldi R16,82
xcall _LcdWrDat
.dbline 295
; }
L45:
.dbline -2
L43:
.dbline 0 ; func end
xjmp pop_xgsetF00C
.dbsym r data 10 c
.dbsym r offset 20 c
.dbsym r page 22 c
.dbend
.dbfunc e LcdDisplayDot _LcdDisplayDot fV
; temp2 -> R12
; temp1 -> R22
; a -> R10
; data -> R14
; y -> R10
; x -> y+10
.even
_LcdDisplayDot::
xcall push_arg4
xcall push_xgsetF0FC
mov R10,R18
ldd R14,y+14
.dbline -1
.dbline 309
; }
;
; /************************************************
; * FUNCTION NAME: LcdDisplayDot
; * DESCRIPTION: DISPLAY 1-BIT DOT
; * 不在单片机里面开设缓存,直接修改LCD的RAM后显示
; * <---------offset 0 to 127----------->
; * 0
; * |
; * 64
; * <---------offset 0 to 127----------->
; /*************************************************/
; void LcdDisplayDot(unsigned char x,unsigned char y,unsigned char data)
; {
.dbline 311
; unsigned char temp1,temp2,a;
; if(x>127 | y>63)
ldi R24,127
ldd R0,y+10
cp R24,R0
brsh L49
X15:
ldi R22,1
ldi R23,0
xjmp L50
L49:
clr R22
clr R23
L50:
ldi R24,63
cp R24,R10
brsh L51
X16:
ldi R20,1
ldi R21,0
xjmp L52
L51:
clr R20
clr R21
L52:
movw R2,R22
or R2,R20
or R3,R21
tst R2
brne X17
tst R3
breq L47
X17:
.dbline 312
; return;
xjmp L46
L47:
.dbline 313
; temp1 = y / 8; /* GET VALUE OF WHICH PAGE */
mov R22,R10
lsr R22
lsr R22
lsr R22
.dbline 314
; temp2 = y % 8; /* GET VALUE OF WHICH Y-OFFSET */
ldi R17,8
mov R16,R10
xcall mod8u
mov R12,R16
.dbline 316
; /* IN ORDER TO NOT MODFIY NOW DISPLY VALUE */
; if(x < 64) /* GET PRE. SEGMENT VALUE */
ldd R24,y+10
cpi R24,64
brsh L53
X18:
.dbline 317
; {
.dbline 318
; LcdWrCmd('L',0XC0); /* SET ROW */
ldi R18,192
ldi R16,76
xcall _LcdWrCmd
.dbline 319
; LcdWrCmd('L',0XB8+temp1); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,76
xcall _LcdWrCmd
.dbline 320
; LcdWrCmd('L',0X40+x); /* SET X */
ldd R18,y+10
subi R18,192 ; addi 64
ldi R16,76
xcall _LcdWrCmd
.dbline 321
; a = LcdRdDat('L'); /* READ NOW SEGMENT VALUE */
ldi R16,76
xcall _LcdRdDat
.dbline 322
; a = LcdRdDat('L');
ldi R16,76
xcall _LcdRdDat
mov R10,R16
.dbline 323
; if(data == 0) /* DOT ON/OFF */
tst R14
brne L55
X19:
.dbline 324
; a&=~(1<<temp2);
ldi R16,1
mov R17,R12
xcall lsl8
mov R2,R16
com R2
and R10,R2
xjmp L54
L55:
.dbline 326
; else
; a|=(1<<temp2);
ldi R16,1
mov R17,R12
xcall lsl8
or R10,R16
.dbline 327
; }
xjmp L54
L53:
.dbline 329
; else
; {
.dbline 330
; LcdWrCmd('R',0XC0); /* SET ROW */
ldi R18,192
ldi R16,82
xcall _LcdWrCmd
.dbline 331
; LcdWrCmd('R',0XB8+temp1); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,82
xcall _LcdWrCmd
.dbline 332
; LcdWrCmd('R',0X40+x-64); /* SET X*/
ldd R18,y+10
subi R18,192 ; addi 64
subi R18,64
ldi R16,82
xcall _LcdWrCmd
.dbline 333
; a = LcdRdDat('R'); /* READ NOW SEGMENT VALUE */
ldi R16,82
xcall _LcdRdDat
.dbline 334
; a = LcdRdDat('R');
ldi R16,82
xcall _LcdRdDat
mov R20,R16
mov R10,R20
.dbline 335
; if(data == 0) /* DOT ON/OFF */
tst R14
brne L57
X20:
.dbline 336
; a&=~(1<<temp2);
ldi R16,1
mov R17,R12
xcall lsl8
mov R2,R16
com R2
and R10,R2
xjmp L58
L57:
.dbline 338
; else
; a|=(1<<temp2);
ldi R16,1
mov R17,R12
xcall lsl8
or R10,R16
L58:
.dbline 339
; }
L54:
.dbline 341
;
; if(x < 64) /* WRITE VALUE AS SEGMENT */
ldd R24,y+10
cpi R24,64
brsh L59
X21:
.dbline 342
; {
.dbline 344
; //LcdWrCmd('L',0X3F); /* LCD ON */
; LcdWrCmd('L',0XC0); /* SET ROW */
ldi R18,192
ldi R16,76
xcall _LcdWrCmd
.dbline 345
; LcdWrCmd('L',0XB8+temp1); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,76
xcall _LcdWrCmd
.dbline 346
; LcdWrCmd('L',0X40+x); /* SET X */
ldd R18,y+10
subi R18,192 ; addi 64
ldi R16,76
xcall _LcdWrCmd
.dbline 347
; LcdWrDat('L',a); /* WRITE SEGMENT */
mov R18,R10
ldi R16,76
xcall _LcdWrDat
.dbline 348
; }
xjmp L60
L59:
.dbline 350
; else
; {
.dbline 352
; //LcdWrCmd('R',0X3F); /* LCD ON */
; LcdWrCmd('R',0XC0); /* SET ROW */
ldi R18,192
ldi R16,82
xcall _LcdWrCmd
.dbline 353
; LcdWrCmd('R',0XB8+temp1); /* SET PAGE */
mov R18,R22
subi R18,72 ; addi 184
ldi R16,82
xcall _LcdWrCmd
.dbline 354
; LcdWrCmd('R',0X40+x-64); /* SET X*/
ldd R18,y+10
subi R18,192 ; addi 64
subi R18,64
ldi R16,82
xcall _LcdWrCmd
.dbline 355
; LcdWrDat('R',a); /* WRITE SEGMENT */
mov R18,R10
ldi R16,82
xcall _LcdWrDat
.dbline 356
; }
L60:
.dbline -2
L46:
.dbline 0 ; func end
xcall pop_xgsetF0FC
adiw R28,4
ret
.dbsym r temp2 12 c
.dbsym r temp1 22 c
.dbsym r a 10 c
.dbsym r data 14 c
.dbsym r y 10 c
.dbsym l x 10 c
.dbend
.dbfunc e LcdDsiplayRefresh _LcdDsiplayRefresh fV
; temp1 -> R20
; temp2 -> R22
.even
_LcdDsiplayRefresh::
st -y,R20
st -y,R22
sbiw R28,1
.dbline -1
.dbline 365
; }
;
; /*******************************************************
; * FUNCTION NAME: LcdDsiplayRefresh *
; * DESCRIPTION: 显示内容写入单片机RAM中,再LCD上显示 *
; * 为了提高3D图形显示速度。
; /******************************************************/
; void LcdDsiplayRefresh(void)
; {
.dbline 367
; unsigned char temp1,temp2;
; for(temp1=0; temp1<8; temp1++)
clr R20
xjmp L65
L62:
.dbline 368
; {
.dbline 369
; for(temp2=0; temp2<128; temp2++)
clr R22
xjmp L69
L66:
.dbline 370
; {
.dbline 371
; LcdDisplaySeg(temp1,temp2,displaybuffer[temp1][temp2]);
ldi R24,128
mul R24,R20
movw R2,R0
ldi R24,<_displaybuffer
ldi R25,>_displaybuffer
add R2,R24
adc R3,R25
mov R30,R22
clr R31
add R30,R2
adc R31,R3
ldd R2,z+0
std y+0,R2
mov R18,R22
mov R16,R20
xcall _LcdDisplaySeg
.dbline 372
; }
L67:
.dbline 369
inc R22
L69:
.dbline 369
cpi R22,128
brlo L66
X22:
.dbline 373
; }
L63:
.dbline 367
inc R20
L65:
.dbline 367
cpi R20,8
brlo L62
X23:
.dbline -2
L61:
.dbline 0 ; func end
adiw R28,1
ld R22,y+
ld R20,y+
ret
.dbsym r temp1 20 c
.dbsym r temp2 22 c
.dbend
.dbfunc e Delay1ms _Delay1ms fV
; i -> R16
; temp -> R18,R19
.even
_Delay1ms::
.dbline -1
.dbline 381
; }
;
; /****************************************
; * FUNCTION NAME: Delay1ms *
; * DESCRIPTION: MCU CLOCK=11.0592Mhz *
; /***************************************/
; void Delay1ms(void)
; {
.dbline 384
; unsigned int temp;
; unsigned char i;
; for(i=0;i<10;i++)
clr R16
xjmp L74
L71:
.dbline 385
; {
.dbline 386
; for(temp=20; temp>0;temp--) /* Delay About 1ms */
ldi R18,20
ldi R19,0
xjmp L78
L75:
.dbline 387
; {
.dbline 388
; NOP;
nop
.dbline 389
; }
L76:
.dbline 386
subi R18,1
sbci R19,0
L78:
.dbline 386
cpi R18,0
cpc R18,R19
brne L75
X24:
.dbline 390
; }
L72:
.dbline 384
inc R16
L74:
.dbline 384
cpi R16,10
brlo L71
X25:
.dbline -2
L70:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbsym r temp 18 i
.dbend
.area bss(ram, con, rel)
.dbfile F:\CODE\LCD1286418\lcd1286418.c
_displaybuffer::
.blkb 1024
.dbsym e displaybuffer _displaybuffer A[1024:8:128]c
; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -