📄 uart_led.lst
字号:
__text_start:
__start:
0013 E5CF LDI R28,0x5F
0014 E0D4 LDI R29,4
0015 BFCD OUT 0x3D,R28
0016 BFDE OUT 0x3E,R29
0017 51C0 SUBI R28,0x10
0018 40D0 SBCI R29,0
0019 EA0A LDI R16,0xAA
001A 8308 STD Y+0,R16
001B 2400 CLR R0
001C E6E0 LDI R30,0x60
001D E0F0 LDI R31,0
001E E010 LDI R17,0
001F 36E0 CPI R30,0x60
0020 07F1 CPC R31,R17
0021 F011 BEQ 0x0024
0022 9201 ST R0,Z+
0023 CFFB RJMP 0x001F
0024 8300 STD Z+0,R16
0025 E2E6 LDI R30,0x26
0026 E0F0 LDI R31,0
0027 E6A0 LDI R26,0x60
0028 E0B0 LDI R27,0
0029 E010 LDI R17,0
002A 32E6 CPI R30,0x26
002B 07F1 CPC R31,R17
002C F021 BEQ 0x0031
002D 95C8 LPM
002E 9631 ADIW R30,1
002F 920D ST R0,X+
0030 CFF9 RJMP 0x002A
0031 D029 RCALL _main
_exit:
0032 CFFF RJMP _exit
FILE: C:\DOCUME~1\alf\MYDOCU~1\开发板\调试程序\uart\uart.c
(0001) //ICC-AVR application builder : 2005-3-8 下午 09:54:40
(0002) // Target : M8
(0003) // Crystal: 11.059Mhz
(0004)
(0005) #include <iom8v.h>
(0006) #include <macros.h>
(0007)
(0008) void port_init(void)
(0009) {
(0010) PORTB = 0xFF;
_port_init:
0033 EF8F LDI R24,0xFF
0034 BB88 OUT 0x18,R24
(0011) DDRB = 0x00;
0035 2422 CLR R2
0036 BA27 OUT 0x17,R2
(0012) PORTC = 0x7F; //m103 output only
0037 E78F LDI R24,0x7F
0038 BB85 OUT 0x15,R24
(0013) DDRC = 0x00;
0039 BA24 OUT 0x14,R2
(0014) PORTD = 0xFF;
003A EF8F LDI R24,0xFF
003B BB82 OUT 0x12,R24
(0015) DDRD = 0x00;
003C BA21 OUT 0x11,R2
(0016) }
003D 9508 RET
(0017)
(0018) //UART0 initialisation
(0019) // desired baud rate: 9600
(0020) // actual: baud rate:9600 (0.0%)
(0021) // char size: 8 bit
(0022) // parity: Disabled
(0023) void uart0_init(void)
(0024) {
(0025) UCSRB = 0x00; //disable while setting baud rate
_uart0_init:
003E 2422 CLR R2
003F B82A OUT 0x0A,R2
(0026) UCSRA = 0x00;
0040 B82B OUT 0x0B,R2
(0027) UCSRC = 0x86;
0041 E886 LDI R24,0x86
0042 BD80 OUT 0x20,R24
(0028) UBRRL = 0x47; //set baud rate lo
0043 E487 LDI R24,0x47
0044 B989 OUT 0x09,R24
(0029) UBRRH = 0x00; //set baud rate hi
0045 BC20 OUT 0x20,R2
(0030) UCSRB = 0x98;
0046 E988 LDI R24,0x98
0047 B98A OUT 0x0A,R24
(0031) }
0048 9508 RET
_uart0_rx_isr:
temp --> R16
0049 930A ST R16,-Y
004A B70F IN R16,0x3F
004B 930A ST R16,-Y
(0032)
(0033) #pragma interrupt_handler uart0_rx_isr:12
(0034) void uart0_rx_isr(void)
(0035) {
(0036) //uart has received a character in UDR
(0037) char temp;
(0038) temp = UDR;
004C B10C IN R16,0x0C
(0039) UDR = temp;
004D B90C OUT 0x0C,R16
(0040) }
004E 9109 LD R16,Y+
004F BF0F OUT 0x3F,R16
0050 9109 LD R16,Y+
0051 9518 RETI
(0041)
(0042) //call this routine to initialise all peripherals
(0043) void init_devices(void)
(0044) {
(0045) //stop errant interrupts until set up
(0046) CLI(); //disable all interrupts
_init_devices:
0052 94F8 BCLR 7
(0047) port_init();
0053 DFDF RCALL _port_init
(0048) uart0_init();
0054 DFE9 RCALL _uart0_init
(0049)
(0050) MCUCR = 0x00;
0055 2422 CLR R2
0056 BE25 OUT 0x35,R2
(0051) GICR = 0x00;
0057 BE2B OUT 0x3B,R2
(0052) TIMSK = 0x00; //timer interrupt sources
0058 BE29 OUT 0x39,R2
(0053) SEI(); //re-enable interrupts
0059 9478 BSET 7
(0054) //all peripherals are now initialised
(0055) }
005A 9508 RET
(0056)
(0057) //
(0058) void main(void)
(0059) {
(0060) init_devices();
_main:
005B DFF6 RCALL _init_devices
(0061) //insert your functional code here...
(0062) while(1);
005C CFFF RJMP 0x005C
(0063) }
FILE: <library>
005D 9508 RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -