📄 ylf240128a.s
字号:
adiw R24,6
add R30,R24
adc R31,R25
std z+0,R22
.dbline 440
L82:
.dbline 436
inc R20
L84:
.dbline 436
cpi R20,5
brsh X1
xjmp L81
X1:
.dbline 441
clr R20
xjmp L90
L87:
.dbline 441
; }
; for(i=0;i<5;i++) { //clear high bit 0
.dbline 442
; if (str[i]==0x30 && i!=4)
movw R24,R28
adiw R24,6
mov R30,R20
clr R31
add R30,R24
adc R31,R25
ldd R24,z+0
cpi R24,48
brne L89
cpi R20,4
breq L89
.dbline 443
; str[i]=0x00;
movw R24,R28
adiw R24,6
mov R30,R20
clr R31
add R30,R24
adc R31,R25
clr R2
std z+0,R2
.dbline 444
; else break;
L92:
.dbline 445
L88:
.dbline 441
inc R20
L90:
.dbline 441
cpi R20,5
brlo L87
L89:
.dbline 446
clr R20
xjmp L96
L93:
.dbline 446
; }
; for(i=0;i<5;i++) {
.dbline 447
; WrCharCode(x,y,AsctoCharCode(str[i]) );
movw R24,R28
adiw R24,6
mov R30,R20
clr R31
add R30,R24
adc R31,R25
ldd R16,z+0
xcall _AsctoCharCode
std y+0,R16
mov R18,R10
ldd R16,y+21
xcall _WrCharCode
.dbline 448
; WrCharCode(x,y+1,0x83);
ldi R24,131
std y+0,R24
mov R18,R10
subi R18,255 ; addi 1
ldd R16,y+21
xcall _WrCharCode
.dbline 449
; if (x<LCDCOLUMN)x++;
ldd R24,y+21
cpi R24,30
brsh L97
.dbline 449
mov R0,R24
inc R0
std y+21,R0
xjmp L98
L97:
.dbline 450
; else {
.dbline 451
; y++;
inc R10
.dbline 452
; x=0;
clr R0
std y+21,R0
.dbline 453
; }
L98:
.dbline 454
L94:
.dbline 446
inc R20
L96:
.dbline 446
cpi R20,5
brlo L93
.dbline -2
L80:
adiw R28,11
xcall pop_gset5
adiw R28,4
.dbline 0 ; func end
ret
.dbsym l str 6 A[5:5]c
.dbsym l g 1 A[5:5]c
.dbsym r i 20 c
.dbsym r numeral 14 i
.dbsym r grade 12 c
.dbsym r y 10 c
.dbsym l x 21 c
.dbend
.dbfunc e WrDefChar _WrDefChar fV
; cgramnum -> R20,R21
; address -> R22,R23
; defcodenum -> y+5
; y -> R22
; x -> R20
.even
_WrDefChar::
xcall push_gset2
mov R22,R18
mov R20,R16
sbiw R28,1
.dbline -1
.dbline 460
; }
;
; }
; //Define Character Code Display---16*16
; //x:0~29; y:0~15
; void WrDefChar(uchar x,uchar y,uchar defcodenum)
; {
.dbline 462
; uint address,cgramnum;
; address=address=y*30+x;
ldi R24,30
mul R24,R22
movw R2,R0
mov R4,R20
clr R5
add R2,R4
adc R3,R5
movw R22,R2
.dbline 463
; cgramnum=0x8A+(defcodenum<<2);
ldd R20,y+5
clr R21
lsl R20
rol R21
lsl R20
rol R21
subi R20,118 ; offset = 138
sbci R21,255
.dbline 464
; WrTwoParCmd((uchar)(address),(uchar)(address>>8),ADPSET); //Set Display Ram Address
ldi R24,36
std y+0,R24
movw R18,R2
mov R18,R19
clr R19
mov R16,R2
xcall _WrTwoParCmd
.dbline 465
; WrOneParCmd(cgramnum++,0xC0);
ldi R18,192
movw R2,R20
subi R20,255 ; offset = 1
sbci R21,255
mov R16,R2
xcall _WrOneParCmd
.dbline 466
; WrOneParCmd(cgramnum++,0xC0);
ldi R18,192
movw R2,R20
subi R20,255 ; offset = 1
sbci R21,255
mov R16,R2
xcall _WrOneParCmd
.dbline 467
; address+=30;
subi R22,226 ; offset = 30
sbci R23,255
.dbline 468
; WrTwoParCmd((uchar)(address),(uchar)(address>>8),ADPSET); //Set Display Ram Address
ldi R24,36
std y+0,R24
movw R18,R22
mov R18,R19
clr R19
mov R16,R22
xcall _WrTwoParCmd
.dbline 469
; WrOneParCmd(cgramnum++,0xC0);
ldi R18,192
movw R2,R20
subi R20,255 ; offset = 1
sbci R21,255
mov R16,R2
xcall _WrOneParCmd
.dbline 470
; WrOneParCmd(cgramnum,0xC0);
ldi R18,192
mov R16,R20
xcall _WrOneParCmd
.dbline -2
L99:
adiw R28,1
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r cgramnum 20 i
.dbsym r address 22 i
.dbsym l defcodenum 5 c
.dbsym r y 22 c
.dbsym r x 20 c
.dbend
.dbfunc e WrDefCharStr _WrDefCharStr fV
; i -> R20
; len -> R22
; defcharstr -> R10,R11
; y -> R12
; x -> R14
.even
_WrDefCharStr::
xcall push_gset5
mov R12,R18
mov R14,R16
sbiw R28,1
ldd R10,y+11
ldd R11,y+12
ldd R22,y+13
.dbline -1
.dbline 474
; }
;
; void WrDefCharStr(uchar x,uchar y,uchar defcharstr[],uchar len)
; {
.dbline 477
clr R20
xjmp L104
L101:
.dbline 477
; uchar i;
;
; for(i=0;i<len;i++) {
.dbline 478
; WrDefChar(x,y,defcharstr[i]);
mov R30,R20
clr R31
add R30,R10
adc R31,R11
ldd R2,z+0
std y+0,R2
mov R18,R12
mov R16,R14
xcall _WrDefChar
.dbline 479
; if (x<LCDCOLUMN)x+=2;
mov R24,R14
cpi R24,30
brsh L105
.dbline 479
subi R24,254 ; addi 2
mov R14,R24
xjmp L106
L105:
.dbline 481
; else
; {
.dbline 482
; y+=2;
mov R24,R12
subi R24,254 ; addi 2
mov R12,R24
.dbline 483
; x=0;
clr R14
.dbline 484
; }
L106:
.dbline 485
L102:
.dbline 477
inc R20
L104:
.dbline 477
cp R20,R22
brlo L101
.dbline -2
L100:
adiw R28,1
xcall pop_gset5
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r len 22 c
.dbsym r defcharstr 10 pc
.dbsym r y 12 c
.dbsym r x 14 c
.dbend
.area lit(rom, con, rel)
L108:
.byte 0
.byte 0,0,0,0,0
.area text(rom, con, rel)
.dbfile D:\单片机编程\iccavr\YLF240128A\YLF240128A.c
.dbfunc e main _main fV
; charstr -> y+10
; j -> R22,R23
; i -> R10,R11
; defcharstr -> y+4
; tt -> R20,R21
.even
_main::
sbiw R28,40
.dbline -1
.dbline 491
; }
; }
;
;
;
; void main (void)
; {
.dbline 494
; uint i,j;
; char charstr[30];
; uchar defcharstr[6]={BLANK};
ldi R24,<L108
ldi R25,>L108
movw R30,R28
adiw R30,4
ldi R16,6
ldi R17,0
st -y,R31
st -y,R30
st -y,R25
st -y,R24
xcall asgncblk
.dbline 495
; uint tt=0;
clr R20
clr R21
.dbline 498
;
; // SP=0x45f;
; McuInit();
xcall _McuInit
.dbline 499
; LcdInit();
xcall _LcdInit
.dbline 501
;
; strcpy(charstr,"CHANGSHA HUNAN CHINA");
ldi R18,<L109
ldi R19,>L109
movw R16,R28
subi R16,246 ; offset = 10
sbci R17,255
xcall _strcpy
.dbline 502
; WrCharStr(5,0,charstr);
movw R24,R28
adiw R24,10
std y+1,R25
std y+0,R24
clr R18
ldi R16,5
xcall _WrCharStr
.dbline 504
;
; defcharstr[0]=ONE;
ldi R24,7
std y+4,R24
.dbline 505
; defcharstr[2]=JIAN;
ldi R24,12
std y+6,R24
.dbline 506
; defcharstr[3]=KONG;
ldi R24,13
std y+7,R24
.dbline 507
; defcharstr[4]=HUA;
ldi R24,14
std y+8,R24
.dbline 508
; defcharstr[5]=MIAN;
ldi R24,15
std y+9,R24
.dbline 509
; WrDefCharStr(2,2,defcharstr,sizeof(defcharstr));
ldi R24,6
std y+2,R24
movw R24,R28
adiw R24,4
std y+1,R25
std y+0,R24
ldi R18,2
ldi R16,2
xcall _WrDefCharStr
.dbline 510
; defcharstr[0]=TWO;
ldi R24,8
std y+4,R24
.dbline 511
; defcharstr[2]=CAN;
ldi R24,16
std y+6,R24
.dbline 512
; defcharstr[3]=SHU;
ldi R24,17
std y+7,R24
.dbline 513
; defcharstr[4]=SE1;
ldi R24,18
std y+8,R24
.dbline 514
; defcharstr[5]=ZHI;
ldi R24,19
std y+9,R24
.dbline 515
; WrDefCharStr(2,4,defcharstr,sizeof(defcharstr));
ldi R24,6
std y+2,R24
movw R24,R28
adiw R24,4
std y+1,R25
std y+0,R24
ldi R18,4
ldi R16,2
xcall _WrDefCharStr
.dbline 516
; defcharstr[0]=THREE;
ldi R24,9
std y+4,R24
.dbline 517
; defcharstr[2]=XIN1;
ldi R24,20
std y+6,R24
.dbline 518
; defcharstr[3]=HAO;
ldi R24,21
std y+7,R24
.dbline 519
; defcharstr[4]=CE;
ldi R24,22
std y+8,R24
.dbline 520
; defcharstr[5]=SHI;
ldi R24,23
std y+9,R24
.dbline 521
; WrDefCharStr(2,6,defcharstr,sizeof(defcharstr));
ldi R24,6
std y+2,R24
movw R24,R28
adiw R24,4
std y+1,R25
std y+0,R24
ldi R18,6
ldi R16,2
xcall _WrDefCharStr
.dbline 522
; defcharstr[0]=FOUR;
ldi R24,10
std y+4,R24
.dbline 523
; defcharstr[2]=HUA1;
ldi R24,24
std y+6,R24
.dbline 524
; defcharstr[3]=YANG;
ldi R24,25
std y+7,R24
.dbline 525
; defcharstr[4]=BIAN;
ldi R24,26
std y+8,R24
.dbline 526
; defcharstr[5]=ZHI1;
ldi R24,27
std y+9,R24
.dbline 527
; WrDefCharStr(2,8,defcharstr,sizeof(defcharstr));
ldi R24,6
std y+2,R24
movw R24,R28
adiw R24,4
std y+1,R25
std y+0,R24
ldi R18,8
ldi R16,2
xcall _WrDefCharStr
.dbline 528
; defcharstr[0]=FIVE;
ldi R24,11
std y+4,R24
.dbline 529
; defcharstr[2]=QUAN;
ldi R24,28
std y+6,R24
.dbline 530
; defcharstr[3]=XIAN;
ldi R24,1
std y+7,R24
.dbline 531
; defcharstr[4]=BLANK;
clr R2
std y+8,R2
.dbline 532
; defcharstr[5]=BLANK;
std y+9,R2
.dbline 533
; WrDefCharStr(2,10,defcharstr,sizeof(defcharstr));
ldi R24,6
std y+2,R24
movw R24,R28
adiw R24,4
std y+1,R25
std y+0,R24
ldi R18,10
ldi R16,2
xcall _WrDefCharStr
xjmp L131
L130:
.dbline 535
;
; while (1) {
.dbline 537
;
; i=tt/30;
ldi R18,30
ldi R19,0
movw R16,R20
xcall div16u
movw R10,R16
.dbline 538
; j=tt%30;
ldi R18,30
ldi R19,0
movw R16,R20
xcall mod16u
movw R22,R16
.dbline 539
; WrTwoParCmd(j,i,CUPSET);
ldi R24,33
std y+0,R24
mov R18,R10
xcall _WrTwoParCmd
.dbline 540
; WrNumeral(20,8,10,tt);
std y+3,R21
std y+2,R20
ldi R24,10
std y+0,R24
ldi R18,8
ldi R16,20
xcall _WrNumeral
.dbline 541
; WrNumeral(20,10,16,tt);
std y+3,R21
std y+2,R20
ldi R24,16
std y+0,R24
ldi R18,10
ldi R16,20
xcall _WrNumeral
.dbline 542
; delay(1000);
ldi R16,1000
ldi R17,3
xcall _delay
.dbline 543
; if (tt<480)tt++;
cpi R20,224
ldi R30,1
cpc R21,R30
brsh L133
.dbline 543
subi R20,255 ; offset = 1
sbci R21,255
xjmp L134
L133:
.dbline 544
; else tt=0;
clr R20
clr R21
L134:
.dbline 547
L131:
.dbline 535
xjmp L130
X2:
.dbline -2
L107:
adiw R28,40
.dbline 0 ; func end
ret
.dbsym l charstr 10 A[30:30]c
.dbsym r j 22 i
.dbsym r i 10 i
.dbsym l defcharstr 4 A[6:6]c
.dbsym r tt 20 i
.dbend
.area data(ram, con, rel)
.dbfile D:\单片机编程\iccavr\YLF240128A\YLF240128A.c
L109:
.blkb 21
.area idata
.byte 'C,'H,'A,'N,'G,'S,'H,'A,32,'H,'U,'N,'A,'N,32,'C
.byte 'H,'I,'N,'A,0
.area data(ram, con, rel)
.dbfile D:\单片机编程\iccavr\YLF240128A\YLF240128A.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -