?? pwm_ctc.lst
字號(hào):
__start:
__text_start:
001A EFCF LDI R28,0xFF
001B E0D2 LDI R29,2
001C BFCD OUT 0x3D,R28
001D BFDE OUT 0x3E,R29
001E 51C0 SUBI R28,0x10
001F 40D0 SBCI R29,0
0020 EA0A LDI R16,0xAA
0021 8308 STD Y+0,R16
0022 2400 CLR R0
0023 E0E0 LDI R30,0
0024 E0F1 LDI R31,1
0025 E011 LDI R17,1
0026 30E0 CPI R30,0
0027 07F1 CPC R31,R17
0028 F011 BEQ 0x002B
0029 9201 ST R0,Z+
002A CFFB RJMP 0x0026
002B 8300 STD Z+0,R16
002C E3E4 LDI R30,0x34
002D E0F0 LDI R31,0
002E E0A0 LDI R26,0
002F E0B1 LDI R27,1
0030 E010 LDI R17,0
0031 33E4 CPI R30,0x34
0032 07F1 CPC R31,R17
0033 F021 BEQ 0x0038
0034 95C8 LPM
0035 9631 ADIW R30,1
0036 920D ST R0,X+
0037 CFF9 RJMP 0x0031
0038 D03C RCALL _main
_exit:
0039 CFFF RJMP _exit
FILE: F:\avrprojs\pwm_ctc\pwm_ctc.c
(0001) //ICC-AVR application builder : 2008-8-4 下午 05:07:24
(0002) // Target : M48
(0003) // Crystal: 1.0000Mhz
(0004)
(0005) #include <iom48v.h>
(0006) #include <macros.h>
(0007)
(0008) void port_init(void)
(0009) {
(0010) PORTB = 0x00;
_port_init:
003A 2422 CLR R2
003B B825 OUT 0x05,R2
(0011) DDRB = 0x00;
003C B824 OUT 0x04,R2
(0012) PORTC = 0x00; //m103 output only
003D B828 OUT 0x08,R2
(0013) DDRC = 0x00;
003E B827 OUT 0x07,R2
(0014) PORTD = 0x00;
003F B82B OUT 0x0B,R2
(0015) DDRD = 0x60;
0040 E680 LDI R24,0x60
0041 B98A OUT 0x0A,R24
0042 9508 RET
(0016) }
(0017)
(0018) //TIMER0 initialize - prescale:8
(0019) // WGM: CTC
(0020) // desired value: 1000Hz
(0021) // actual value: 992.063Hz (-0.8%)
(0022) void timer0_init(void)
(0023) {
(0024) TCCR0B = 0x00; //stop
_timer0_init:
0043 2422 CLR R2
0044 BC25 OUT 0x25,R2
(0025) TCNT0 = 0x01; //set count
0045 E081 LDI R24,1
0046 BD86 OUT 0x26,R24
(0026) TCCR0A = 0x72;
0047 E782 LDI R24,0x72
0048 BD84 OUT 0x24,R24
(0027) TCCR0B = 0x0b; //start timer
0049 E08B LDI R24,0xB
004A BD85 OUT 0x25,R24
(0028) OCR0A= 0x80;
004B E880 LDI R24,0x80
004C BD87 OUT 0x27,R24
004D 9508 RET
_timer0_compa_isr:
004E 938A ST R24,-Y
004F B78F IN R24,0x3F
0050 938A ST R24,-Y
(0029) }
(0030)
(0031) #pragma interrupt_handler timer0_compa_isr:15
(0032) void timer0_compa_isr(void)
(0033) {
(0034) TCNT0=0x01;
0051 E081 LDI R24,1
0052 BD86 OUT 0x26,R24
(0035) OCR0A= 0x80;
0053 E880 LDI R24,0x80
0054 BD87 OUT 0x27,R24
0055 9189 LD R24,Y+
0056 BF8F OUT 0x3F,R24
0057 9189 LD R24,Y+
0058 9518 RETI
(0036) //compare TCNT0=OCR0A
(0037) }
(0038)
(0039) #pragma interrupt_handler timer0_compb_isr:16
(0040) void timer0_compb_isr(void)
(0041) {
_timer0_compb_isr:
0059 9518 RETI
(0042) //compare TCNT0=OCR0B
(0043) }
(0044)
(0045) //call this routine to initialize all peripherals
(0046) void init_devices(void)
(0047) {
(0048) //stop errant interrupts until set up
(0049) CLI(); //disable all interrupts
_init_devices:
005A 94F8 BCLR 7
(0050) port_init();
005B DFDE RCALL _port_init
(0051) timer0_init();
005C DFE6 RCALL _timer0_init
(0052)
(0053) MCUCR = 0x00;
005D 2422 CLR R2
005E BE25 OUT 0x35,R2
(0054) EICRA = 0x00; //extended ext ints
005F 92200069 STS 0x69,R2
(0055) EIMSK = 0x00;
0061 BA2D OUT 0x1D,R2
(0056)
(0057) TIMSK0 = 0x06; //timer 0 interrupt sources
0062 E086 LDI R24,6
0063 9380006E STS 0x6E,R24
(0058) TIMSK1 = 0x00; //timer 1 interrupt sources
0065 9220006F STS 0x6F,R2
(0059) TIMSK2 = 0x00; //timer 2 interrupt sources
0067 92200070 STS 0x70,R2
(0060)
(0061) PCMSK0 = 0x00; //pin change mask 0
0069 9220006B STS 0x6B,R2
(0062) PCMSK1 = 0x00; //pin change mask 1
006B 9220006C STS 0x6C,R2
(0063) PCMSK2 = 0x00; //pin change mask 2
006D 9220006D STS 0x6D,R2
(0064) PCICR = 0x00; //pin change enable
006F 92200068 STS 0x68,R2
(0065) PRR = 0x00; //power controller
0071 92200064 STS 0x64,R2
(0066) SEI(); //re-enable interrupts
0073 9478 BSET 7
0074 9508 RET
(0067) //all peripherals are now initialized
(0068) }
(0069) void main()
(0070) {
(0071) init_devices();
_main:
0075 DFE4 RCALL _init_devices
(0072)
(0073) while(1)
FILE: <library>
0076 CFFF RJMP 0x0076
0077 9508 RET
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -