📄 main.lst
字号:
__start:
__text_start:
0046 EFCF LDI R28,0xFF
0047 E1D0 LDI R29,0x10
0048 BFCD OUT 0x3D,R28
0049 BFDE OUT 0x3E,R29
004A 51C0 SUBI R28,0x10
004B 40D0 SBCI R29,0
004C EA0A LDI R16,0xAA
004D 8308 STD Y+0,R16
004E 2400 CLR R0
004F E0E0 LDI R30,0
0050 E0F1 LDI R31,1
0051 E011 LDI R17,1
0052 30E1 CPI R30,1
0053 07F1 CPC R31,R17
0054 F011 BEQ 0x0057
0055 9201 ST R0,Z+
0056 CFFB RJMP 0x0052
0057 8300 STD Z+0,R16
0058 E8EC LDI R30,0x8C
0059 E0F0 LDI R31,0
005A E0A0 LDI R26,0
005B E0B1 LDI R27,1
005C E010 LDI R17,0
005D 38EC CPI R30,0x8C
005E 07F1 CPC R31,R17
005F F021 BEQ 0x0064
0060 95C8 LPM
0061 9631 ADIW R30,1
0062 920D ST R0,X+
0063 CFF9 RJMP 0x005D
0064 940E0067 CALL _main
_exit:
0066 CFFF RJMP _exit
FILE: C:\DOCUME~1\tao\桌面\文档\工程\prj\TIMER\prj\main.c
(0001) //ICC-AVR application builder : 2007-8-13 15:05:41
(0002) // Target : M128
(0003) // Crystal: 7.3728Mhz
(0004)
(0005) #include <iom128v.h>
(0006) #include <macros.h>
(0007) #include "port.h"
(0008) #include "timer.h"
(0009)
(0010)
(0011)
(0012) /*call this routine to initialize all peripherals */
(0013) void main(void)
(0014) {
(0015) UNS8 i;
(0016) //stop errant interrupts until set up
(0017) CLI(); //disable all interrupts
_main:
i --> Y+1
0067 94F8 BCLR 7
(0018)
(0019) port_init();
0068 940E0099 CALL _port_init
(0020)
(0021) timer0_init();
006A 940E0071 CALL _timer0_init
(0022)
(0023) MCUCR = 0x00;//IO
006C 2422 CLR R2
006D BE25 OUT 0x35,R2
(0024)
(0025) /*
(0026) Set_Bit(PORTE,7);
(0027) transmit_byte(0xaa);
(0028) delay(10000);
(0029) Clr_Bit(PORTE,7);
(0030) */
(0031)
(0032) SEI(); //re-enable interrupts
006E 9478 BSET 7
(0033) //all peripherals are now initialized
(0034)
(0035)
(0036) for(;;)
006F CFFF RJMP 0x006F
0070 9508 RET
FILE: C:\DOCUME~1\tao\桌面\文档\工程\prj\TIMER\prj\timer\timer.c
(0001)
(0002) #include <macros.h>
(0003) #include "stdtypes.h"
(0004) #include "timer.h"
(0005)
(0006)
(0007)
(0008) UNS8 time_couter;
(0009)
(0010)
(0011) //TIMER0 initialize - prescale:64
(0012) // WGM: Normal
(0013) // desired value: 1mSec
(0014) // actual value: 0.998mSec (0.2%)
(0015) void timer0_init(void)
(0016) {
(0017) TCCR0 = 0x00; //stop
_timer0_init:
0071 2422 CLR R2
0072 BE23 OUT 0x33,R2
(0018) ASSR = 0x00; //set async mode
0073 BE20 OUT 0x30,R2
(0019) TCNT0 = SET_COUNT; //set count
0074 E88D LDI R24,0x8D
0075 BF82 OUT 0x32,R24
(0020) TCCR0 = 0x07; //start timer
0076 E087 LDI R24,7
0077 BF83 OUT 0x33,R24
(0021) TIMSK = TIMSK | (1 << TOIE0);
0078 B787 IN R24,0x37
0079 6081 ORI R24,1
007A BF87 OUT 0x37,R24
(0022)
(0023) time_couter=0;
007B 92200100 STS time_couter,R2
007D 9508 RET
_timer0_ovf_isr:
007E 922A ST R2,-Y
007F 938A ST R24,-Y
0080 939A ST R25,-Y
0081 B62F IN R2,0x3F
0082 922A ST R2,-Y
(0024) }
(0025)
(0026) #pragma interrupt_handler timer0_ovf_isr:17
(0027) void timer0_ovf_isr(void)
(0028) {
(0029) //CLI(); //disable all interrupts
(0030)
(0031) TCNT0 = SET_COUNT;
0083 E88D LDI R24,0x8D
0084 BF82 OUT 0x32,R24
(0032) /*read the key value*/
(0033)
(0034)
(0035) if(time_couter>10)
0085 E08A LDI R24,0xA
0086 90200100 LDS R2,time_couter
0088 1582 CP R24,R2
0089 F420 BCC 0x008E
(0036) {
(0037) time_couter=0;
008A 2422 CLR R2
008B 92200100 STS time_couter,R2
(0038) }
008D C005 RJMP 0x0093
(0039) else
(0040) {
(0041) time_couter++;
008E 91800100 LDS R24,time_couter
0090 5F8F SUBI R24,0xFF
0091 93800100 STS time_couter,R24
(0042) }
0093 9029 LD R2,Y+
0094 BE2F OUT 0x3F,R2
0095 9199 LD R25,Y+
0096 9189 LD R24,Y+
0097 9029 LD R2,Y+
0098 9518 RETI
FILE: C:\DOCUME~1\tao\桌面\文档\工程\prj\TIMER\prj\port\port.c
(0001) #include <iom128v.h>
(0002)
(0003)
(0004) void port_init(void)//修改
(0005) {
(0006) PORTA = 0x00;
_port_init:
0099 2422 CLR R2
009A BA2B OUT 0x1B,R2
(0007) DDRA = 0x00;
009B BA2A OUT 0x1A,R2
(0008) PORTB = 0x00;
009C BA28 OUT 0x18,R2
(0009) DDRB = 0x00;
009D BA27 OUT 0x17,R2
(0010) PORTC = 0x00;
009E BA25 OUT 0x15,R2
(0011) DDRC = 0x00;//key pc0-6
009F BA24 OUT 0x14,R2
(0012) PORTD = 0x00;
00A0 BA22 OUT 0x12,R2
(0013) DDRD = 0x00;
00A1 BA21 OUT 0x11,R2
(0014) PORTE = 0x00;
00A2 B823 OUT 0x03,R2
(0015) DDRE = 0x00;
00A3 B822 OUT 0x02,R2
(0016) PORTF = 0x00;
00A4 92200062 STS 0x62,R2
(0017) DDRF = 0x00;
00A6 92200061 STS 0x61,R2
(0018) PORTG = 0x00;
00A8 92200065 STS 0x65,R2
(0019) DDRG = 0x00;
FILE: <library>
00AA 92200064 STS 0x64,R2
00AC 9508 RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -