📄 key.lss
字号:
__asm__ volatile (
186: c8 01 movw r24, r16
188: 01 97 sbiw r24, 0x01 ; 1
18a: f1 f7 brne .-4 ; 0x188 <LCD_init+0x70>
LCD_write(0x01,0); // 显示清屏
_delay_ms(1);
LCD_write(0x06,0); // 显示光标移动设置
18c: 60 e0 ldi r22, 0x00 ; 0
18e: 86 e0 ldi r24, 0x06 ; 6
190: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
194: c8 01 movw r24, r16
196: 01 97 sbiw r24, 0x01 ; 1
198: f1 f7 brne .-4 ; 0x196 <LCD_init+0x7e>
LCD_write(0x06,0); // 显示光标移动设置
_delay_ms(1);
LCD_write(0x0c,0); // 显示开及光标设置
19a: 60 e0 ldi r22, 0x00 ; 0
19c: 8c e0 ldi r24, 0x0C ; 12
19e: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
1a2: 8c e4 ldi r24, 0x4C ; 76
1a4: 9d e1 ldi r25, 0x1D ; 29
1a6: 01 97 sbiw r24, 0x01 ; 1
1a8: f1 f7 brne .-4 ; 0x1a6 <LCD_init+0x8e>
1aa: 1f 91 pop r17
1ac: 0f 91 pop r16
1ae: 08 95 ret
000001b0 <LCD_set_xy>:
LCD第一行显示寄存器地址:0X80-0X8F
LCD第一行显示寄存器地址:0XC0-0XCF
-------------------------------------------------------*/
void LCD_set_xy(uint8_t x,uint8_t y)
{
1b0: 66 23 and r22, r22
1b2: 11 f4 brne .+4 ; 0x1b8 <LCD_set_xy+0x8>
uint8_t address;
if (y == 0)
address = 0x80 + x; //第一行显示
1b4: 80 58 subi r24, 0x80 ; 128
1b6: 01 c0 rjmp .+2 ; 0x1ba <LCD_set_xy+0xa>
else
address = 0xc0 + x; //第二行显示
1b8: 80 54 subi r24, 0x40 ; 64
LCD_write( address, 0 );
1ba: 60 e0 ldi r22, 0x00 ; 0
1bc: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
1c0: 08 95 ret
000001c2 <LCD_write_string>:
}
/*-------------------------------------------------------
void LCD_write_string(uint8_t x,uint8_t y,char *s)
说明: 英文字符串显示函数
输入参数:*s(英文字符串指)
X、Y : 显示字符串的位置
---------------------------------------------------------*/
void LCD_write_string(uint8_t x,uint8_t y,char *s)
{
1c2: cf 93 push r28
1c4: df 93 push r29
1c6: ea 01 movw r28, r20
LCD_set_xy( x, y );
1c8: 0e 94 d8 00 call 0x1b0 ; 0x1b0 <LCD_set_xy>
1cc: 04 c0 rjmp .+8 ; 0x1d6 <LCD_write_string+0x14>
while (*s)
{
LCD_write( 0, *s );
1ce: 80 e0 ldi r24, 0x00 ; 0
1d0: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
s ++;
1d4: 21 96 adiw r28, 0x01 ; 1
1d6: 68 81 ld r22, Y
1d8: 66 23 and r22, r22
1da: c9 f7 brne .-14 ; 0x1ce <LCD_write_string+0xc>
1dc: df 91 pop r29
1de: cf 91 pop r28
1e0: 08 95 ret
000001e2 <LCD_write_char>:
}
}
/*-----------------------------------------------------------
void LCD_self_def(uint8_t add,uint8_t *table)
说明:把自定义的点阵符号数据写入CGRAM中
1 ADD为数据的地址;
2 table为相应的数据
-------------------------------------------------------------*/
void LCD_self_def(uint8_t add,uint8_t table[])
{
uint8_t i;
for (i=0;i<8;i++)
{
LCD_write(add+i,0); // 设置自定义字符的 CGRAM 地址
_delay_ms(2);
LCD_write(0,table[i]); // 向CGRAM写入自定义字符表的数据
_delay_ms(2);
};
}
/*------------------------------------------------------------
void LCD_write_char(uint8_t x,uint8_t y,uint8_t c)
说明:向LCD写一个字符;
x,y为坐标 ;c 为所写字符
--------------------------------------------------------------*/
void LCD_write_char(uint8_t x,uint8_t y,uint8_t c)
{
1e2: 1f 93 push r17
1e4: 14 2f mov r17, r20
LCD_set_xy(x,y );
1e6: 0e 94 d8 00 call 0x1b0 ; 0x1b0 <LCD_set_xy>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
1ea: 84 ef ldi r24, 0xF4 ; 244
1ec: 91 e0 ldi r25, 0x01 ; 1
1ee: 01 97 sbiw r24, 0x01 ; 1
1f0: f1 f7 brne .-4 ; 0x1ee <LCD_write_char+0xc>
void LCD_write_char(uint8_t x,uint8_t y,uint8_t c)
{
LCD_set_xy(x,y );
_delay_ms(2);
LCD_write(0,c);
1f2: 61 2f mov r22, r17
1f4: 80 e0 ldi r24, 0x00 ; 0
1f6: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
1fa: 1f 91 pop r17
1fc: 08 95 ret
000001fe <key_scan>:
1 2
3 4
------------------------------------------*/
uint8_t key_scan(void)
{
1fe: 80 ef ldi r24, 0xF0 ; 240
200: 8b bb out 0x1b, r24 ; 27
uint8_t key_code;
PORTA=0B11110000;
DDRA=0B00110000;
202: 80 e3 ldi r24, 0x30 ; 48
204: 8a bb out 0x1a, r24 ; 26
key_code=5;
//第一列
PORTA&=~_BV(PA4);
206: dc 98 cbi 0x1b, 4 ; 27
PORTA|=_BV(PA5);
208: dd 9a sbi 0x1b, 5 ; 27
if ((PINA&0B01000000)==0)
20a: ce 99 sbic 0x19, 6 ; 25
20c: 08 c0 rjmp .+16 ; 0x21e <key_scan+0x20>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
20e: 84 ec ldi r24, 0xC4 ; 196
210: 99 e0 ldi r25, 0x09 ; 9
212: 01 97 sbiw r24, 0x01 ; 1
214: f1 f7 brne .-4 ; 0x212 <key_scan+0x14>
PORTA|=_BV(PA5);
if ((PINA&0B01000000)==0)
{
_delay_ms(10);
if ((PINA&0B01000000)==0)
216: ce 99 sbic 0x19, 6 ; 25
218: 02 c0 rjmp .+4 ; 0x21e <key_scan+0x20>
21a: 21 e0 ldi r18, 0x01 ; 1
21c: 01 c0 rjmp .+2 ; 0x220 <key_scan+0x22>
21e: 25 e0 ldi r18, 0x05 ; 5
key_code=1;
}
if ((PINA&0B10000000)==0)
220: cf 99 sbic 0x19, 7 ; 25
222: 06 c0 rjmp .+12 ; 0x230 <key_scan+0x32>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
224: 84 ec ldi r24, 0xC4 ; 196
226: 99 e0 ldi r25, 0x09 ; 9
228: 01 97 sbiw r24, 0x01 ; 1
22a: f1 f7 brne .-4 ; 0x228 <key_scan+0x2a>
if ((PINA&0B10000000)==0)
{
_delay_ms(10);
if ((PINA&0B10000000)==0)
22c: cf 9b sbis 0x19, 7 ; 25
22e: 23 e0 ldi r18, 0x03 ; 3
key_code=3;
}
//第二列
PORTA&=~_BV(PA5);
230: dd 98 cbi 0x1b, 5 ; 27
PORTA|=_BV(PA4);
232: dc 9a sbi 0x1b, 4 ; 27
if ((PINA&0B01000000)==0)
234: ce 99 sbic 0x19, 6 ; 25
236: 06 c0 rjmp .+12 ; 0x244 <key_scan+0x46>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
238: 84 ec ldi r24, 0xC4 ; 196
23a: 99 e0 ldi r25, 0x09 ; 9
23c: 01 97 sbiw r24, 0x01 ; 1
23e: f1 f7 brne .-4 ; 0x23c <key_scan+0x3e>
if ((PINA&0B01000000)==0)
{
_delay_ms(10);
if ((PINA&0B01000000)==0)
240: ce 9b sbis 0x19, 6 ; 25
242: 22 e0 ldi r18, 0x02 ; 2
key_code=2;
}
if ((PINA&0B10000000)==0)
244: cf 99 sbic 0x19, 7 ; 25
246: 06 c0 rjmp .+12 ; 0x254 <key_scan+0x56>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
248: 84 ec ldi r24, 0xC4 ; 196
24a: 99 e0 ldi r25, 0x09 ; 9
24c: 01 97 sbiw r24, 0x01 ; 1
24e: f1 f7 brne .-4 ; 0x24c <key_scan+0x4e>
if ((PINA&0B10000000)==0)
{
_delay_ms(10);
if ((PINA&0B10000000)==0)
250: cf 9b sbis 0x19, 7 ; 25
252: 24 e0 ldi r18, 0x04 ; 4
key_code=4;
}
return key_code;
}
254: 82 2f mov r24, r18
256: 99 27 eor r25, r25
258: 08 95 ret
0000025a <main>:
-----------------------------------------------*/
int main(void)
{
25a: 80 ef ldi r24, 0xF0 ; 240
25c: 87 bb out 0x17, r24 ; 23
uint8_t key_v;
unsigned char a;
DDRB=0XF0;
DDRD=0XF0;
25e: 81 bb out 0x11, r24 ; 17
LCD_init();
260: 0e 94 8c 00 call 0x118 ; 0x118 <LCD_init>
while(1)
{
key_v=key_scan();
264: 0e 94 ff 00 call 0x1fe ; 0x1fe <key_scan>
a=data_10[key_v];
268: e8 2f mov r30, r24
26a: ff 27 eor r31, r31
26c: e0 5a subi r30, 0xA0 ; 160
26e: ff 4f sbci r31, 0xFF ; 255
270: 40 81 ld r20, Z
//LCD_write_char(2,1,a);
if(key_v!=5)
272: 85 30 cpi r24, 0x05 ; 5
274: b9 f3 breq .-18 ; 0x264 <main+0xa>
{
LCD_write_char(2,0,a);
276: 60 e0 ldi r22, 0x00 ; 0
278: 82 e0 ldi r24, 0x02 ; 2
27a: 0e 94 f1 00 call 0x1e2 ; 0x1e2 <LCD_write_char>
27e: f2 cf rjmp .-28 ; 0x264 <main+0xa>
00000280 <LCD_self_def>:
1 ADD为数据的地址;
2 table为相应的数据
-------------------------------------------------------------*/
void LCD_self_def(uint8_t add,uint8_t table[])
{
280: ef 92 push r14
282: ff 92 push r15
284: 0f 93 push r16
286: 1f 93 push r17
288: cf 93 push r28
28a: df 93 push r29
28c: e8 2e mov r14, r24
28e: eb 01 movw r28, r22
290: ff 24 eor r15, r15
uint8_t i;
for (i=0;i<8;i++)
{
LCD_write(add+i,0); // 设置自定义字符的 CGRAM 地址
292: 60 e0 ldi r22, 0x00 ; 0
294: 8e 2d mov r24, r14
296: 8f 0d add r24, r15
298: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
29c: 04 ef ldi r16, 0xF4 ; 244
29e: 11 e0 ldi r17, 0x01 ; 1
2a0: c8 01 movw r24, r16
2a2: 01 97 sbiw r24, 0x01 ; 1
2a4: f1 f7 brne .-4 ; 0x2a2 <LCD_self_def+0x22>
for (i=0;i<8;i++)
{
LCD_write(add+i,0); // 设置自定义字符的 CGRAM 地址
_delay_ms(2);
LCD_write(0,table[i]); // 向CGRAM写入自定义字符表的数据
2a6: 69 91 ld r22, Y+
2a8: 80 e0 ldi r24, 0x00 ; 0
2aa: 0e 94 59 00 call 0xb2 ; 0xb2 <LCD_write>
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
2ae: c8 01 movw r24, r16
2b0: 01 97 sbiw r24, 0x01 ; 1
2b2: f1 f7 brne .-4 ; 0x2b0 <LCD_self_def+0x30>
void LCD_self_def(uint8_t add,uint8_t table[])
{
uint8_t i;
for (i=0;i<8;i++)
2b4: f3 94 inc r15
2b6: 98 e0 ldi r25, 0x08 ; 8
2b8: f9 16 cp r15, r25
2ba: 59 f7 brne .-42 ; 0x292 <LCD_self_def+0x12>
2bc: df 91 pop r29
2be: cf 91 pop r28
2c0: 1f 91 pop r17
2c2: 0f 91 pop r16
2c4: ff 90 pop r15
2c6: ef 90 pop r14
2c8: 08 95 ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -