⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ledtest.s

📁 使用atmel128对45db161读写程序加LM2009R大液晶显示
💻 S
📖 第 1 页 / 共 2 页
字号:
L20:
	.dbline 221
	.dbline 222
	lds R16,99
	.dbline 223
	andi R16,8
	.dbline 224
L21:
	.dbline 220
; 	while(TempM)
	tst R16
	brne L20
	.dbline 225
; 	{
;        TempM = PING;
;        TempM &= 0x08;    //读取DB.3位
; 	}
;     DDRG = 0XFF;        //将端口设为输出
	ldi R24,255
	sts 100,R24
	.dbline -2
L19:
	.dbline 0 ; func end
	ret
	.dbsym r TempM 16 c
	.dbend
	.dbfunc e Welcome_interface _Welcome_interface fV
	.even
_Welcome_interface::
	sbiw R28,2
	.dbline -1
	.dbline 229
; }
; //====================================
; void Welcome_interface(void)
; {
	.dbline 230
;   SdCmd(0x12,0x95);LCD_ChkBusy();  //操作图层1
	ldi R18,149
	ldi R16,18
	xcall _SdCmd
	.dbline 230
	xcall _LCD_ChkBusy
	.dbline 231
;   CleanScreen();
	xcall _CleanScreen
	.dbline 232
;   SdCmd(0xf1,0x1f);LCD_ChkBusy();     //设置字型大小
	ldi R18,31
	ldi R16,241
	xcall _SdCmd
	.dbline 232
	xcall _LCD_ChkBusy
	.dbline 235
;   //SdCmd(0x60,0x0a);LCD_ChkBusy();     //设置光标X坐标
;   //SdCmd(0x70,0x4b);LCD_ChkBusy();     //设置光标Y坐标
;   ShowText(10,75,"金特维");  
	ldi R24,<L24
	ldi R25,>L24
	std y+1,R25
	std y+0,R24
	ldi R18,75
	ldi R19,0
	ldi R16,10
	ldi R17,0
	xcall _ShowText
	.dbline 236
;   SdCmd(0xf1,0x0f);LCD_ChkBusy();     //设置字型大小
	ldi R18,15
	ldi R16,241
	xcall _SdCmd
	.dbline 236
	xcall _LCD_ChkBusy
	.dbline 239
;   //SdCmd(0x60,0x10);LCD_ChkBusy();     //设置光标X坐标
;   //SdCmd(0x70,0x55);LCD_ChkBusy();     //设置光标Y坐标
;   ShowText(16,85,"技术有限公司");
	ldi R24,<L25
	ldi R25,>L25
	std y+1,R25
	std y+0,R24
	ldi R18,85
	ldi R19,0
	ldi R16,16
	ldi R17,0
	xcall _ShowText
	.dbline 240
;   SdCmd(0xf0,0xa0);LCD_ChkBusy();     //设置为简体字型
	ldi R18,160
	ldi R16,240
	xcall _SdCmd
	.dbline 240
	xcall _LCD_ChkBusy
	.dbline 241
;   SdCmd(0xf1,0x5f);LCD_ChkBusy();     //设置字型大小
	ldi R18,95
	ldi R16,241
	xcall _SdCmd
	.dbline 241
	xcall _LCD_ChkBusy
	.dbline 242
;   SdCmd(0x10,0x79);LCD_ChkBusy();     //设置光标及粗体显示
	ldi R18,121
	ldi R16,16
	xcall _SdCmd
	.dbline 242
	xcall _LCD_ChkBusy
	.dbline 245
;   //SdCmd(0x60,0x09);LCD_ChkBusy();     //设置光标X坐标
;   //SdCmd(0x70,0x72);LCD_ChkBusy();     //设置光标Y坐标
;   ShowText(9,114,"GTW - 2008");
	ldi R24,<L26
	ldi R25,>L26
	std y+1,R25
	std y+0,R24
	ldi R18,114
	ldi R19,0
	ldi R16,9
	ldi R17,0
	xcall _ShowText
	.dbline -2
L23:
	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 250
;   
; }
; //==================================
; void CleanScreen()
; {  
	.dbline 252
;    uchar i,j;
;    asm(" cli ");  //加入禁止中断,以免人为的外界的中断频繁产生从而使显示屏无反应,即死屏现象
	 cli 
	.dbline 253
;    SdCmd(0x60,0x00); LCD_ChkBusy();  //set cursor X location
	clr R18
	ldi R16,96
	xcall _SdCmd
	.dbline 253
	xcall _LCD_ChkBusy
	.dbline 254
;    SdCmd(0x70,0x00); LCD_ChkBusy();  //set cursor Y location
	clr R18
	ldi R16,112
	xcall _SdCmd
	.dbline 254
	xcall _LCD_ChkBusy
	.dbline 255
;   	for(i=0;i<40;i++)
	clr R20
	xjmp L31
L28:
	.dbline 256
; 	 {
	.dbline 257
;       	for(j=0;j<240;j++)
	clr R22
	xjmp L35
L32:
	.dbline 258
	.dbline 259
	clr R16
	xcall _SdData
	.dbline 260
	xcall _LCD_ChkBusy
	.dbline 261
L33:
	.dbline 257
	inc R22
L35:
	.dbline 257
	cpi R22,240
	brlo L32
	.dbline 262
L29:
	.dbline 255
	inc R20
L31:
	.dbline 255
	cpi R20,40
	brlo L28
	.dbline 263
;      		{
;      		  SdData(0x00);
; 			  LCD_ChkBusy();
;  		    }
;      }
;    asm(" sei ");  //开户中断
	 sei 
	.dbline -2
L27:
	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 267
; }
; //---------------------------------
; void ShowText(uchar x, uchar y,uchar *text)
; {
	.dbline 268
;     SdCmd(0x00,0xCD);LCD_ChkBusy();   //send command normal power mode, Char mode    display on, normal display 
	ldi R18,205
	clr R16
	xcall _SdCmd
	.dbline 268
	xcall _LCD_ChkBusy
	.dbline 269
;     SdCmd(0x60,0x00+x);LCD_ChkBusy();  //set cursor X location to 0
	mov R18,R10
	ldi R16,96
	xcall _SdCmd
	.dbline 269
	xcall _LCD_ChkBusy
	.dbline 270
;     SdCmd(0x70,0x00+y);LCD_ChkBusy();  //set cursor Y location to 0
	mov R18,R22
	ldi R16,112
	xcall _SdCmd
	.dbline 270
	xcall _LCD_ChkBusy
	xjmp L38
L37:
	.dbline 272
	.dbline 273
	movw R30,R20
	ldd R16,z+0
	xcall _SdData
	.dbline 274
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 275
	xcall _LCD_ChkBusy
	.dbline 276
L38:
	.dbline 271
; 	while(*text>0)
	clr R2
	movw R30,R20
	ldd R3,z+0
	cp R2,R3
	brlo L37
	.dbline -2
L36:
	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 ShowNumber _ShowNumber fV
;       showNum5 -> y+2
;       showNum4 -> y+0
;       showNum3 -> R10,R11
;       showNum2 -> R12,R13
;       showNum1 -> R14,R15
;              i -> y+8
;       showNum6 -> y+6
;         number -> y+4
;        number7 -> y+22
;              n -> y+20
;              y -> R10
;              x -> R12
	.even
_ShowNumber::
	xcall push_gset5
	mov R10,R18
	mov R12,R16
	sbiw R28,10
	.dbline -1
	.dbline 282
; 	 {
; 	   	SdData(*text);
; 		text++;
; 		LCD_ChkBusy();
; 	 }
; }
; //====================================
; // 显示数字
; //====================================
; void ShowNumber(uchar x, uchar y,uint n, uint* number7)
; {  
	.dbline 284
;     uint i, number, 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 284
	xcall _LCD_ChkBusy
	.dbline 285
;     SdCmd(0x60,0x00+x);LCD_ChkBusy();  //set cursor X location to 0
	mov R18,R12
	ldi R16,96
	xcall _SdCmd
	.dbline 285
	xcall _LCD_ChkBusy
	.dbline 286
;     SdCmd(0x70,0x00+y);LCD_ChkBusy();  //set cursor Y location to 0
	mov R18,R10
	ldi R16,112
	xcall _SdCmd
	.dbline 286
	xcall _LCD_ChkBusy
	.dbline 287
;    for( i=0;i<n;i++ )
	clr R0
	clr R1
	std y+9,R1
	std y+8,R0
	xjmp L44
L41:
	.dbline 288
;    {
	.dbline 290
; 	
; 	number = *number7;
	ldd R30,y+22
	ldd R31,y+23
	ldd R2,z+0
	ldd R3,z+1
	std y+5,R3
	std y+4,R2
	.dbline 291
; 	number7++;
	ldd R24,y+22
	ldd R25,y+23
	adiw R24,2
	std y+23,R25
	std y+22,R24
	.dbline 292
; 	showNum1 = (number/100000);
	ldi R20,160
	ldi R21,134
	ldi R22,1
	ldi R23,0
	ldd R2,y+4
	ldd R3,y+5
	clr R4
	clr R5
	st -y,R23
	st -y,R22
	st -y,R21
	st -y,R20
	movw R16,R2
	movw R18,R4
	xcall div32s
	movw R14,R16
	.dbline 293
;     showNum2 = ((number%100000)/10000);
	ldi R20,160
	ldi R21,134
	ldi R22,1
	ldi R23,0
	ldd R2,y+4
	ldd R3,y+5
	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
	movw R12,R16
	.dbline 294
;     showNum3 = ((number%10000)/1000);
	ldi R18,10000
	ldi R19,39
	ldd R16,y+4
	ldd R17,y+5
	xcall mod16u
	ldi R18,1000
	ldi R19,3
	xcall div16u
	movw R10,R16
	.dbline 295
;     showNum4 = ((number%1000)/100);
	ldi R18,1000
	ldi R19,3
	ldd R16,y+4
	ldd R17,y+5
	xcall mod16u
	ldi R18,100
	ldi R19,0
	xcall div16u
	std y+1,R17
	std y+0,R16
	.dbline 296
;     showNum5 = ((number%100)/10);
	ldi R18,100
	ldi R19,0
	ldd R16,y+4
	ldd R17,y+5
	xcall mod16u
	ldi R18,10
	ldi R19,0
	xcall div16u
	std y+3,R17
	std y+2,R16
	.dbline 297
;     showNum6 = ((number%10)/1);
	ldi R18,10
	ldi R19,0
	ldd R16,y+4
	ldd R17,y+5
	xcall mod16u
	std y+7,R17
	std y+6,R16
	.dbline 299
; 
;    if(number>=100000)
	ldi R20,160
	ldi R21,134
	ldi R22,1
	ldi R23,0
	ldd R2,y+4
	ldd R3,y+5
	clr R4
	clr R5
	cp R2,R20
	cpc R3,R21
	cpc R4,R22
	cpc R5,R23
	brlt L45
	.dbline 300
;    {
	.dbline 301
;     showNum1+=48;
	movw R24,R14
	adiw R24,48
	movw R14,R24
	.dbline 302
; 	SdData(showNum1);
	mov R16,R24
	xcall _SdData
	.dbline 303
; 	LCD_ChkBusy();
	xcall _LCD_ChkBusy
	.dbline 304
;    }
L45:
	.dbline 305
;    if(number>=10000)
	ldd R24,y+4
	ldd R25,y+5
	cpi R24,16
	ldi R30,39
	cpc R25,R30
	brlo L47
	.dbline 306
;    {
	.dbline 307
;     showNum2+=48;
	movw R24,R12
	adiw R24,48
	movw R12,R24
	.dbline 308
; 	SdData(showNum2);
	mov R16,R24
	xcall _SdData
	.dbline 309
; 	LCD_ChkBusy();
	xcall _LCD_ChkBusy
	.dbline 310
;    }
L47:
	.dbline 311
;    if(number>=1000)
	ldd R24,y+4
	ldd R25,y+5
	cpi R24,232
	ldi R30,3
	cpc R25,R30
	brlo L49
	.dbline 312
;    {
	.dbline 313
;     showNum3+=48;
	movw R24,R10
	adiw R24,48
	movw R10,R24
	.dbline 314
; 	SdData(showNum3);
	mov R16,R24
	xcall _SdData
	.dbline 315
; 	LCD_ChkBusy();  
	xcall _LCD_ChkBusy
	.dbline 316
;    }
L49:
	.dbline 317
;    if(number>=100)
	ldd R24,y+4
	ldd R25,y+5
	cpi R24,100
	ldi R30,0
	cpc R25,R30
	brlo L51
	.dbline 318
;    {
	.dbline 319
;     showNum4+=48;
	ldd R24,y+0
	ldd R25,y+1
	adiw R24,48
	std y+1,R25
	std y+0,R24
	.dbline 320
; 	SdData(showNum4);
	mov R16,R24
	xcall _SdData
	.dbline 321
; 	LCD_ChkBusy(); 
	xcall _LCD_ChkBusy
	.dbline 322
;    }  
L51:
	.dbline 323
;    if(number>=10)
	ldd R24,y+4
	ldd R25,y+5
	cpi R24,10
	ldi R30,0
	cpc R25,R30
	brlo L53
	.dbline 324
;    {
	.dbline 325
;     showNum5+=48;
	ldd R24,y+2
	ldd R25,y+3
	adiw R24,48
	std y+3,R25
	std y+2,R24
	.dbline 326
; 	SdData(showNum5);
	mov R16,R24
	xcall _SdData
	.dbline 327
; 	LCD_ChkBusy();
	xcall _LCD_ChkBusy
	.dbline 328
;    }
L53:
	.dbline 329
	ldd R24,y+6
	ldd R25,y+7
	adiw R24,48
	std y+7,R25
	std y+6,R24
	.dbline 330
	movw R16,R24
	xcall _SdData
	.dbline 331
	xcall _LCD_ChkBusy
	.dbline 332
L42:
	.dbline 287
	ldd R24,y+8
	ldd R25,y+9
	adiw R24,1
	std y+9,R25
	std y+8,R24
L44:
	.dbline 287
	ldd R0,y+8
	ldd R1,y+9
	ldd R16,y+20
	ldd R17,y+21
	cp R0,R16
	cpc R1,R17
	brsh X1
	xjmp L41
X1:
	.dbline -2
L40:
	adiw R28,10
	xcall pop_gset5
	.dbline 0 ; func end
	ret
	.dbsym l showNum5 2 i
	.dbsym l showNum4 0 i
	.dbsym r showNum3 10 i
	.dbsym r showNum2 12 i
	.dbsym r showNum1 14 i
	.dbsym l i 8 i
	.dbsym l showNum6 6 i
	.dbsym l number 4 i
	.dbsym l number7 22 pi
	.dbsym l n 20 i
	.dbsym r y 10 c
	.dbsym r x 12 c
	.dbend
	.dbfunc e delay_1us _delay_1us fV
	.even
_delay_1us::
	.dbline -1
	.dbline 337
;     showNum6+=48;
; 	SdData(showNum6);
; 	LCD_ChkBusy();   
;  }    
; }
; //==================================
; //-----------------------------------
; void delay_1us(void)
; {
	.dbline 338
; 	asm("nop");
	nop
	.dbline 339
; 	asm("nop");
	nop
	.dbline 340
; 	asm("nop");
	nop
	.dbline 341
; 	asm("nop");
	nop
	.dbline 342
; 	asm("nop");
	nop
	.dbline 343
; 	asm("nop");
	nop
	.dbline 344
; 	asm("nop");
	nop
	.dbline 345
; 	asm("nop");
	nop
	.dbline -2
L55:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e delay_1ms _delay_1ms fV
;              i -> R16,R17
	.even
_delay_1ms::
	.dbline -1
	.dbline 348
; }
; void delay_1ms(void)
; {
	.dbline 350
; 	unsigned int i;
; 	for(i=1; i<(unsigned int)(8*143-2); i++)
	ldi R16,1
	ldi R17,0
	xjmp L60
L57:
	.dbline 351
L58:
	.dbline 350
	subi R16,255  ; offset = 1
	sbci R17,255
L60:
	.dbline 350
	cpi R16,118
	ldi R30,4
	cpc R17,R30
	brlo L57
	.dbline -2
L56:
	.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 355
; 	;
; }
; 
; void delay_ms(unsigned int n)
; {
	.dbline 357
; 	unsigned int i;
; 	for(i=0; i<n; i++)
	clr R20
	clr R21
	xjmp L65
L62:
	.dbline 358
	xcall _delay_1ms
L63:
	.dbline 357
	subi R20,255  ; offset = 1
	sbci R21,255
L65:
	.dbline 357
	cp R20,R22
	cpc R21,R23
	brlo L62
	.dbline -2
L61:
	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 361
; 	delay_1ms();
; }
; void delay_us(unsigned int n)
; {
	.dbline 363
; 	unsigned int i;
; 	for(i=0; i<n; i++)
	clr R20
	clr R21
	xjmp L70
L67:
	.dbline 364
	xcall _delay_1us
L68:
	.dbline 363
	subi R20,255  ; offset = 1
	sbci R21,255
L70:
	.dbline 363
	cp R20,R22
	cpc R21,R23
	brlo L67
	.dbline -2
L66:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r i 20 i
	.dbsym r n 22 i
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\ICC128\2008控制台\2008console0TEST\flashTest\ledtest.c
_xx::
	.blkb 1024
	.dbsym e xx _xx A[1024:512]i
	.area data(ram, con, rel)
	.dbfile E:\ICC128\2008控制台\2008console0TEST\flashTest\ledtest.c
L26:
	.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\flashTest\ledtest.c
L25:
	.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\flashTest\ledtest.c
L24:
	.blkb 7
	.area idata
	.byte 189,240,204,216,206,172,0
	.area data(ram, con, rel)
	.dbfile E:\ICC128\2008控制台\2008console0TEST\flashTest\ledtest.c
L8:
	.blkb 27
	.area idata
	.byte 178,226,202,212,32,'F,'l,'a,'s,'h,32,'A,'T,52,53,'D
	.byte 'B,49,54,49,'D,32,182,193,208,180,0
	.area data(ram, con, rel)
	.dbfile E:\ICC128\2008控制台\2008console0TEST\flashTest\ledtest.c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -