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

📄 main.lss

📁 用ATmega32写的采用四线接法的LCD1602驱动程序
💻 LSS
📖 第 1 页 / 共 3 页
字号:
 26e:	ea 01       	movw	r28, r20
  {
	LCD_dis_char( X++, Y,*s++);
	
	if (16 == X)  //显示超出一行时进行处理
	{
	  Y ^= 0x01;  //换行显示
 270:	ff 24       	eor	r15, r15
 272:	f3 94       	inc	r15
 274:	0b c0       	rjmp	.+22     	; 0x28c <LCD_dis_string+0x2a>
void LCD_dis_string(unsigned char X,unsigned char Y,char *s)
{ 

  while ( *s ) 
  {
	LCD_dis_char( X++, Y,*s++);
 276:	18 2f       	mov	r17, r24
 278:	1f 5f       	subi	r17, 0xFF	; 255
 27a:	60 2f       	mov	r22, r16
 27c:	0e 94 20 01 	call	0x240	; 0x240 <LCD_dis_char>
	
	if (16 == X)  //显示超出一行时进行处理
 280:	10 31       	cpi	r17, 0x10	; 16
 282:	11 f4       	brne	.+4      	; 0x288 <LCD_dis_string+0x26>
	{
	  Y ^= 0x01;  //换行显示
 284:	0f 25       	eor	r16, r15
 286:	10 e0       	ldi	r17, 0x00	; 0
void LCD_dis_string(unsigned char X,unsigned char Y,char *s)
{ 

  while ( *s ) 
  {
	LCD_dis_char( X++, Y,*s++);
 288:	21 96       	adiw	r28, 0x01	; 1
 28a:	81 2f       	mov	r24, r17
* 最后修改日期  :2008-2-29
***************************************************************************/
void LCD_dis_string(unsigned char X,unsigned char Y,char *s)
{ 

  while ( *s ) 
 28c:	48 81       	ld	r20, Y
 28e:	44 23       	and	r20, r20
 290:	91 f7       	brne	.-28     	; 0x276 <LCD_dis_string+0x14>
	{
	  Y ^= 0x01;  //换行显示
	  X  = 0;
	} 
   }
}
 292:	df 91       	pop	r29
 294:	cf 91       	pop	r28
 296:	1f 91       	pop	r17
 298:	0f 91       	pop	r16
 29a:	ff 90       	pop	r15
 29c:	08 95       	ret

0000029e <delay>:
//#include "delay.c"
#include "LCD1602.c"


void  delay(ulint n)
{
 29e:	05 c0       	rjmp	.+10     	; 0x2aa <delay+0xc>
  while (n--)
  NOP();
 2a0:	00 00       	nop
 2a2:	61 50       	subi	r22, 0x01	; 1
 2a4:	70 40       	sbci	r23, 0x00	; 0
 2a6:	80 40       	sbci	r24, 0x00	; 0
 2a8:	90 40       	sbci	r25, 0x00	; 0
#include "LCD1602.c"


void  delay(ulint n)
{
  while (n--)
 2aa:	61 15       	cp	r22, r1
 2ac:	71 05       	cpc	r23, r1
 2ae:	81 05       	cpc	r24, r1
 2b0:	91 05       	cpc	r25, r1
 2b2:	b1 f7       	brne	.-20     	; 0x2a0 <delay+0x2>
  NOP();
}
 2b4:	08 95       	ret

000002b6 <main>:

/*******************************************
*  主程序开始
********************************************/
int main(void)
{	
 2b6:	ff 92       	push	r15
 2b8:	0f 93       	push	r16
 2ba:	1f 93       	push	r17
 2bc:	cf 93       	push	r28
 2be:	df 93       	push	r29
  uchar dis = '0';
  
  init_LCD();
 2c0:	0e 94 fa 00 	call	0x1f4	; 0x1f4 <init_LCD>
 2c4:	90 e3       	ldi	r25, 0x30	; 48
 2c6:	f9 2e       	mov	r15, r25
    milliseconds can be achieved.
 */
void
_delay_loop_2(uint16_t __count)
{
	__asm__ volatile (
 2c8:	00 e4       	ldi	r16, 0x40	; 64
 2ca:	1f e1       	ldi	r17, 0x1F	; 31
  
  while(1)
  { 
	write_byte_to_LCD(0,0x01); //显示清屏
 2cc:	c0 e9       	ldi	r28, 0x90	; 144
 2ce:	d1 e0       	ldi	r29, 0x01	; 1
 2d0:	61 e0       	ldi	r22, 0x01	; 1
 2d2:	80 e0       	ldi	r24, 0x00	; 0
 2d4:	0e 94 a9 00 	call	0x152	; 0x152 <write_byte_to_LCD>
 2d8:	c8 01       	movw	r24, r16
 2da:	01 97       	sbiw	r24, 0x01	; 1
 2dc:	f1 f7       	brne	.-4      	; 0x2da <main+0x24>
    _delay_ms(2);		 
	LCD_dis_string(5,0,"Welcome");
 2de:	40 e6       	ldi	r20, 0x60	; 96
 2e0:	50 e0       	ldi	r21, 0x00	; 0
 2e2:	60 e0       	ldi	r22, 0x00	; 0
 2e4:	85 e0       	ldi	r24, 0x05	; 5
 2e6:	0e 94 31 01 	call	0x262	; 0x262 <LCD_dis_string>
	LCD_dis_string(0,1,"www.gxnu.edu.cn!");
 2ea:	48 e6       	ldi	r20, 0x68	; 104
 2ec:	50 e0       	ldi	r21, 0x00	; 0
 2ee:	61 e0       	ldi	r22, 0x01	; 1
 2f0:	80 e0       	ldi	r24, 0x00	; 0
 2f2:	0e 94 31 01 	call	0x262	; 0x262 <LCD_dis_string>
 2f6:	80 e1       	ldi	r24, 0x10	; 16
 2f8:	97 e2       	ldi	r25, 0x27	; 39
 2fa:	fe 01       	movw	r30, r28
 2fc:	31 97       	sbiw	r30, 0x01	; 1
 2fe:	f1 f7       	brne	.-4      	; 0x2fc <main+0x46>
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
		{
			// wait 1/10 ms
			_delay_loop_2(((F_CPU) / 4e3) / 10);
			__ticks --;
 300:	01 97       	sbiw	r24, 0x01	; 1
		__ticks = 1;
	else if (__tmp > 65535)
	{
		//	__ticks = requested delay in 1/10 ms
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
 302:	d9 f7       	brne	.-10     	; 0x2fa <main+0x44>
	_delay_ms(1000);

	write_byte_to_LCD(0,0x01); //显示清屏
 304:	61 e0       	ldi	r22, 0x01	; 1
 306:	80 e0       	ldi	r24, 0x00	; 0
 308:	0e 94 a9 00 	call	0x152	; 0x152 <write_byte_to_LCD>
 30c:	c8 01       	movw	r24, r16
 30e:	01 97       	sbiw	r24, 0x01	; 1
 310:	f1 f7       	brne	.-4      	; 0x30e <main+0x58>
	_delay_ms(2);		 
	LCD_dis_string(2,0,"Tel:5671555");
 312:	49 e7       	ldi	r20, 0x79	; 121
 314:	50 e0       	ldi	r21, 0x00	; 0
 316:	60 e0       	ldi	r22, 0x00	; 0
 318:	82 e0       	ldi	r24, 0x02	; 2
 31a:	0e 94 31 01 	call	0x262	; 0x262 <LCD_dis_string>
 31e:	80 e1       	ldi	r24, 0x10	; 16
 320:	97 e2       	ldi	r25, 0x27	; 39
 322:	fe 01       	movw	r30, r28
 324:	31 97       	sbiw	r30, 0x01	; 1
 326:	f1 f7       	brne	.-4      	; 0x324 <main+0x6e>
		{
			// wait 1/10 ms
			_delay_loop_2(((F_CPU) / 4e3) / 10);
			__ticks --;
 328:	01 97       	sbiw	r24, 0x01	; 1
		__ticks = 1;
	else if (__tmp > 65535)
	{
		//	__ticks = requested delay in 1/10 ms
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
 32a:	d9 f7       	brne	.-10     	; 0x322 <main+0x6c>
	_delay_ms(1000);
	
	write_byte_to_LCD(0,0x01); //显示清屏
 32c:	61 e0       	ldi	r22, 0x01	; 1
 32e:	80 e0       	ldi	r24, 0x00	; 0
 330:	0e 94 a9 00 	call	0x152	; 0x152 <write_byte_to_LCD>
 334:	c8 01       	movw	r24, r16
 336:	01 97       	sbiw	r24, 0x01	; 1
 338:	f1 f7       	brne	.-4      	; 0x336 <main+0x80>
	_delay_ms(2);
	LCD_dis_string(0,0,"Email:");
 33a:	45 e8       	ldi	r20, 0x85	; 133
 33c:	50 e0       	ldi	r21, 0x00	; 0
 33e:	60 e0       	ldi	r22, 0x00	; 0
 340:	80 e0       	ldi	r24, 0x00	; 0
 342:	0e 94 31 01 	call	0x262	; 0x262 <LCD_dis_string>
 346:	80 e1       	ldi	r24, 0x10	; 16
 348:	97 e2       	ldi	r25, 0x27	; 39
 34a:	fe 01       	movw	r30, r28
 34c:	31 97       	sbiw	r30, 0x01	; 1
 34e:	f1 f7       	brne	.-4      	; 0x34c <main+0x96>
		{
			// wait 1/10 ms
			_delay_loop_2(((F_CPU) / 4e3) / 10);
			__ticks --;
 350:	01 97       	sbiw	r24, 0x01	; 1
		__ticks = 1;
	else if (__tmp > 65535)
	{
		//	__ticks = requested delay in 1/10 ms
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
 352:	d9 f7       	brne	.-10     	; 0x34a <main+0x94>
	_delay_ms(1000);
	
	write_byte_to_LCD(0,0x01); //显示清屏
 354:	61 e0       	ldi	r22, 0x01	; 1
 356:	80 e0       	ldi	r24, 0x00	; 0
 358:	0e 94 a9 00 	call	0x152	; 0x152 <write_byte_to_LCD>
 35c:	c8 01       	movw	r24, r16
 35e:	01 97       	sbiw	r24, 0x01	; 1
 360:	f1 f7       	brne	.-4      	; 0x35e <main+0xa8>
	_delay_ms(2);
	LCD_dis_string(0,0,"rockjablew@163.com");
 362:	4c e8       	ldi	r20, 0x8C	; 140
 364:	50 e0       	ldi	r21, 0x00	; 0
 366:	60 e0       	ldi	r22, 0x00	; 0
 368:	80 e0       	ldi	r24, 0x00	; 0
 36a:	0e 94 31 01 	call	0x262	; 0x262 <LCD_dis_string>
 36e:	80 e1       	ldi	r24, 0x10	; 16
 370:	97 e2       	ldi	r25, 0x27	; 39
 372:	fe 01       	movw	r30, r28
 374:	31 97       	sbiw	r30, 0x01	; 1
 376:	f1 f7       	brne	.-4      	; 0x374 <main+0xbe>
		{
			// wait 1/10 ms
			_delay_loop_2(((F_CPU) / 4e3) / 10);
			__ticks --;
 378:	01 97       	sbiw	r24, 0x01	; 1
		__ticks = 1;
	else if (__tmp > 65535)
	{
		//	__ticks = requested delay in 1/10 ms
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
 37a:	d9 f7       	brne	.-10     	; 0x372 <main+0xbc>
	_delay_ms(1000);
    
    write_byte_to_LCD(0,0x01);  //显示清屏
 37c:	61 e0       	ldi	r22, 0x01	; 1
 37e:	80 e0       	ldi	r24, 0x00	; 0
 380:	0e 94 a9 00 	call	0x152	; 0x152 <write_byte_to_LCD>
 384:	c8 01       	movw	r24, r16
 386:	01 97       	sbiw	r24, 0x01	; 1
 388:	f1 f7       	brne	.-4      	; 0x386 <main+0xd0>
	_delay_ms(2);
	LCD_dis_char(0,0,dis);
 38a:	4f 2d       	mov	r20, r15
 38c:	60 e0       	ldi	r22, 0x00	; 0
 38e:	80 e0       	ldi	r24, 0x00	; 0
 390:	0e 94 20 01 	call	0x240	; 0x240 <LCD_dis_char>
	dis ++ ;
 394:	f3 94       	inc	r15
	if( dis == ':') dis = '0';
 396:	8a e3       	ldi	r24, 0x3A	; 58
 398:	f8 16       	cp	r15, r24
 39a:	11 f4       	brne	.+4      	; 0x3a0 <main+0xea>
 39c:	80 e3       	ldi	r24, 0x30	; 48
 39e:	f8 2e       	mov	r15, r24
 3a0:	80 e1       	ldi	r24, 0x10	; 16
 3a2:	97 e2       	ldi	r25, 0x27	; 39
 3a4:	fe 01       	movw	r30, r28
 3a6:	31 97       	sbiw	r30, 0x01	; 1
 3a8:	f1 f7       	brne	.-4      	; 0x3a6 <main+0xf0>
		{
			// wait 1/10 ms
			_delay_loop_2(((F_CPU) / 4e3) / 10);
			__ticks --;
 3aa:	01 97       	sbiw	r24, 0x01	; 1
		__ticks = 1;
	else if (__tmp > 65535)
	{
		//	__ticks = requested delay in 1/10 ms
		__ticks = (uint16_t) (__ms * 10.0);
		while(__ticks)
 3ac:	d9 f7       	brne	.-10     	; 0x3a4 <main+0xee>
 3ae:	90 cf       	rjmp	.-224    	; 0x2d0 <main+0x1a>

000003b0 <_exit>:
 3b0:	f8 94       	cli

000003b2 <__stop_program>:
 3b2:	ff cf       	rjmp	.-2      	; 0x3b2 <__stop_program>

⌨️ 快捷键说明

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