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

📄 main.lss

📁 测试LCM模块AVR应用
💻 LSS
📖 第 1 页 / 共 2 页
字号:
void Gotoxy(uint8 Row, uint8 Col)
{
 1e0:	83 30       	cpi	r24, 0x03	; 3
 1e2:	31 f0       	breq	.+12     	; 0x1f0 <Gotoxy+0x10>
	#if defined(LCD_L2)
	switch (Row)
 1e4:	84 30       	cpi	r24, 0x04	; 4
 1e6:	31 f0       	breq	.+12     	; 0x1f4 <Gotoxy+0x14>
 1e8:	82 30       	cpi	r24, 0x02	; 2
 1ea:	31 f4       	brne	.+12     	; 0x1f8 <Gotoxy+0x18>
	{
		case 2:
			SendByte(iCmd, LCD_L2 + Col); break;
 1ec:	60 54       	subi	r22, 0x40	; 64
 1ee:	05 c0       	rjmp	.+10     	; 0x1fa <Gotoxy+0x1a>
		#if defined(LCD_L3)
		case 3:
			SendByte(iCmd, LCD_L3 + Col); break;
 1f0:	6c 56       	subi	r22, 0x6C	; 108
 1f2:	03 c0       	rjmp	.+6      	; 0x1fa <Gotoxy+0x1a>
		#endif
		#if defined(LCD_L4)
		case 4:
			SendByte(iCmd, LCD_L4 + Col); break;
 1f4:	6c 52       	subi	r22, 0x2C	; 44
 1f6:	01 c0       	rjmp	.+2      	; 0x1fa <Gotoxy+0x1a>
		#endif
		default:
			SendByte(iCmd, LCD_L1 + Col); break;
 1f8:	60 58       	subi	r22, 0x80	; 128
 1fa:	80 e0       	ldi	r24, 0x00	; 0
 1fc:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 200:	08 95       	ret

00000202 <Clear>:
	}
	#endif
}

// Clear LCD screen
void Clear(void)
{
 202:	61 e0       	ldi	r22, 0x01	; 1
 204:	80 e0       	ldi	r24, 0x00	; 0
 206:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
	SendByte(iCmd, LCD_CLS);
	DelayUs(2000);
 20a:	80 ed       	ldi	r24, 0xD0	; 208
 20c:	0e 94 49 00 	call	0x92	; 0x92 <DelayUs>
 210:	08 95       	ret

00000212 <Tile>:
	// 2ms delay is Necessary after sending LCD_CLS command !!!
}

// Tile LCD Screen with one data
void Tile(uint8 dByte)
{
 212:	0f 93       	push	r16
 214:	1f 93       	push	r17
 216:	08 2f       	mov	r16, r24
	uint8 k;
	SendByte(iCmd, LCD_L1);
 218:	60 e8       	ldi	r22, 0x80	; 128
 21a:	80 e0       	ldi	r24, 0x00	; 0
 21c:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 220:	10 e0       	ldi	r17, 0x00	; 0
	for (k = 0; k < 48; k++)
	{
		if (k == 16)
 222:	10 31       	cpi	r17, 0x10	; 16
 224:	11 f4       	brne	.+4      	; 0x22a <Tile+0x18>
		{
			SendByte(iCmd, LCD_L2);
 226:	60 ec       	ldi	r22, 0xC0	; 192
 228:	03 c0       	rjmp	.+6      	; 0x230 <Tile+0x1e>
		}
		if (k == 32)
 22a:	10 32       	cpi	r17, 0x20	; 32
 22c:	51 f4       	brne	.+20     	; 0x242 <Tile+0x30>
		{
			SendByte(iCmd, LCD_L3);
 22e:	64 e9       	ldi	r22, 0x94	; 148
 230:	80 e0       	ldi	r24, 0x00	; 0
 232:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
		}
		if (k == 48)
		{
			SendByte(iCmd, LCD_L4);
		}
		SendByte(iDat, dByte);
 236:	60 2f       	mov	r22, r16
 238:	81 e0       	ldi	r24, 0x01	; 1
 23a:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 23e:	1f 5f       	subi	r17, 0xFF	; 255
 240:	f0 cf       	rjmp	.-32     	; 0x222 <Tile+0x10>
 242:	60 2f       	mov	r22, r16
 244:	81 e0       	ldi	r24, 0x01	; 1
 246:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 24a:	1f 5f       	subi	r17, 0xFF	; 255
 24c:	10 33       	cpi	r17, 0x30	; 48
 24e:	48 f3       	brcs	.-46     	; 0x222 <Tile+0x10>
 250:	1f 91       	pop	r17
 252:	0f 91       	pop	r16
 254:	08 95       	ret

00000256 <FillCGRAM>:
	}
}
// Fill CGRAM with array CGRAM[]
void FillCGRAM(void)
{
 256:	cf 93       	push	r28
 258:	df 93       	push	r29
	uint8 i;
	//SendByte(iCmd, 0x38);
	SendByte(iCmd, LCD_CGRAM_ADDR);
 25a:	60 e4       	ldi	r22, 0x40	; 64
 25c:	80 e0       	ldi	r24, 0x00	; 0
 25e:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 262:	c6 eb       	ldi	r28, 0xB6	; 182
 264:	d0 e0       	ldi	r29, 0x00	; 0
	for (i = 0; i < LCD_CGMAX; i++)
	{
		SendByte(iDat, CGRAM[i]);
 266:	69 91       	ld	r22, Y+
 268:	81 e0       	ldi	r24, 0x01	; 1
 26a:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 26e:	80 e0       	ldi	r24, 0x00	; 0
 270:	c6 3f       	cpi	r28, 0xF6	; 246
 272:	d8 07       	cpc	r29, r24
 274:	c1 f7       	brne	.-16     	; 0x266 <FillCGRAM+0x10>
 276:	df 91       	pop	r29
 278:	cf 91       	pop	r28
 27a:	08 95       	ret

0000027c <ShowCGRAM>:
	}
}

// Show All patterns in CGRAM
void ShowCGRAM(void)
{
 27c:	0f 93       	push	r16
 27e:	1f 93       	push	r17
 280:	cf 93       	push	r28
 282:	df 93       	push	r29
 284:	c0 e0       	ldi	r28, 0x00	; 0
 286:	d0 e0       	ldi	r29, 0x00	; 0
 288:	0c 2f       	mov	r16, r28
	uint8 i,k;
	
	for (i = 0; i < 8; i++)
	{
		SendByte(iCmd, LCD_L1);
 28a:	60 e8       	ldi	r22, 0x80	; 128
 28c:	80 e0       	ldi	r24, 0x00	; 0
 28e:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
		for (k = 0; k < LCD_CHAR; k++)
		{
			#if defined(LCD_L2)
			switch (k)
			{
				case LCD_COL:
				SendByte(iCmd, LCD_L2); break;
				#if defined(LCD_L3)
				case LCD_COL*2:
				SendByte(iCmd, LCD_L3); break;
				#endif
				#if defined(LCD_L4)
				case LCD_COL*3:
				SendByte(iCmd, LCD_L4); break;
				#endif
				default:
				break;
			}
			#endif
			SendByte(iDat, i);
 292:	6c 2f       	mov	r22, r28
 294:	81 e0       	ldi	r24, 0x01	; 1
 296:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 29a:	11 e0       	ldi	r17, 0x01	; 1
 29c:	18 32       	cpi	r17, 0x28	; 40
 29e:	31 f0       	breq	.+12     	; 0x2ac <ShowCGRAM+0x30>
 2a0:	1c 33       	cpi	r17, 0x3C	; 60
 2a2:	31 f0       	breq	.+12     	; 0x2b0 <ShowCGRAM+0x34>
 2a4:	14 31       	cpi	r17, 0x14	; 20
 2a6:	71 f4       	brne	.+28     	; 0x2c4 <ShowCGRAM+0x48>
 2a8:	60 ec       	ldi	r22, 0xC0	; 192
 2aa:	03 c0       	rjmp	.+6      	; 0x2b2 <ShowCGRAM+0x36>
 2ac:	64 e9       	ldi	r22, 0x94	; 148
 2ae:	01 c0       	rjmp	.+2      	; 0x2b2 <ShowCGRAM+0x36>
 2b0:	64 ed       	ldi	r22, 0xD4	; 212
 2b2:	80 e0       	ldi	r24, 0x00	; 0
 2b4:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 2b8:	60 2f       	mov	r22, r16
 2ba:	81 e0       	ldi	r24, 0x01	; 1
 2bc:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 2c0:	1f 5f       	subi	r17, 0xFF	; 255
 2c2:	ec cf       	rjmp	.-40     	; 0x29c <ShowCGRAM+0x20>
 2c4:	60 2f       	mov	r22, r16
 2c6:	81 e0       	ldi	r24, 0x01	; 1
 2c8:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 2cc:	1f 5f       	subi	r17, 0xFF	; 255
 2ce:	10 35       	cpi	r17, 0x50	; 80
 2d0:	28 f3       	brcs	.-54     	; 0x29c <ShowCGRAM+0x20>
		}
		delay1s();
 2d2:	0e 94 69 00 	call	0xd2	; 0xd2 <delay1s>
		delay500ms();
 2d6:	0e 94 64 00 	call	0xc8	; 0xc8 <delay500ms>
		Clear();
 2da:	0e 94 01 01 	call	0x202	; 0x202 <Clear>
 2de:	21 96       	adiw	r28, 0x01	; 1
 2e0:	c8 30       	cpi	r28, 0x08	; 8
 2e2:	d1 05       	cpc	r29, r1
 2e4:	89 f6       	brne	.-94     	; 0x288 <ShowCGRAM+0xc>
 2e6:	df 91       	pop	r29
 2e8:	cf 91       	pop	r28
 2ea:	1f 91       	pop	r17
 2ec:	0f 91       	pop	r16
 2ee:	08 95       	ret

000002f0 <CallBuiltinChar>:
	}
}

// Call built-in Charactors
void CallBuiltinChar(void)
{
 2f0:	ff 92       	push	r15
 2f2:	0f 93       	push	r16
 2f4:	1f 93       	push	r17
 2f6:	ff 24       	eor	r15, r15
	uint8 i, k;
	for (i = 0; i < LCD_COL; i += LCD_ROW)
	{
		SendByte(iCmd, LCD_L1);
 2f8:	60 e8       	ldi	r22, 0x80	; 128
 2fa:	80 e0       	ldi	r24, 0x00	; 0
 2fc:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
		for (k = 0; k < LCD_CHAR; k++)
		{
			#if defined(LCD_L2)
			switch (k)
			{
				case LCD_COL:
				SendByte(iCmd, LCD_L2); break;
				#if defined(LCD_L3)
				case LCD_COL*2:
				SendByte(iCmd, LCD_L3); break;
				#endif
				#if defined(LCD_L4)
				case LCD_COL*3:
				SendByte(iCmd, LCD_L4); break;
				#endif
				default:
				break;
			}
			#endif
			SendByte(iDat, k + LCD_COL*i);
 300:	6f 2d       	mov	r22, r15
 302:	81 e0       	ldi	r24, 0x01	; 1
 304:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 308:	01 e0       	ldi	r16, 0x01	; 1
 30a:	1f 2d       	mov	r17, r15
 30c:	1f 5f       	subi	r17, 0xFF	; 255
 30e:	08 32       	cpi	r16, 0x28	; 40
 310:	31 f0       	breq	.+12     	; 0x31e <CallBuiltinChar+0x2e>
 312:	0c 33       	cpi	r16, 0x3C	; 60
 314:	31 f0       	breq	.+12     	; 0x322 <CallBuiltinChar+0x32>
 316:	04 31       	cpi	r16, 0x14	; 20
 318:	71 f4       	brne	.+28     	; 0x336 <CallBuiltinChar+0x46>
 31a:	60 ec       	ldi	r22, 0xC0	; 192
 31c:	03 c0       	rjmp	.+6      	; 0x324 <CallBuiltinChar+0x34>
 31e:	64 e9       	ldi	r22, 0x94	; 148
 320:	01 c0       	rjmp	.+2      	; 0x324 <CallBuiltinChar+0x34>
 322:	64 ed       	ldi	r22, 0xD4	; 212
 324:	80 e0       	ldi	r24, 0x00	; 0
 326:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 32a:	61 2f       	mov	r22, r17
 32c:	81 e0       	ldi	r24, 0x01	; 1
 32e:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 332:	0f 5f       	subi	r16, 0xFF	; 255
 334:	eb cf       	rjmp	.-42     	; 0x30c <CallBuiltinChar+0x1c>
 336:	10 2f       	mov	r17, r16
 338:	1f 0d       	add	r17, r15
 33a:	61 2f       	mov	r22, r17
 33c:	81 e0       	ldi	r24, 0x01	; 1
 33e:	0e 94 a8 00 	call	0x150	; 0x150 <SendByte>
 342:	0f 5f       	subi	r16, 0xFF	; 255
 344:	00 35       	cpi	r16, 0x50	; 80
 346:	10 f3       	brcs	.-60     	; 0x30c <CallBuiltinChar+0x1c>
		}
		delay1s();
 348:	0e 94 69 00 	call	0xd2	; 0xd2 <delay1s>
		delay500ms();
 34c:	0e 94 64 00 	call	0xc8	; 0xc8 <delay500ms>
		Clear();
 350:	0e 94 01 01 	call	0x202	; 0x202 <Clear>
 354:	80 e5       	ldi	r24, 0x50	; 80
 356:	f8 0e       	add	r15, r24
 358:	80 e9       	ldi	r24, 0x90	; 144
 35a:	f8 16       	cp	r15, r24
 35c:	69 f6       	brne	.-102    	; 0x2f8 <CallBuiltinChar+0x8>
 35e:	1f 91       	pop	r17
 360:	0f 91       	pop	r16
 362:	ff 90       	pop	r15
 364:	08 95       	ret

00000366 <test>:
	}
}
//===============================================
void test(void)
{
 366:	0e 94 2b 01 	call	0x256	; 0x256 <FillCGRAM>
 	    FillCGRAM();
		ShowCGRAM();
 36a:	0e 94 3e 01 	call	0x27c	; 0x27c <ShowCGRAM>
		Gotoxy(2, 1);
 36e:	61 e0       	ldi	r22, 0x01	; 1
 370:	82 e0       	ldi	r24, 0x02	; 2
 372:	0e 94 f0 00 	call	0x1e0	; 0x1e0 <Gotoxy>
		SendStr("LCD dispaly OK!");
 376:	80 e6       	ldi	r24, 0x60	; 96
 378:	90 e0       	ldi	r25, 0x00	; 0
 37a:	0e 94 d9 00 	call	0x1b2	; 0x1b2 <SendStr>
		delay1s();
 37e:	0e 94 69 00 	call	0xd2	; 0xd2 <delay1s>
		delay1s();
 382:	0e 94 69 00 	call	0xd2	; 0xd2 <delay1s>
		Clear();
 386:	0e 94 01 01 	call	0x202	; 0x202 <Clear>
		CallBuiltinChar();
 38a:	0e 94 78 01 	call	0x2f0	; 0x2f0 <CallBuiltinChar>
		/*
		while(1)
		{	
			KeyPressHandler();
		}
		*/
		Lcd_Command(0x83);               //设置显示位址
 38e:	83 e8       	ldi	r24, 0x83	; 131
 390:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
        SendStr("======@_@======");      //显示字符串
 394:	80 e7       	ldi	r24, 0x70	; 112
 396:	90 e0       	ldi	r25, 0x00	; 0
 398:	0e 94 d9 00 	call	0x1b2	; 0x1b2 <SendStr>
        Lcd_Command(0x97);               //设置显示位址
 39c:	87 e9       	ldi	r24, 0x97	; 151
 39e:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
        SendStr("welcome to vigour");      //显示字符串
 3a2:	80 e8       	ldi	r24, 0x80	; 128
 3a4:	90 e0       	ldi	r25, 0x00	; 0
 3a6:	0e 94 d9 00 	call	0x1b2	; 0x1b2 <SendStr>
        DelayMs(1000);                  //延迟1秒
 3aa:	88 ee       	ldi	r24, 0xE8	; 232
 3ac:	93 e0       	ldi	r25, 0x03	; 3
 3ae:	0e 94 4a 00 	call	0x94	; 0x94 <DelayMs>
        Lcd_Command(0x01);               //清除显示器
 3b2:	81 e0       	ldi	r24, 0x01	; 1
 3b4:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
        Lcd_Command(0x83);               //设置显示位址
 3b8:	83 e8       	ldi	r24, 0x83	; 131
 3ba:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
        SendStr("======^_^======");      //显示字符串
 3be:	82 e9       	ldi	r24, 0x92	; 146
 3c0:	90 e0       	ldi	r25, 0x00	; 0
 3c2:	0e 94 d9 00 	call	0x1b2	; 0x1b2 <SendStr>
        Lcd_Command(0x94);               //设置显示位址
 3c6:	84 e9       	ldi	r24, 0x94	; 148
 3c8:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
        SendStr("thank you very much"); //显示字符串
 3cc:	82 ea       	ldi	r24, 0xA2	; 162
 3ce:	90 e0       	ldi	r25, 0x00	; 0
 3d0:	0e 94 d9 00 	call	0x1b2	; 0x1b2 <SendStr>
        DelayMs(1000);                  //延迟
 3d4:	88 ee       	ldi	r24, 0xE8	; 232
 3d6:	93 e0       	ldi	r25, 0x03	; 3
 3d8:	0e 94 4a 00 	call	0x94	; 0x94 <DelayMs>
        Lcd_Command(0x01);               //清除显示器
 3dc:	81 e0       	ldi	r24, 0x01	; 1
 3de:	0e 94 80 00 	call	0x100	; 0x100 <Lcd_Command>
 3e2:	08 95       	ret

000003e4 <main>:
LCD第4行显示地址1~20(0xd4~0xe7)
*///=======================================================
//测试主LCD主程序
void main()
{
 3e4:	0e 94 bd 00 	call	0x17a	; 0x17a <Lcd_Init>
    Lcd_Init(); //初始化LCD
    while(1)
    {	
		test();
 3e8:	0e 94 b3 01 	call	0x366	; 0x366 <test>
 3ec:	fd cf       	rjmp	.-6      	; 0x3e8 <main+0x4>

000003ee <_exit>:
 3ee:	ff cf       	rjmp	.-2      	; 0x3ee <_exit>

⌨️ 快捷键说明

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