📄 解读.lst
字号:
__text_start:
__start:
003A E5CF LDI R28,0x5F
003B E0D4 LDI R29,4
003C BFCD OUT 0x3D,R28
003D BFDE OUT 0x3E,R29
003E 51C0 SUBI R28,0x10
003F 40D0 SBCI R29,0
0040 EA0A LDI R16,0xAA
0041 8308 STD Y+0,R16
0042 2400 CLR R0
0043 E6EE LDI R30,0x6E
0044 E0F0 LDI R31,0
0045 E010 LDI R17,0
0046 37E0 CPI R30,0x70
0047 07F1 CPC R31,R17
0048 F011 BEQ 0x004B
0049 9201 ST R0,Z+
004A CFFB RJMP 0x0046
004B 8300 STD Z+0,R16
004C E6E6 LDI R30,0x66
004D E0F0 LDI R31,0
004E E6A0 LDI R26,0x60
004F E0B0 LDI R27,0
0050 E010 LDI R17,0
0051 37E4 CPI R30,0x74
0052 07F1 CPC R31,R17
0053 F021 BEQ 0x0058
0054 95C8 LPM
0055 9631 ADIW R30,1
0056 920D ST R0,X+
0057 CFF9 RJMP 0x0051
0058 940E0385 CALL _main
_exit:
005A CFFF RJMP _exit
FILE: E:\单片机\AVR程序\红外解读\12864.h
(0001)
(0002) /*------宏定义------*/
(0003) #define uchar unsigned char
(0004) #define uint unsigned int
(0005)
(0006) //串行通信
(0007)
(0008) #define PORT PORTA //选择引脚口
(0009)
(0010) #define setRS PORT|=(1<<1) //串行的片选信号
(0011) #define clearRS PORT&=~(1<<1)
(0012)
(0013) #define setRW PORT|=(1<<2) //串行的数据口
(0014) #define clearRW PORT&=~(1<<2)
(0015)
(0016) #define setCKL PORT|=(1<<3),delay_nus(1) //串行的同步时钟
(0017) #define clearCKL PORT&=~(1<<3),delay_nus(1)
(0018)
(0019) #define Clear WriteCommand(0x01),delay_nms(5) //清屏
(0020)
(0021)
(0022)
(0023) /*-----------------------------------------------------------------------
(0024) 延时函数
(0025) 系统时钟:8M
(0026) -----------------------------------------------------------------------*/
(0027) void delay_1us(void) //1us延时函数
(0028) {
(0029) asm("nop");
_delay_1us:
005B 0000 NOP
005C 9508 RET
_delay_nus:
i --> R20
n --> R22
005D 940E044F CALL push_gset2
005F 01B8 MOVW R22,R16
(0030) }
(0031) void delay_nus(unsigned int n) //N us延时函数
(0032) {
(0033) unsigned int i=0;
0060 2744 CLR R20
0061 2755 CLR R21
(0034) for (i=0;i<n;i++)
0062 C003 RJMP 0x0066
(0035) delay_1us();
0063 DFF7 RCALL _delay_1us
0064 5F4F SUBI R20,0xFF
0065 4F5F SBCI R21,0xFF
0066 1746 CP R20,R22
0067 0757 CPC R21,R23
0068 F3D0 BCS 0x0063
0069 940E0440 CALL pop_gset2
006B 9508 RET
(0036) }
(0037) void delay_1ms(void) //1ms延时函数
(0038) {
(0039) unsigned int i;
(0040) for (i=0;i<1140;i++);
_delay_1ms:
i --> R16
006C 2700 CLR R16
006D 2711 CLR R17
006E C002 RJMP 0x0071
006F 5F0F SUBI R16,0xFF
0070 4F1F SBCI R17,0xFF
0071 3704 CPI R16,0x74
0072 E0E4 LDI R30,4
0073 071E CPC R17,R30
0074 F3D0 BCS 0x006F
0075 9508 RET
_delay_nms:
i --> R20
n --> R22
0076 940E044F CALL push_gset2
0078 01B8 MOVW R22,R16
(0041) }
(0042) void delay_nms(unsigned int n) //N ms延时函数
(0043) {
(0044) unsigned int i=0;
0079 2744 CLR R20
007A 2755 CLR R21
(0045) for (i=0;i<n;i++)
007B C003 RJMP 0x007F
(0046) delay_1ms();
007C DFEF RCALL _delay_1ms
007D 5F4F SUBI R20,0xFF
007E 4F5F SBCI R21,0xFF
007F 1746 CP R20,R22
0080 0757 CPC R21,R23
0081 F3D0 BCS 0x007C
0082 940E0440 CALL pop_gset2
0084 9508 RET
_send_8bit:
i --> R20
ch --> R22
0085 940E044F CALL push_gset2
0087 2F60 MOV R22,R16
(0047) }
(0048) /*-----------------------------------------------------------------------
(0049) 延时函数
(0050) 系统时钟:8M
(0051) -----------------------------------------------------------------------*/
(0052)
(0053)
(0054) //发送8位数据
(0055) void send_8bit(uchar ch)
(0056) {
(0057) char i;
(0058) for(i=0;i<8;i++)
0088 2744 CLR R20
0089 C013 RJMP 0x009D
(0059) { setCKL;
008A 9ADB SBI 0x1B,3
008B E001 LDI R16,1
008C E010 LDI R17,0
008D DFCF RCALL _delay_nus
(0060) if((ch<<i)&0x80)setRW;
008E 2F06 MOV R16,R22
008F 2F14 MOV R17,R20
0090 940E0485 CALL lsl8
0092 2F80 MOV R24,R16
0093 7880 ANDI R24,0x80
0094 F011 BEQ 0x0097
0095 9ADA SBI 0x1B,2
0096 C001 RJMP 0x0098
(0061) else clearRW;
0097 98DA CBI 0x1B,2
(0062) clearCKL;
0098 98DB CBI 0x1B,3
0099 E001 LDI R16,1
009A E010 LDI R17,0
009B DFC1 RCALL _delay_nus
009C 9543 INC R20
009D 3048 CPI R20,0x8
009E F358 BCS 0x008A
009F 940E0440 CALL pop_gset2
00A1 9508 RET
_WriteData:
data --> R20
00A2 940E0451 CALL push_gset1
00A4 2F40 MOV R20,R16
(0063) }
(0064) }
(0065) //写数据
(0066) void WriteData(uchar data)//
(0067) {
(0068) setRS;
00A5 9AD9 SBI 0x1B,1
(0069) send_8bit(0xfa);
00A6 EF0A LDI R16,0xFA
00A7 DFDD RCALL _send_8bit
(0070) send_8bit(data&0xf0);
00A8 2F04 MOV R16,R20
00A9 7F00 ANDI R16,0xF0
00AA DFDA RCALL _send_8bit
(0071) send_8bit(data<<4);
00AB 2F04 MOV R16,R20
00AC 700F ANDI R16,0xF
00AD 9502 SWAP R16
00AE DFD6 RCALL _send_8bit
(0072) clearRS;
00AF 98D9 CBI 0x1B,1
00B0 940E0454 CALL pop_gset1
00B2 9508 RET
_WriteCommand:
command --> R20
00B3 940E0451 CALL push_gset1
00B5 2F40 MOV R20,R16
(0073) }
(0074) //写地址
(0075) void WriteCommand(uchar command)//
(0076) {
(0077) setRS;
00B6 9AD9 SBI 0x1B,1
(0078) send_8bit(0xf8);
00B7 EF08 LDI R16,0xF8
00B8 DFCC RCALL _send_8bit
(0079) send_8bit(command&0xf0);
00B9 2F04 MOV R16,R20
00BA 7F00 ANDI R16,0xF0
00BB DFC9 RCALL _send_8bit
(0080) send_8bit(command<<4);
00BC 2F04 MOV R16,R20
00BD 700F ANDI R16,0xF
00BE 9502 SWAP R16
00BF DFC5 RCALL _send_8bit
(0081) clearRS;
00C0 98D9 CBI 0x1B,1
00C1 940E0454 CALL pop_gset1
00C3 9508 RET
_guangbiao:
x --> R20
00C4 940E0451 CALL push_gset1
00C6 2F40 MOV R20,R16
(0082) }
(0083) //光标开关,1开,0关
(0084) void guangbiao(uchar x) //
(0085) {
(0086) if(x==1) WriteCommand(0x0c|0x03);
00C7 3041 CPI R20,1
00C8 F419 BNE 0x00CC
00C9 E00F LDI R16,0xF
00CA DFE8 RCALL _WriteCommand
00CB C002 RJMP 0x00CE
(0087) else WriteCommand(0x0c);
00CC E00C LDI R16,0xC
00CD DFE5 RCALL _WriteCommand
00CE 940E0454 CALL pop_gset1
00D0 9508 RET
_Set_display_Adress:
address --> R20
x --> R22
y --> R20
00D1 940E044F CALL push_gset2
00D3 2F62 MOV R22,R18
00D4 2F40 MOV R20,R16
(0088) }
(0089)
(0090) // 设置显示坐标:y行,x列
(0091) void Set_display_Adress(uchar y,uchar x)//
(0092) {
(0093) uchar address;
(0094) switch(y)
00D5 2755 CLR R21
00D6 3040 CPI R20,0
00D7 0745 CPC R20,R21
00D8 F069 BEQ 0x00E6
00D9 3041 CPI R20,1
00DA E0E0 LDI R30,0
00DB 075E CPC R21,R30
00DC F061 BEQ 0x00E9
00DD 3042 CPI R20,2
00DE E0E0 LDI R30,0
00DF 075E CPC R21,R30
00E0 F059 BEQ 0x00EC
00E1 3043 CPI R20,3
00E2 E0E0 LDI R30,0
00E3 075E CPC R21,R30
00E4 F051 BEQ 0x00EF
00E5 C00B RJMP 0x00F1
(0095) {
(0096) case 0:
(0097) address=0x80+x;
00E6 2F46 MOV R20,R22
00E7 5840 SUBI R20,0x80
(0098) break;
00E8 C008 RJMP 0x00F1
(0099) case 1:
(0100) address=0x90+x;
00E9 2F46 MOV R20,R22
00EA 5740 SUBI R20,0x70
(0101) break;
00EB C005 RJMP 0x00F1
(0102) case 2:
(0103) address=0x88+x;
00EC 2F46 MOV R20,R22
00ED 5748 SUBI R20,0x78
(0104) break;
00EE C002 RJMP 0x00F1
(0105) case 3:
(0106) address=0x98+x;
00EF 2F46 MOV R20,R22
00F0 5648 SUBI R20,0x68
(0107) break;
(0108) }
(0109) WriteCommand(address);
00F1 2F04 MOV R16,R20
00F2 DFC0 RCALL _WriteCommand
00F3 940E0440 CALL pop_gset2
00F5 9508 RET
_display_String:
i --> R20
s --> R22
x --> R10
y --> R12
00F6 940E0449 CALL push_gset5
00F8 2EA2 MOV R10,R18
00F9 2EC0 MOV R12,R16
00FA 856A LDD R22,Y+10
00FB 857B LDD R23,Y+11
(0110) }
(0111) //显示字符串
(0112) void display_String(uchar y,uchar x,uchar *s) //
(0113) {
(0114) uchar i=0;
00FC 2744 CLR R20
(0115) if(*s=='\0')return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -