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

📄 main.lss

📁 meg16 的所有功能实例
💻 LSS
📖 第 1 页 / 共 2 页
字号:

main.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000040c  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000382  00800060  0000040c  000004a0  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  008003e2  0000078e  00000822  2**0
                  ALLOC
  3 .noinit       00000000  008003e2  008003e2  00000822  2**0
                  CONTENTS
  4 .eeprom       00000000  00810000  00810000  00000822  2**0
                  CONTENTS
  5 .debug_aranges 00000014  00000000  00000000  00000822  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_pubnames 00000104  00000000  00000000  00000836  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_info   000003b5  00000000  00000000  0000093a  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_abbrev 000000d6  00000000  00000000  00000cef  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_line   000002dd  00000000  00000000  00000dc5  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_str    00000147  00000000  00000000  000010a2  2**0
                  CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:

00000000 <__vectors>:
   0:	0c 94 2a 00 	jmp	0x54
   4:	0c 94 45 00 	jmp	0x8a
   8:	0c 94 45 00 	jmp	0x8a
   c:	0c 94 45 00 	jmp	0x8a
  10:	0c 94 45 00 	jmp	0x8a
  14:	0c 94 45 00 	jmp	0x8a
  18:	0c 94 45 00 	jmp	0x8a
  1c:	0c 94 45 00 	jmp	0x8a
  20:	0c 94 45 00 	jmp	0x8a
  24:	0c 94 45 00 	jmp	0x8a
  28:	0c 94 45 00 	jmp	0x8a
  2c:	0c 94 45 00 	jmp	0x8a
  30:	0c 94 45 00 	jmp	0x8a
  34:	0c 94 45 00 	jmp	0x8a
  38:	0c 94 45 00 	jmp	0x8a
  3c:	0c 94 45 00 	jmp	0x8a
  40:	0c 94 45 00 	jmp	0x8a
  44:	0c 94 45 00 	jmp	0x8a
  48:	0c 94 45 00 	jmp	0x8a
  4c:	0c 94 45 00 	jmp	0x8a
  50:	0c 94 45 00 	jmp	0x8a

00000054 <__ctors_end>:
  54:	11 24       	eor	r1, r1
  56:	1f be       	out	0x3f, r1	; 63
  58:	cf e5       	ldi	r28, 0x5F	; 95
  5a:	d4 e0       	ldi	r29, 0x04	; 4
  5c:	de bf       	out	0x3e, r29	; 62
  5e:	cd bf       	out	0x3d, r28	; 61

00000060 <__do_copy_data>:
  60:	13 e0       	ldi	r17, 0x03	; 3
  62:	a0 e6       	ldi	r26, 0x60	; 96
  64:	b0 e0       	ldi	r27, 0x00	; 0
  66:	ec e0       	ldi	r30, 0x0C	; 12
  68:	f4 e0       	ldi	r31, 0x04	; 4
  6a:	02 c0       	rjmp	.+4      	; 0x70

0000006c <.do_copy_data_loop>:
  6c:	05 90       	lpm	r0, Z+
  6e:	0d 92       	st	X+, r0

00000070 <.do_copy_data_start>:
  70:	a2 3e       	cpi	r26, 0xE2	; 226
  72:	b1 07       	cpc	r27, r17
  74:	d9 f7       	brne	.-10     	; 0x6c

00000076 <__do_clear_bss>:
  76:	13 e0       	ldi	r17, 0x03	; 3
  78:	a2 ee       	ldi	r26, 0xE2	; 226
  7a:	b3 e0       	ldi	r27, 0x03	; 3
  7c:	01 c0       	rjmp	.+2      	; 0x80

0000007e <.do_clear_bss_loop>:
  7e:	1d 92       	st	X+, r1

00000080 <.do_clear_bss_start>:
  80:	a2 3e       	cpi	r26, 0xE2	; 226
  82:	b1 07       	cpc	r27, r17
  84:	e1 f7       	brne	.-8      	; 0x7e
  86:	0c 94 c7 01 	jmp	0x38e

0000008a <__bad_interrupt>:
  8a:	0c 94 00 00 	jmp	0x0

0000008e <Delay_us>:

/******************************************************************************/
void Delay_us(unsigned int time)
{
while(time--);
  8e:	01 97       	sbiw	r24, 0x01	; 1
  90:	2f ef       	ldi	r18, 0xFF	; 255
  92:	8f 3f       	cpi	r24, 0xFF	; 255
  94:	92 07       	cpc	r25, r18
  96:	d9 f7       	brne	.-10     	; 0x8e
  98:	08 95       	ret

0000009a <Delay_ms>:
}

void Delay_ms(unsigned int time)
{
  9a:	cf 93       	push	r28
  9c:	df 93       	push	r29
while(time--)
	{
	Delay_us(1000);
  9e:	ec 01       	movw	r28, r24
  a0:	21 97       	sbiw	r28, 0x01	; 1
  a2:	8f ef       	ldi	r24, 0xFF	; 255
  a4:	cf 3f       	cpi	r28, 0xFF	; 255
  a6:	d8 07       	cpc	r29, r24
  a8:	49 f0       	breq	.+18     	; 0xbc
  aa:	88 ee       	ldi	r24, 0xE8	; 232
  ac:	93 e0       	ldi	r25, 0x03	; 3
  ae:	0e 94 47 00 	call	0x8e
  b2:	21 97       	sbiw	r28, 0x01	; 1
  b4:	8f ef       	ldi	r24, 0xFF	; 255
  b6:	cf 3f       	cpi	r28, 0xFF	; 255
  b8:	d8 07       	cpc	r29, r24
  ba:	b9 f7       	brne	.-18     	; 0xaa
  bc:	df 91       	pop	r29
  be:	cf 91       	pop	r28
  c0:	08 95       	ret

000000c2 <delay_1us>:
	}
}

void main(void) 
{
	LCD_init();//初始化液晶    
	LCD_clear();
	
	SETBIT(DDRC,BACKLED_EN);   			//配置背光控制端口										
	CLEARBIT(PORTC,BACKLED_EN);			//使能背光
	
	while(1)  
	{	
		LCD_clear();
		LCD_write_english_string(0,0,"---ADEmbed----");
		LCD_write_english_string(0,5,"www.");
		LCD_write_english_string(21,5,"adembed.");
		LCD_write_english_string(66,5,"com");
		LCD_write_chinese_string(0,3,12,7,0,0);
		
		Delay_ms(5000);
		LCD_clear();
		LCD_draw_bmp_pixel(0,0,AVR_bmp,48,24);
		Delay_ms(2000);
	}	
	  
}


/********************************************************************************************************************/ 
void LCD_init(void)
{
	//先设置为输出
    SETBIT(LCD_DIR,SCLK);
    SETBIT(LCD_DIR,SDIN);
    SETBIT(LCD_DIR,LCD_DC);
    SETBIT(LCD_DIR,LCD_CE);
    //SETBIT(LCD_DIR,LCD_RST);
	  
    // 产生一个让LCD复位的低电平脉冲
    
	//CLEARBIT(LCD_PORT,LCD_RST);//LCD_RST = 0;
    //delay_1us();
	//SETBIT(LCD_PORT,LCD_RST);//LCD_RST = 1;
    
	// 关闭LCD
	CLEARBIT(LCD_PORT,LCD_CE);//LCD_CE = 0;
    delay_1us();
	
	// 使能LCD
	SETBIT(LCD_PORT,LCD_CE);//LCD_CE = 1;
    delay_1us();

    LCD_write_byte(0x21, 0);	// 使用扩展命令设置LCD模式
    LCD_write_byte(0xc8, 0);	// 设置偏置电压
    LCD_write_byte(0x06, 0);	// 温度校正
    LCD_write_byte(0x13, 0);	// 1:48
    LCD_write_byte(0x20, 0);	// 使用基本命令
    LCD_clear();	            // 清屏
    LCD_write_byte(0x0c, 0);	// 设定显示模式,正常显示
        
    // 关闭LCD
    CLEARBIT(LCD_PORT,LCD_CE);//LCD_CE = 0;
}
/********************************************************************************************************************/
void LCD_clear(void)
{
    unsigned int i;

    LCD_write_byte(0x0c, 0);			
    LCD_write_byte(0x80, 0);			

    for (i=0; i<504; i++)
	{
        LCD_write_byte(0, 1);
	}			
}
/********************************************************************************************************************/
void delay_1us(void)                 //1us延时函数
{
  c2:	8f ed       	ldi	r24, 0xDF	; 223
  c4:	9e e2       	ldi	r25, 0x2E	; 46
   unsigned int i;
   for(i=0;i<12000;i++);
  c6:	c2 97       	sbiw	r24, 0x32	; 50
  c8:	97 ff       	sbrs	r25, 7
  ca:	fd cf       	rjmp	.-6      	; 0xc6
  cc:	08 95       	ret

000000ce <LCD_write_byte>:
}
/********************************************************************************************************************/
void LCD_set_XY(unsigned char X, unsigned char Y)
{
    LCD_write_byte(0x40 | Y, 0);// column
    LCD_write_byte(0x80 | X, 0);// row
}
/********************************************************************************************************************/
void LCD_write_char(unsigned char c)
{
    unsigned char line;
	
    c -= 32;
    for (line=0; line<6; line++)
	{
        LCD_write_byte(font6x8[c][line], 1);
	}
}
/********************************************************************************************************************/
/*-----------------------------------------------------------------------
LCD_write_english_String  : 英文字符串显示函数

输入参数:*s      :英文字符串指针;
          X、Y    : 显示字符串的位置,x 0-83 ,y 0-5
-----------------------------------------------------------------------*/
void LCD_write_english_string(unsigned char X,unsigned char Y,char *s)
{
    LCD_set_XY(X,Y);
    while (*s) 
    {
	    LCD_write_char(*s);
	    s++;
    }
}
/********************************************************************************************************************/
/*-----------------------------------------------------------------------
LCD_write_chinese_string: 在LCD上显示汉字

输入参数:X、Y    :显示汉字的起始X、Y坐标;
          ch_with :汉字点阵的宽度
          num     :显示汉字的个数;  
          line    :汉字点阵数组中的起始行数
          row     :汉字显示的行间距
-----------------------------------------------------------------------*/                        
void LCD_write_chinese_string(unsigned char X, unsigned char Y,unsigned char ch_with,unsigned char num,unsigned char line,unsigned char row)
{
    unsigned char i,n;
    
    LCD_set_XY(X,Y);                             //设置初始位置
    
    for (i=0;i<num;)
    {
      	for (n=0; n<ch_with*2; n++)              //写一个汉字
      	{ 
      	    if (n==ch_with)                      //写汉字的下半部分
      	    {
      	        if (i==0) LCD_set_XY(X,Y+1);
      	        else
				{
      	           LCD_set_XY((X+(ch_with+row)*i),Y+1);
				}
            }
      	    LCD_write_byte(HZK[line+i][n],1);
      	}
      	i++;
      	LCD_set_XY((X+(ch_with+row)*i),Y);
    }
}
/********************************************************************************************************************/
/*-----------------------------------------------------------------------
LCD_draw_map      : 位图绘制函数

输入参数:X、Y    :位图绘制的起始X、Y坐标;
          *map    :位图点阵数据;
          Pix_x   :位图像素(长)
          Pix_y   :位图像素(宽)
-----------------------------------------------------------------------*/
void LCD_draw_bmp_pixel(unsigned char X,unsigned char Y,unsigned char *map,unsigned char Pix_x,unsigned char Pix_y)
{
    unsigned int i,n;
    unsigned char row;
    
    if (Pix_y%8==0)
	{
	    row=Pix_y/8;      //计算位图所占行数
    }
    else
	{
        row=Pix_y/8+1;
    }
    for (n=0;n<row;n++)
    {
      	LCD_set_XY(X,Y);
        for(i=0; i<Pix_x; i++)
          {
            LCD_write_byte(map[i+n*Pix_x], 1);
          }
        Y++;                         //换行
    }      
}
/********************************************************************************************************************/
/*-----------------------------------------------------------------------
LCD_write_byte    : 写数据到LCD

输入参数:data    :写入的数据;
          command :写数据/命令选择;
-----------------------------------------------------------------------*/
void LCD_write_byte(unsigned char dat, unsigned char command)
{
  ce:	98 2f       	mov	r25, r24
    unsigned char i;

	CLEARBIT(LCD_PORT,LCD_CE);// 使能LCD_CE = 0
  d0:	c4 98       	cbi	0x18, 4	; 24
    
    if (command == 0)
  d2:	66 23       	and	r22, r22
  d4:	11 f4       	brne	.+4      	; 0xda
	{
	    CLEARBIT(LCD_PORT,LCD_DC);// 传送命令 LCD_DC = 0;
  d6:	c6 98       	cbi	0x18, 6	; 24
  d8:	01 c0       	rjmp	.+2      	; 0xdc
	}
    else
	{
	    SETBIT(LCD_PORT,LCD_DC);// 传送数据LCD_DC = 1;
  da:	c6 9a       	sbi	0x18, 6	; 24
  dc:	87 e0       	ldi	r24, 0x07	; 7
	}
	
	for(i=0;i<8;i++)
	{
		if(dat&0x80)
  de:	97 ff       	sbrs	r25, 7
  e0:	02 c0       	rjmp	.+4      	; 0xe6
		{
			SETBIT(LCD_PORT,SDIN);//SDIN = 1;
  e2:	c5 9a       	sbi	0x18, 5	; 24
  e4:	01 c0       	rjmp	.+2      	; 0xe8
		}
		else
		{
			CLEARBIT(LCD_PORT,SDIN);//SDIN = 0;
  e6:	c5 98       	cbi	0x18, 5	; 24
		}
		CLEARBIT(LCD_PORT,SCLK);//SCLK = 0;
  e8:	c7 98       	cbi	0x18, 7	; 24
		dat = dat << 1;
  ea:	99 0f       	add	r25, r25
		SETBIT(LCD_PORT,SCLK);//SCLK = 1;
  ec:	c7 9a       	sbi	0x18, 7	; 24
  ee:	81 50       	subi	r24, 0x01	; 1
  f0:	87 ff       	sbrs	r24, 7
  f2:	f5 cf       	rjmp	.-22     	; 0xde

⌨️ 快捷键说明

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