📄 soft_test.lis
字号:
.module soft_test.c
.area text(rom, con, rel)
0000 .dbfile E:\avr\2.5.6\soft_test.c
0000 .dbfunc e port_init _port_init fV
.even
0000 _port_init::
0000 .dbline -1
0000 .dbline 26
0000 ; // Test Soft-Uart : See Atmel Applicaton Note 305
0000 ; // File: soft_test.c
0000 ; // Target : mega16
0000 ; // Crystal: 7.3728 Mhz
0000 ; // Date 05/30/2007
0000 ; // Written/adapted by Dipl.Ing.J.Zastrow
0000 ; // for Imagecraft ICCAVR Ver. 6.31
0000 ; // Usage : if you need more then one UART
0000 ; // Tested with STK500 (Atmel)
0000 ; // Customer settings : SEE soft_uart.s
0000 ; //
0000 ;
0000 ; #include <iom16v.h>
0000 ; #include <macros.h>
0000 ;
0000 ; //function prototypes for soft_uart.s
0000 ; //one byte return value in R16 !!!
0000 ; extern unsigned char getit(void);
0000 ; //one byte argument in R16 !!!
0000 ; extern putit(register unsigned char key);
0000 ; //initialise TxD,RxD port pins
0000 ; extern void init_soft_uart(void);
0000 ;
0000 ;
0000 ; void port_init(void)
0000 ; {
0000 .dbline 28
0000 ; //default settings all inputs and pull up
0000 ; PORTA = 0xFF;
0000 8FEF ldi R24,255
0002 8BBB out 0x1b,R24
0004 .dbline 29
0004 ; DDRA = 0x00;
0004 2224 clr R2
0006 2ABA out 0x1a,R2
0008 .dbline 30
0008 ; PORTB = 0xFF;
0008 88BB out 0x18,R24
000A .dbline 31
000A ; DDRB = 0xFF;
000A 87BB out 0x17,R24
000C .dbline 32
000C ; PORTC = 0xFF;
000C 85BB out 0x15,R24
000E .dbline 33
000E ; DDRC = 0x00;
000E 24BA out 0x14,R2
0010 .dbline 34
0010 ; PORTD = 0xFF;
0010 82BB out 0x12,R24
0012 .dbline 35
0012 ; DDRD = 0x00;
0012 21BA out 0x11,R2
0014 .dbline -2
0014 L1:
0014 .dbline 0 ; func end
0014 0895 ret
0016 .dbend
0016 .dbfunc e init_devices _init_devices fV
.even
0016 _init_devices::
0016 .dbline -1
0016 .dbline 40
0016 ; }
0016 ;
0016 ; //call this routine to initialise all peripherals
0016 ; void init_devices(void)
0016 ; {
0016 .dbline 42
0016 ; //stop errant interrupts until set up
0016 ; CLI(); //disable all interrupts
0016 F894 cli
0018 .dbline 43
0018 ; port_init();
0018 F3DF xcall _port_init
001A .dbline 44
001A ; MCUCR = 0x00;
001A 2224 clr R2
001C 25BE out 0x35,R2
001E .dbline 45
001E ; TIMSK = 0x00;
001E 29BE out 0x39,R2
0020 .dbline 46
0020 ; SEI(); //re-enable interrupts
0020 7894 sei
0022 .dbline -2
0022 L2:
0022 .dbline 0 ; func end
0022 0895 ret
0024 .dbend
.area lit(rom, con, rel)
0000 L4:
0000 7777772E61767276692E636F6D0D0A00 .byte 'w,'w,'w,46,'a,'v,'r,'v,'i,46,'c,'o,'m,13,10,0
.area text(rom, con, rel)
0024 .dbfile E:\avr\2.5.6\soft_test.c
0024 .dbfunc e main _main fV
0024 ; buf -> y+0
0024 ; s -> R20
0024 ; i -> R22
.even
0024 _main::
0024 6097 sbiw R28,16
0026 .dbline -1
0026 .dbline 54
0026 ; //all peripherals are now initialised
0026 ; }
0026 ;
0026 ; //Simply connect RS232 SPARE to
0026 ; //PC2 to receive and PC3 to transmitt
0026 ;
0026 ; void main(void)
0026 ; {
0026 .dbline 55
0026 ; unsigned char s=0,i=0;
0026 4427 clr R20
0028 .dbline 55
0028 6627 clr R22
002A .dbline 56
002A ; unsigned char buf[]="www.avrvi.com\r\n";
002A 80E0 ldi R24,<L4
002C 90E0 ldi R25,>L4
002E FE01 movw R30,R28
0030 00E1 ldi R16,16
0032 10E0 ldi R17,0
0034 FA93 st -y,R31
0036 EA93 st -y,R30
0038 9A93 st -y,R25
003A 8A93 st -y,R24
003C 0E940000 xcall asgncblk
0040 .dbline 58
0040 ; //defaul
0040 ; init_devices();
0040 EADF xcall _init_devices
0042 .dbline 61
0042 ;
0042 ; //do custom settings in soft_uart.s !!!
0042 ; init_soft_uart();
0042 0E940000 xcall _init_soft_uart
0046 .dbline 62
0046 ; for(i=0;i<16;i++)
0046 09C0 xjmp L8
0048 L5:
0048 .dbline 63
0048 .dbline 64
0048 CE01 movw R24,R28
004A E62F mov R30,R22
004C FF27 clr R31
004E E80F add R30,R24
0050 F91F adc R31,R25
0052 0081 ldd R16,z+0
0054 0E940000 xcall _putit
0058 .dbline 65
0058 L6:
0058 .dbline 62
0058 6395 inc R22
005A L8:
005A .dbline 62
005A 6031 cpi R22,16
005C A8F3 brlo L5
005E 1AC0 xjmp L10
0060 L9:
0060 .dbline 66
0060 .dbline 67
0060 04E5 ldi R16,84
0062 0E940000 xcall _putit
0066 .dbline 68
0066 05E4 ldi R16,69
0068 0E940000 xcall _putit
006C .dbline 69
006C 03E5 ldi R16,83
006E 0E940000 xcall _putit
0072 .dbline 70
0072 04E5 ldi R16,84
0074 0E940000 xcall _putit
0078 .dbline 71
0078 0AE3 ldi R16,58
007A 0E940000 xcall _putit
007E .dbline 72
007E 0E940000 xcall _getit
0082 402F mov R20,R16
0084 .dbline 73
0084 0E940000 xcall _putit
0088 .dbline 74
0088 0DE0 ldi R16,13
008A 0E940000 xcall _putit
008E .dbline 75
008E 0AE0 ldi R16,10
0090 0E940000 xcall _putit
0094 .dbline 76
0094 L10:
0094 .dbline 66
0094 E5CF xjmp L9
0096 X0:
0096 .dbline -2
0096 L3:
0096 6096 adiw R28,16
0098 .dbline 0 ; func end
0098 0895 ret
009A .dbsym l buf 0 A[16:16]c
009A .dbsym r s 20 c
009A .dbsym r i 22 c
009A .dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -