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

📄 keylcd.lss

📁 我学习AVR的代码例子
💻 LSS
📖 第 1 页 / 共 5 页
字号:
  
  PORTB|=(1<<PB4); //WD
}
*/
void W_comm(BYTE COMMAND)
{
  PORTB|=(1<<PB5); //RD
     98e:	c5 9a       	sbi	0x18, 5	; 24
  PORTA=COMMAND;
     990:	8b bb       	out	0x1b, r24	; 27
  PORTB|=(1<<PB7); //A0
     992:	c7 9a       	sbi	0x18, 7	; 24
  PORTB&=~(1<<PB4);//WD
     994:	c4 98       	cbi	0x18, 4	; 24
  asm volatile("nop"::);
     996:	00 00       	nop
  PORTB|=(1<<PB4); //WD
     998:	c4 9a       	sbi	0x18, 4	; 24
  PORTB&=~(1<<PB7); //A0
     99a:	c7 98       	cbi	0x18, 7	; 24
     99c:	08 95       	ret

0000099e <W_code>:
}
/*
void WD_WC(BYTE code) //write data and command paramete
{
  PORTB&=~(1<<PB7); //A0
  PORTB|=(1<<PB5); //RD
  PORTA=code;
  PORTB&=~(1<<PB4); //WD
  
  PORTB|=(1<<PB4); //WD
}
*/
void W_code(BYTE code)
{
  PORTA=code;
     99e:	8b bb       	out	0x1b, r24	; 27
  PORTB&=~(1<<PB7); //A0
     9a0:	c7 98       	cbi	0x18, 7	; 24
  PORTB|=(1<<PB5); //RD
     9a2:	c5 9a       	sbi	0x18, 5	; 24
  PORTB&=~(1<<PB4); //WD
     9a4:	c4 98       	cbi	0x18, 4	; 24
  asm volatile("nop"::);
     9a6:	00 00       	nop
  PORTB|=(1<<PB4); //WD
     9a8:	c4 9a       	sbi	0x18, 4	; 24
     9aa:	08 95       	ret

000009ac <init_devices>:
}

void init_devices(void)
{
 PORTB = 0x00;
     9ac:	18 ba       	out	0x18, r1	; 24
 DDRB  = 0xFF; 
     9ae:	8f ef       	ldi	r24, 0xFF	; 255
     9b0:	87 bb       	out	0x17, r24	; 23
 PORTA = 0xFF;//FB
     9b2:	8b bb       	out	0x1b, r24	; 27
 DDRA  = 0xFF;
     9b4:	8a bb       	out	0x1a, r24	; 26
 DDRD=0x00;
     9b6:	11 ba       	out	0x11, r1	; 17
 PORTD=0xFF;
     9b8:	82 bb       	out	0x12, r24	; 18
     9ba:	08 95       	ret

000009bc <initLCD>:
}

void initLCD(void)
{
  init_devices();     
     9bc:	0e 94 d6 04 	call	0x9ac
  PORTB&=~(1<<6);     //   /cs -> 0
     9c0:	c6 98       	cbi	0x18, 6	; 24
  W_comm(0x40);//SYSTEM SET
     9c2:	80 e4       	ldi	r24, 0x40	; 64
     9c4:	0e 94 c7 04 	call	0x98e
  W_code(0x30);//P1
     9c8:	80 e3       	ldi	r24, 0x30	; 48
     9ca:	0e 94 cf 04 	call	0x99e
  W_code(0x87);//P2
     9ce:	87 e8       	ldi	r24, 0x87	; 135
     9d0:	0e 94 cf 04 	call	0x99e
  W_code(0x07);//P3
     9d4:	87 e0       	ldi	r24, 0x07	; 7
     9d6:	0e 94 cf 04 	call	0x99e
  W_code(0x27);//p4  
     9da:	87 e2       	ldi	r24, 0x27	; 39
     9dc:	0e 94 cf 04 	call	0x99e
  W_code(0x49);//p5
     9e0:	89 e4       	ldi	r24, 0x49	; 73
     9e2:	0e 94 cf 04 	call	0x99e
  W_code(0xf0);//P6 
     9e6:	80 ef       	ldi	r24, 0xF0	; 240
     9e8:	0e 94 cf 04 	call	0x99e
  W_code(0x28);//p7
     9ec:	88 e2       	ldi	r24, 0x28	; 40
     9ee:	0e 94 cf 04 	call	0x99e
  W_code(0x00);//p8
     9f2:	80 e0       	ldi	r24, 0x00	; 0
     9f4:	0e 94 cf 04 	call	0x99e
  
  W_comm(0x44);//SCROLL
     9f8:	84 e4       	ldi	r24, 0x44	; 68
     9fa:	0e 94 c7 04 	call	0x98e
  W_code(0x00);//P1
     9fe:	80 e0       	ldi	r24, 0x00	; 0
     a00:	0e 94 cf 04 	call	0x99e
  W_code(0x00);//P2
     a04:	80 e0       	ldi	r24, 0x00	; 0
     a06:	0e 94 cf 04 	call	0x99e
  W_code(0xf1);//P3
     a0a:	81 ef       	ldi	r24, 0xF1	; 241
     a0c:	0e 94 cf 04 	call	0x99e
  W_code(0xB0);//P4
     a10:	80 eb       	ldi	r24, 0xB0	; 176
     a12:	0e 94 cf 04 	call	0x99e
  W_code(0x04);//P5
     a16:	84 e0       	ldi	r24, 0x04	; 4
     a18:	0e 94 cf 04 	call	0x99e
  W_code(0xf1);//P6
     a1c:	81 ef       	ldi	r24, 0xF1	; 241
     a1e:	0e 94 cf 04 	call	0x99e
  W_code(0x00);//P7
     a22:	80 e0       	ldi	r24, 0x00	; 0
     a24:	0e 94 cf 04 	call	0x99e
  W_code(0x00);//P8
     a28:	80 e0       	ldi	r24, 0x00	; 0
     a2a:	0e 94 cf 04 	call	0x99e
  //W_code(0x00);//P9
  //W_code(0x00);//P10
  
  W_comm(0x5d);//CSR FORM
     a2e:	8d e5       	ldi	r24, 0x5D	; 93
     a30:	0e 94 c7 04 	call	0x98e
  W_code(0x07);
     a34:	87 e0       	ldi	r24, 0x07	; 7
     a36:	0e 94 cf 04 	call	0x99e
  W_code(0x07);                              
     a3a:	87 e0       	ldi	r24, 0x07	; 7
     a3c:	0e 94 cf 04 	call	0x99e
  W_comm(0x5a);//HDOT SCR
     a40:	8a e5       	ldi	r24, 0x5A	; 90
     a42:	0e 94 c7 04 	call	0x98e
  W_code(0x00);              
     a46:	80 e0       	ldi	r24, 0x00	; 0
     a48:	0e 94 cf 04 	call	0x99e
  W_comm(0x5b);//OVLAY
     a4c:	8b e5       	ldi	r24, 0x5B	; 91
     a4e:	0e 94 c7 04 	call	0x98e
  W_code(0x00);
     a52:	80 e0       	ldi	r24, 0x00	; 0
     a54:	0e 94 cf 04 	call	0x99e
  //W_code(0x18);
  W_comm(0x59);//DISP ON 
     a58:	89 e5       	ldi	r24, 0x59	; 89
     a5a:	0e 94 c7 04 	call	0x98e
  //W_code(0x54);//无光标 
  W_code(0x56); //有光标                     
     a5e:	86 e5       	ldi	r24, 0x56	; 86
     a60:	0e 94 cf 04 	call	0x99e
     a64:	08 95       	ret

00000a66 <clear1>:
}

void clear1(void)
{
     a66:	cf 93       	push	r28
     a68:	df 93       	push	r29
 unsigned int i;
  i=0x4b0;
     a6a:	c0 eb       	ldi	r28, 0xB0	; 176
     a6c:	d4 e0       	ldi	r29, 0x04	; 4
  W_comm(0x4c);
     a6e:	8c e4       	ldi	r24, 0x4C	; 76
     a70:	0e 94 c7 04 	call	0x98e
  W_comm(0x46);
     a74:	86 e4       	ldi	r24, 0x46	; 70
     a76:	0e 94 c7 04 	call	0x98e
  W_code(0x00);
     a7a:	80 e0       	ldi	r24, 0x00	; 0
     a7c:	0e 94 cf 04 	call	0x99e
  W_code(0x00);
     a80:	80 e0       	ldi	r24, 0x00	; 0
     a82:	0e 94 cf 04 	call	0x99e
  W_comm(0x42);
     a86:	82 e4       	ldi	r24, 0x42	; 66
     a88:	0e 94 c7 04 	call	0x98e
  do{ 
    W_code(0xa0);
     a8c:	80 ea       	ldi	r24, 0xA0	; 160
     a8e:	0e 94 cf 04 	call	0x99e
    i--;
     a92:	21 97       	sbiw	r28, 0x01	; 1
	}
     a94:	d9 f7       	brne	.-10     	; 0xa8c
     a96:	df 91       	pop	r29
     a98:	cf 91       	pop	r28
     a9a:	08 95       	ret

00000a9c <clear2>:
  while(i>0);
}

void clear2(void)
{
     a9c:	cf 93       	push	r28
     a9e:	df 93       	push	r29
 unsigned int j;
  j=0x2580;
     aa0:	c0 e8       	ldi	r28, 0x80	; 128
     aa2:	d5 e2       	ldi	r29, 0x25	; 37
  W_comm(0x4c);
     aa4:	8c e4       	ldi	r24, 0x4C	; 76
     aa6:	0e 94 c7 04 	call	0x98e
  W_comm(0x46);
     aaa:	86 e4       	ldi	r24, 0x46	; 70
     aac:	0e 94 c7 04 	call	0x98e
  W_code(0xB0);
     ab0:	80 eb       	ldi	r24, 0xB0	; 176
     ab2:	0e 94 cf 04 	call	0x99e
  W_code(0x04);
     ab6:	84 e0       	ldi	r24, 0x04	; 4
     ab8:	0e 94 cf 04 	call	0x99e
  W_comm(0x42);
     abc:	82 e4       	ldi	r24, 0x42	; 66
     abe:	0e 94 c7 04 	call	0x98e
  do{ 
    W_code(0x00);
     ac2:	80 e0       	ldi	r24, 0x00	; 0
     ac4:	0e 94 cf 04 	call	0x99e
    j--;
     ac8:	21 97       	sbiw	r28, 0x01	; 1
    }
     aca:	d9 f7       	brne	.-10     	; 0xac2
     acc:	df 91       	pop	r29
     ace:	cf 91       	pop	r28
     ad0:	08 95       	ret

00000ad2 <W_data>:
  while(j>0);
}/*
void clear3(void)
{
 unsigned int j;
  j=0x2580;
  W_comm(0x4c);
  W_comm(0x46);
  W_code(0x30);
  W_code(0x2a);
  W_comm(0x42);
  do{ 
    W_code(0x00);
    j--;
    }
  while(j>0);
}*/
void W_data(BYTE z)
{
     ad2:	1f 93       	push	r17
     ad4:	18 2f       	mov	r17, r24
  W_comm(0X42);
     ad6:	82 e4       	ldi	r24, 0x42	; 66
     ad8:	0e 94 c7 04 	call	0x98e
  W_code(z);
     adc:	81 2f       	mov	r24, r17
     ade:	0e 94 cf 04 	call	0x99e
     ae2:	1f 91       	pop	r17
     ae4:	08 95       	ret

00000ae6 <r_data>:
}

BYTE r_data(void)
{
  BYTE a;
  W_comm(0X43);
     ae6:	83 e4       	ldi	r24, 0x43	; 67
     ae8:	0e 94 c7 04 	call	0x98e
  DDRA=0x00;
     aec:	1a ba       	out	0x1a, r1	; 26
  PORTB|=(1<<PB7); //A0
     aee:	c7 9a       	sbi	0x18, 7	; 24
  PORTA=0xff;
     af0:	8f ef       	ldi	r24, 0xFF	; 255
     af2:	8b bb       	out	0x1b, r24	; 27
  PORTB|=(1<<PB4); //WD
     af4:	c4 9a       	sbi	0x18, 4	; 24
  PORTA=0xff;
     af6:	8b bb       	out	0x1b, r24	; 27
  PORTB&=~(1<<PB5); //RD
     af8:	c5 98       	cbi	0x18, 5	; 24
  asm volatile("nop"::);
     afa:	00 00       	nop
  a=PINA;
     afc:	99 b3       	in	r25, 0x19	; 25
  PORTB|=(1<<PB5); //RD
     afe:	c5 9a       	sbi	0x18, 5	; 24
  PORTA=0x00;
     b00:	1b ba       	out	0x1b, r1	; 27
  DDRA=0xff;
     b02:	8a bb       	out	0x1a, r24	; 26
  return(a);
}
     b04:	89 2f       	mov	r24, r25
     b06:	99 27       	eor	r25, r25
     b08:	08 95       	ret

00000b0a <set_csr>:

void set_csr(void)//(char x,char y)
{
     b0a:	0f 93       	push	r16
     b0c:	1f 93       	push	r17
  WORD addr;
  if(cur_x<0 ||cur_x>41)
     b0e:	80 91 61 00 	lds	r24, 0x0061
     b12:	80 91 61 00 	lds	r24, 0x0061
     b16:	8a 32       	cpi	r24, 0x2A	; 42
     b18:	40 f0       	brcs	.+16     	; 0xb2a
	{
		cur_x=39;
     b1a:	87 e2       	ldi	r24, 0x27	; 39
     b1c:	80 93 61 00 	sts	0x0061, r24
		cur_y-=1;
     b20:	80 91 60 00 	lds	r24, 0x0060
     b24:	81 50       	subi	r24, 0x01	; 1
     b26:	80 93 60 00 	sts	0x0060, r24
	}
	if(cur_y<0)
     b2a:	80 91 60 00 	lds	r24, 0x0060
	{
		cur_y=0;
	}
	if(cur_x>=40)
     b2e:	80 91 61 00 	lds	r24, 0x0061
     b32:	88 32       	cpi	r24, 0x28	; 40
     b34:	50 f0       	brcs	.+20     	; 0xb4a
	{ 
		cur_x-=40;
     b36:	80 91 61 00 	lds	r24, 0x0061
     b3a:	88 52       	subi	r24, 0x28	; 40
     b3c:	80 93 61 00 	sts	0x0061, r24
		cur_y+=1;
     b40:	80 91 60 00 	lds	r24, 0x0060
     b44:	8f 5f       	subi	r24, 0xFF	; 255
     b46:	80 93 60 00 	sts	0x0060, r24
	}
	if(cur_y>=30)
     b4a:	80 91 60 00 	lds	r24, 0x0060
     b4e:	8e 31       	cpi	r24, 0x1E	; 30
     b50:	10 f0       	brcs	.+4      	; 0xb56
	{
		//cur_y-=30;
		cur_y=0;
     b52:	10 92 60 00 	sts	0x0060, r1
	}
  addr=cur_x+cur_y*40;//+0x4b0
     b56:	20 91 61 00 	lds	r18, 0x0061
     b5a:	90 91 60 00 	lds	r25, 0x0060
     b5e:	88 e2       	ldi	r24, 0x28	; 40
     b60:	98 9f       	mul	r25, r24
     b62:	80 01       	movw	r16, r0
     b64:	11 24       	eor	r1, r1
     b66:	02 0f       	add	r16, r18

⌨️ 快捷键说明

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