📄 ledtest.s
字号:
ldi R24,<L15
ldi R25,>L15
std y+1,R25
std y+0,R24
ldi R18,75
ldi R19,0
ldi R16,10
ldi R17,0
xcall _ShowText
.dbline 190
; SdCmd(0xf1,0x0f);LCD_ChkBusy(); //设置字型大小
ldi R18,15
ldi R16,241
xcall _SdCmd
.dbline 190
xcall _LCD_ChkBusy
.dbline 193
; //SdCmd(0x60,0x10);LCD_ChkBusy(); //设置光标X坐标
; //SdCmd(0x70,0x55);LCD_ChkBusy(); //设置光标Y坐标
; ShowText(16,85,"技术有限公司");
ldi R24,<L16
ldi R25,>L16
std y+1,R25
std y+0,R24
ldi R18,85
ldi R19,0
ldi R16,16
ldi R17,0
xcall _ShowText
.dbline 194
; SdCmd(0xf0,0xa0);LCD_ChkBusy(); //设置为简体字型
ldi R18,160
ldi R16,240
xcall _SdCmd
.dbline 194
xcall _LCD_ChkBusy
.dbline 195
; SdCmd(0xf1,0x5f);LCD_ChkBusy(); //设置字型大小
ldi R18,95
ldi R16,241
xcall _SdCmd
.dbline 195
xcall _LCD_ChkBusy
.dbline 196
; SdCmd(0x10,0x79);LCD_ChkBusy(); //设置光标及粗体显示
ldi R18,121
ldi R16,16
xcall _SdCmd
.dbline 196
xcall _LCD_ChkBusy
.dbline 199
; //SdCmd(0x60,0x09);LCD_ChkBusy(); //设置光标X坐标
; //SdCmd(0x70,0x72);LCD_ChkBusy(); //设置光标Y坐标
; ShowText(9,114,"GTW - 2008");
ldi R24,<L17
ldi R25,>L17
std y+1,R25
std y+0,R24
ldi R18,114
ldi R19,0
ldi R16,9
ldi R17,0
xcall _ShowText
.dbline -2
L14:
adiw R28,2
.dbline 0 ; func end
ret
.dbend
.dbfunc e CleanScreen _CleanScreen fV
; i -> R20
; j -> R22
.even
_CleanScreen::
xcall push_gset2
.dbline -1
.dbline 204
;
; }
; //==================================
; void CleanScreen()
; {
.dbline 206
; uchar i,j;
; asm(" cli "); //加入禁止中断,以免人为的外界的中断频繁产生从而使显示屏无反应,即死屏现象
cli
.dbline 207
; SdCmd(0x60,0x00); LCD_ChkBusy(); //set cursor X location
clr R18
ldi R16,96
xcall _SdCmd
.dbline 207
xcall _LCD_ChkBusy
.dbline 208
; SdCmd(0x70,0x00); LCD_ChkBusy(); //set cursor Y location
clr R18
ldi R16,112
xcall _SdCmd
.dbline 208
xcall _LCD_ChkBusy
.dbline 209
; for(i=0;i<40;i++)
clr R20
xjmp L22
L19:
.dbline 210
; {
.dbline 211
; for(j=0;j<240;j++)
clr R22
xjmp L26
L23:
.dbline 212
.dbline 213
clr R16
xcall _SdData
.dbline 214
xcall _LCD_ChkBusy
.dbline 215
L24:
.dbline 211
inc R22
L26:
.dbline 211
cpi R22,240
brlo L23
.dbline 216
L20:
.dbline 209
inc R20
L22:
.dbline 209
cpi R20,40
brlo L19
.dbline 217
; {
; SdData(0x00);
; LCD_ChkBusy();
; }
; }
; asm(" sei "); //开户中断
sei
.dbline -2
L18:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r j 22 c
.dbend
.dbfunc e ShowText _ShowText fV
; text -> R20,R21
; y -> R22
; x -> R10
.even
_ShowText::
xcall push_gset3
mov R22,R18
mov R10,R16
ldd R20,y+6
ldd R21,y+7
.dbline -1
.dbline 221
; }
; //---------------------------------
; void ShowText(uchar x, uchar y,uchar *text)
; {
.dbline 222
; SdCmd(0x00,0xCD);LCD_ChkBusy(); //send command normal power mode, Char mode display on, normal display
ldi R18,205
clr R16
xcall _SdCmd
.dbline 222
xcall _LCD_ChkBusy
.dbline 223
; SdCmd(0x60,0x00+x);LCD_ChkBusy(); //set cursor X location to 0
mov R18,R10
ldi R16,96
xcall _SdCmd
.dbline 223
xcall _LCD_ChkBusy
.dbline 224
; SdCmd(0x70,0x00+y);LCD_ChkBusy(); //set cursor Y location to 0
mov R18,R22
ldi R16,112
xcall _SdCmd
.dbline 224
xcall _LCD_ChkBusy
xjmp L29
L28:
.dbline 226
.dbline 227
movw R30,R20
ldd R16,z+0
xcall _SdData
.dbline 228
subi R20,255 ; offset = 1
sbci R21,255
.dbline 229
xcall _LCD_ChkBusy
.dbline 230
L29:
.dbline 225
; while(*text>0)
clr R2
movw R30,R20
ldd R3,z+0
cp R2,R3
brlo L28
.dbline -2
L27:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r text 20 pc
.dbsym r y 22 c
.dbsym r x 10 c
.dbend
.dbfunc e delay_1us _delay_1us fV
.even
_delay_1us::
.dbline -1
.dbline 235
; {
; SdData(*text);
; text++;
; LCD_ChkBusy();
; }
; }
; //========================================================
; //-----------------------------------
; void delay_1us(void)
; {
.dbline 236
; asm("nop");
nop
.dbline 237
; asm("nop");
nop
.dbline 238
; asm("nop");
nop
.dbline 239
; asm("nop");
nop
.dbline 240
; asm("nop");
nop
.dbline 241
; asm("nop");
nop
.dbline 242
; asm("nop");
nop
.dbline 243
; asm("nop");
nop
.dbline -2
L31:
.dbline 0 ; func end
ret
.dbend
.dbfunc e delay_1ms _delay_1ms fV
; i -> R16,R17
.even
_delay_1ms::
.dbline -1
.dbline 246
; }
; void delay_1ms(void)
; {
.dbline 248
; unsigned int i;
; for(i=1; i<(unsigned int)(8*143-2); i++)
ldi R16,1
ldi R17,0
xjmp L36
L33:
.dbline 249
L34:
.dbline 248
subi R16,255 ; offset = 1
sbci R17,255
L36:
.dbline 248
cpi R16,118
ldi R30,4
cpc R17,R30
brlo L33
.dbline -2
L32:
.dbline 0 ; func end
ret
.dbsym r i 16 i
.dbend
.dbfunc e delay_ms _delay_ms fV
; i -> R20,R21
; n -> R22,R23
.even
_delay_ms::
xcall push_gset2
movw R22,R16
.dbline -1
.dbline 253
; ;
; }
;
; void delay_ms(unsigned int n)
; {
.dbline 255
; unsigned int i;
; for(i=0; i<n; i++)
clr R20
clr R21
xjmp L41
L38:
.dbline 256
xcall _delay_1ms
L39:
.dbline 255
subi R20,255 ; offset = 1
sbci R21,255
L41:
.dbline 255
cp R20,R22
cpc R21,R23
brlo L38
.dbline -2
L37:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbsym r n 22 i
.dbend
.dbfunc e delay_us _delay_us fV
; i -> R20,R21
; n -> R22,R23
.even
_delay_us::
xcall push_gset2
movw R22,R16
.dbline -1
.dbline 259
; delay_1ms();
; }
; void delay_us(unsigned int n)
; {
.dbline 261
; unsigned int i;
; for(i=0; i<n; i++)
clr R20
clr R21
xjmp L46
L43:
.dbline 262
xcall _delay_1us
L44:
.dbline 261
subi R20,255 ; offset = 1
sbci R21,255
L46:
.dbline 261
cp R20,R22
cpc R21,R23
brlo L43
.dbline -2
L42:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbsym r n 22 i
.dbend
.dbfunc e ShowNumber _ShowNumber fV
; showNum5 -> R12,R13
; showNum4 -> R14,R15
; showNum3 -> y+4
; showNum2 -> y+2
; showNum1 -> y+0
; showNum6 -> R10,R11
; number -> y+16
; y -> R10
; x -> R12
.even
_ShowNumber::
xcall push_gset5
mov R10,R18
mov R12,R16
sbiw R28,6
.dbline -1
.dbline 269
; delay_1us();
; }
; //-----------------------------------
; //========================================================
; // 显示数字
; //====================================
; void ShowNumber(uchar x, uchar y,uint number)
; {
.dbline 271
; uint showNum1,showNum2,showNum3,showNum4,showNum5,showNum6;
; SdCmd(0x00,0xCD);LCD_ChkBusy(); //send command normal power mode, Char mode display on, normal display
ldi R18,205
clr R16
xcall _SdCmd
.dbline 271
xcall _LCD_ChkBusy
.dbline 272
; SdCmd(0x60,0x00+x);LCD_ChkBusy(); //set cursor X location to 0
mov R18,R12
ldi R16,96
xcall _SdCmd
.dbline 272
xcall _LCD_ChkBusy
.dbline 273
; SdCmd(0x70,0x00+y);LCD_ChkBusy(); //set cursor Y location to 0
mov R18,R10
ldi R16,112
xcall _SdCmd
.dbline 273
xcall _LCD_ChkBusy
.dbline 275
;
; showNum1 = (number/100000);
ldi R20,160
ldi R21,134
ldi R22,1
ldi R23,0
ldd R2,y+16
ldd R3,y+17
clr R4
clr R5
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
xcall div32s
std y+1,R17
std y+0,R16
.dbline 276
; showNum2 = ((number%100000)/10000);
ldi R20,160
ldi R21,134
ldi R22,1
ldi R23,0
ldd R2,y+16
ldd R3,y+17
clr R4
clr R5
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
xcall mod32s
ldi R20,16
ldi R21,39
ldi R22,0
ldi R23,0
st -y,R23
st -y,R22
st -y,R21
st -y,R20
xcall div32s
std y+3,R17
std y+2,R16
.dbline 277
; showNum3 = ((number%10000)/1000);
ldi R18,10000
ldi R19,39
ldd R16,y+16
ldd R17,y+17
xcall mod16u
ldi R18,1000
ldi R19,3
xcall div16u
std y+5,R17
std y+4,R16
.dbline 278
; showNum4 = ((number%1000)/100);
ldi R18,1000
ldi R19,3
ldd R16,y+16
ldd R17,y+17
xcall mod16u
ldi R18,100
ldi R19,0
xcall div16u
movw R14,R16
.dbline 279
; showNum5 = ((number%100)/10);
ldi R18,100
ldi R19,0
ldd R16,y+16
ldd R17,y+17
xcall mod16u
ldi R18,10
ldi R19,0
xcall div16u
movw R12,R16
.dbline 280
; showNum6 = ((number%10)/1);
ldi R18,10
ldi R19,0
ldd R16,y+16
ldd R17,y+17
xcall mod16u
movw R10,R16
.dbline 282
;
; if(number>=100000)
ldi R20,160
ldi R21,134
ldi R22,1
ldi R23,0
ldd R2,y+16
ldd R3,y+17
clr R4
clr R5
cp R2,R20
cpc R3,R21
cpc R4,R22
cpc R5,R23
brlt L48
.dbline 283
; {
.dbline 284
; showNum1+=48;
ldd R24,y+0
ldd R25,y+1
adiw R24,48
std y+1,R25
std y+0,R24
.dbline 285
; SdData(showNum1);
movw R16,R24
xcall _SdData
.dbline 286
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline 287
; }
L48:
.dbline 288
; if(number>=10000)
ldd R24,y+16
ldd R25,y+17
cpi R24,16
ldi R30,39
cpc R25,R30
brlo L50
.dbline 289
; {
.dbline 290
; showNum2+=48;
ldd R24,y+2
ldd R25,y+3
adiw R24,48
std y+3,R25
std y+2,R24
.dbline 291
; SdData(showNum2);
movw R16,R24
xcall _SdData
.dbline 292
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline 293
; }
L50:
.dbline 294
; if(number>=1000)
ldd R24,y+16
ldd R25,y+17
cpi R24,232
ldi R30,3
cpc R25,R30
brlo L52
.dbline 295
; {
.dbline 296
; showNum3+=48;
ldd R24,y+4
ldd R25,y+5
adiw R24,48
std y+5,R25
std y+4,R24
.dbline 297
; SdData(showNum3);
movw R16,R24
xcall _SdData
.dbline 298
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline 299
; }
L52:
.dbline 300
; if(number>=100)
ldd R24,y+16
ldd R25,y+17
cpi R24,100
ldi R30,0
cpc R25,R30
brlo L54
.dbline 301
; {
.dbline 302
; showNum4+=48;
movw R24,R14
adiw R24,48
movw R14,R24
.dbline 303
; SdData(showNum4);
mov R16,R24
xcall _SdData
.dbline 304
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline 305
; }
L54:
.dbline 306
; if(number>=10)
ldd R24,y+16
ldd R25,y+17
cpi R24,10
ldi R30,0
cpc R25,R30
brlo L56
.dbline 307
; {
.dbline 308
; showNum5+=48;
movw R24,R12
adiw R24,48
movw R12,R24
.dbline 309
; SdData(showNum5);
mov R16,R24
xcall _SdData
.dbline 310
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline 311
; }
L56:
.dbline 312
; showNum6+=48;
movw R24,R10
adiw R24,48
movw R10,R24
.dbline 313
; SdData(showNum6);
mov R16,R24
xcall _SdData
.dbline 314
; LCD_ChkBusy();
xcall _LCD_ChkBusy
.dbline -2
L47:
adiw R28,6
xcall pop_gset5
.dbline 0 ; func end
ret
.dbsym r showNum5 12 i
.dbsym r showNum4 14 i
.dbsym l showNum3 4 i
.dbsym l showNum2 2 i
.dbsym l showNum1 0 i
.dbsym r showNum6 10 i
.dbsym l number 16 i
.dbsym r y 10 c
.dbsym r x 12 c
.dbend
.area data(ram, con, rel)
.dbfile E:\ICC128\2008控制台\2008console0TEST\U盘扇区读写\ledtest.c
L17:
.blkb 11
.area idata
.byte 'G,'T,'W,32,45,32,50,48,48,56,0
.area data(ram, con, rel)
.dbfile E:\ICC128\2008控制台\2008console0TEST\U盘扇区读写\ledtest.c
L16:
.blkb 13
.area idata
.byte 188,188,202,245,211,208,207,222,185,171,203,190,0
.area data(ram, con, rel)
.dbfile E:\ICC128\2008控制台\2008console0TEST\U盘扇区读写\ledtest.c
L15:
.blkb 7
.area idata
.byte 189,240,204,216,206,172,0
.area data(ram, con, rel)
.dbfile E:\ICC128\2008控制台\2008console0TEST\U盘扇区读写\ledtest.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -