📄 uarttest1.s
字号:
.module uarttest1.c
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\alf\MYDOCU~1\开发板\调试程序\ADC\uarttest1.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 9
; //ICC-AVR application builder : 2005-3-9 下午 11:22:18
; // Target : M8
; // Crystal: 11.0592Mhz
;
; #include <iom8v.h>
; #include <macros.h>
;
; void port_init(void)
; {
.dbline 10
; PORTB = 0xFF;
ldi R24,255
out 0x18,R24
.dbline 11
; DDRB = 0x00;
clr R2
out 0x17,R2
.dbline 12
; PORTC = 0x7F; //m103 output only
ldi R24,127
out 0x15,R24
.dbline 13
; DDRC = 0x00;
out 0x14,R2
.dbline 14
; PORTD = 0xFF;
ldi R24,255
out 0x12,R24
.dbline 15
; DDRD = 0x00;
out 0x11,R2
.dbline -2
.dbline 16
; }
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e uart0_init _uart0_init fV
.even
_uart0_init::
.dbline -1
.dbline 24
;
; //UART0 initialisation
; // desired baud rate: 19200
; // actual: baud rate:19200 (0.0%)
; // char size: 8 bit
; // parity: Disabled
; void uart0_init(void)
; {
.dbline 25
; UCSRB = 0x00; //disable while setting baud rate
clr R2
out 0xa,R2
.dbline 26
; UCSRA = 0x00;
out 0xb,R2
.dbline 27
; UCSRC = 0x86;
ldi R24,134
out 0x20,R24
.dbline 28
; UBRRL = 0x23; //set baud rate lo
ldi R24,35
out 0x9,R24
.dbline 29
; UBRRH = 0x00; //set baud rate hi
out 0x20,R2
.dbline 30
; UCSRB = 0xD8;
ldi R24,216
out 0xa,R24
.dbline -2
.dbline 31
; }
L2:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 22
rjmp _uart0_rx_isr
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\alf\MYDOCU~1\开发板\调试程序\ADC\uarttest1.c
.dbfunc e uart0_rx_isr _uart0_rx_isr fV
; temp -> R16
.even
_uart0_rx_isr::
st -y,R16
in R16,0x3f
st -y,R16
.dbline -1
.dbline 35
;
; #pragma interrupt_handler uart0_rx_isr:12
; void uart0_rx_isr(void)
; {
.dbline 38
; //uart has received a character in UDR
; char temp;
; temp =UDR;
in R16,0xc
.dbline 39
; UDR = temp;
out 0xc,R16
.dbline -2
.dbline 40
; }
L3:
ld R16,y+
out 0x3f,R16
ld R16,y+
.dbline 0 ; func end
reti
.dbsym r temp 16 c
.dbend
.area vector(rom, abs)
.org 26
rjmp _uart0_tx_isr
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\alf\MYDOCU~1\开发板\调试程序\ADC\uarttest1.c
.dbfunc e uart0_tx_isr _uart0_tx_isr fV
.even
_uart0_tx_isr::
.dbline -1
.dbline 44
;
; #pragma interrupt_handler uart0_tx_isr:14
; void uart0_tx_isr(void)
; {;
.dbline 44
.dbline -2
.dbline 47
; //character has been transmitted
; //UDR = 0x5a;
; }
L4:
.dbline 0 ; func end
reti
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 51
;
; //call this routine to initialise all peripherals
; void init_devices(void)
; {
.dbline 53
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 54
; port_init();
rcall _port_init
.dbline 55
; uart0_init();
rcall _uart0_init
.dbline 57
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 58
; GICR = 0x00;
out 0x3b,R2
.dbline 59
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 60
; SEI(); //re-enable interrupts
sei
.dbline -2
.dbline 62
; //all peripherals are now initialised
; }
L5:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 66
;
; //
; void main(void)
; {
.dbline 67
; init_devices();
rcall _init_devices
L7:
.dbline 70
L8:
.dbline 70
rjmp L7
X0:
.dbline -2
.dbline 71
; //insert your functional code here...
; // UDR = 2;
; while(1);
; }
L6:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -