📄 uart1.lst
字号:
ARM COMPILER V2.53, UART1 05/12/07 09:46:43 PAGE 1
ARM COMPILER V2.53, COMPILATION OF MODULE UART1
OBJECT MODULE PLACED IN UART1.OBJ
COMPILER INVOKED BY: d:\Keil\ARM\BIN\CA.exe UART1.c THUMB DEBUG TABS(4)
stmt level source
1 /*********************************************************************
2
3 Author : ADI - Apps www.analog.com/MicroConverter
4
5 Date : Sept. 2005
6
7 File : UART2.c
8
9 Hardware : Applicable to ADuC702x rev H or I silicon
10 Currently targetting ADuC7026.
11
12 Description : This code demonstrates basic UART functionality.
13 The baudrate is calculated with the following formula:
14
15 DL = HCLK
16 _______
17 Baudrate * 2 *16
18
19 ***********************************************************************/
20
21 #include <ADuC7026.h>
22
23 extern int write (int file, char * ptr, int len); // Functions used to
24 extern int getchar (void); // to output data
25 extern int putchar(int); // Write character to Serial Port
26
27
28 int main (void) {
29 1 unsigned char jchar = 0x30;
30 1
31 1 char output1[13] = "Hello World\n";
32 1
33 1 // Setup tx & rx pins on P1.0 and P1.1
34 1 GP1CON = 0x011;
35 1
36 1 // Start setting up UART at 9600bps
37 1 COMCON0 = 0x080; // Setting DLAB
38 1 COMDIV0 = 0x088; // Setting DIV0 and DIV1 to DL calculated
39 1 COMDIV1 = 0x000;
40 1 COMCON0 = 0x007; // Clearing DLAB
41 1
42 1 GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on
43 1
44 1 while(1)
45 1 {
46 2
47 2 GP4DAT ^= 0x00040000; // Complement P4.2
48 2 write(0,output1,13); // Output Data
49 2 jchar = getchar(); // RX Data, Single Byte
50 2 write(0,&jchar,1); // Output Rxed Data
51 2 }
52 1 }
ARM COMPILER V2.53, UART1 05/12/07 09:46:43 PAGE 2
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (write?T)
EXTERN CODE16 (getchar?T)
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC main
*** DATA SEGMENT '?CON?UART1':
00000000 ?tpl?0001:
00000000 BEGIN_INIT
00000000 DB 'Hello World',0x0A,0x00
0000000D END_INIT
*** CODE SEGMENT '?PR?main?UART1':
28: int main (void) {
00000000 B500 PUSH {LR}
00000002 B085 SUB R13,#0x14
00000004 ; SCOPE-START
29: unsigned char jchar = 0x30;
00000004 2130 MOV R1,#0x30
00000006 A800 ADD R0,R13,#0x0
00000008 7001 STRB R1,[R0,#0x0] ; jchar
31: char output1[13] = "Hello World\n";
0000000A 4800 LDR R1,=?tpl?0001 ; ?tpl?0001
0000000C A801 ADD R0,R13,#0x4
0000000E 220D MOV R2,#0xD
00000010 L_6:
00000010 780B LDRB R3,[R1,#0x0]
00000012 7003 STRB R3,[R0,#0x0]
00000014 1C49 ADD R1,R1,#0x1
00000016 1C40 ADD R0,R0,#0x1
00000018 1E52 SUB R2,R2,#0x1
0000001A D1F9 BNE L_6 ; T=0x00000010
34: GP1CON = 0x011;
0000001C 2111 MOV R1,#0x11
0000001E 4800 LDR R0,=0xFFFFF404
00000020 6001 STR R1,[R0,#0x0]
37: COMCON0 = 0x080; // Setting DLAB
00000022 2180 MOV R1,#0x80
00000024 4800 LDR R0,=0xFFFF070C
00000026 6001 STR R1,[R0,#0x0]
38: COMDIV0 = 0x088; // Setting DIV0 and DIV1 to DL calculated
00000028 2188 MOV R1,#0x88
0000002A 4800 LDR R0,=0xFFFF0700
0000002C 6001 STR R1,[R0,#0x0]
39: COMDIV1 = 0x000;
0000002E 2100 MOV R1,#0x0
00000030 4800 LDR R0,=0xFFFF0704
00000032 6001 STR R1,[R0,#0x0]
40: COMCON0 = 0x007; // Clearing DLAB
00000034 2107 MOV R1,#0x7
00000036 4800 LDR R0,=0xFFFF070C
00000038 6001 STR R1,[R0,#0x0]
42: GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on
0000003A 4800 LDR R1,=0x4000000
0000003C 4800 LDR R0,=0xFFFFF460
0000003E 6001 STR R1,[R0,#0x0]
44: while(1)
00000040 L_3:
47: GP4DAT ^= 0x00040000; // Complement P4.2
00000040 4800 LDR R2,=0x40000
00000042 4800 LDR R0,=0xFFFFF460
ARM COMPILER V2.53, UART1 05/12/07 09:46:43 PAGE 3
00000044 6801 LDR R1,[R0,#0x0]
00000046 4051 EOR R1,R2
00000048 6001 STR R1,[R0,#0x0]
48: write(0,output1,13); // Output Data
0000004A A901 ADD R1,R13,#0x4
0000004C 2000 MOV R0,#0x0
0000004E 220D MOV R2,#0xD
00000050 F7FF BL write?T ; T=0x0001 (1)
00000052 FFD6 BL write?T ; T=0x0001 (2)
49: jchar = getchar(); // RX Data, Single Byte
00000054 F7FF BL getchar?T ; T=0x0001 (1)
00000056 FFD4 BL getchar?T ; T=0x0001 (2)
00000058 0601 LSL R1,R0,#0x18 ; getchar?T
0000005A 0E09 LSR R1,R1,#0x18
0000005C A800 ADD R0,R13,#0x0
0000005E 7001 STRB R1,[R0,#0x0] ; jchar
50: write(0,&jchar,1); // Output Rxed Data
00000060 A900 ADD R1,R13,#0x0
00000062 2000 MOV R0,#0x0
00000064 2201 MOV R2,#0x1
00000066 F7FF BL write?T ; T=0x0001 (1)
00000068 FFCB BL write?T ; T=0x0001 (2)
51: }
0000006A E7E9 B L_3 ; T=0x00000040
0000006C ; SCOPE-END
52: }
0000006C B005 ADD R13,#0x14
0000006E BC08 POP {R3}
00000070 4718 BX R3
00000072 ENDP ; 'main'
Module Information Static
----------------------------------
code size = ------
data size = ------
const size = 13
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -