?? adcsing.lst
字號:
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 1
ARM COMPILER V2.32c, COMPILATION OF MODULE ADCsing
OBJECT MODULE PLACED IN ADCsing.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe ADCsing.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 : ADCsing.c
8
9 Hardware : Applicable to ADuC702x rev H or I silicon
10 Currently targetting ADuC7026.
11
12 Description : Performs single ADC conversions on ADC0,
13 and send the result through UART at 9600bps
14
15 *********************************************************************/
16 #include <ADuC7026.h>
17
18 void senddata(short);
19 void ADCpoweron(int);
20 char hex2ascii(char);
21
22 int main (void) {
23 1
24 1 ADCpoweron(20000); // power on ADC
25 1 ADCCP = 0x00; //
26 1 REFCON = 0x01; // connect internal 2.5V reference to Vref pin
27 1
28 1 GP0CON = 0x010100000; // enable ECLK output on P0.7, and ADCbusy on P0.5
29 1
30 1 GP4DAT = 0x04040000; // P4.2 configured as an output. LED is turned on
31 1
32 1 GP1CON = 0x011; // Setup tx & rx pins on P1.0 and P1.1
33 1
34 1 // Setting up UART at 9600 (CD=0)
35 1 COMCON0 = 0x80; // Setting DLAB
36 1 COMDIV0 = 0x88; //
37 1 COMDIV1 = 0x00;
38 1 COMCON0 = 0x07; // Clearing DLAB
39 1
40 1 while(1)
41 1 {
42 2 ADCCON = 0x7E3; // ADC config: fADC/2, acq. time = 16 clocks => ADC Speed = 1MSPS
43 2 while (!ADCSTA){} // wait for end of conversion
44 2 senddata (ADCDAT >> 16);
45 2 GP4DAT ^= 0x00040000; // Complement P4.2
46 2 }
47 1 }
48
49
50 void senddata(short to_send)
51 {
52 1 while(!(0x020==(COMSTA0 & 0x020))){}
53 1 COMTX = 0x0A; // output LF
54 1 while(!(0x020==(COMSTA0 & 0x020))){}
55 1 COMTX = 0x0D; // output CR
56 1 while(!(0x020==(COMSTA0 & 0x020))){}
57 1 COMTX = hex2ascii ((to_send >> 8) & 0x0F);
58 1 while(!(0x020==(COMSTA0 & 0x020))){}
59 1 COMTX = hex2ascii ((to_send >> 4) & 0x0F);
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 2
60 1 while(!(0x020==(COMSTA0 & 0x020))){}
61 1 COMTX = hex2ascii (to_send & 0x0F);
62 1
63 1
64 1 }
65
66
67 char hex2ascii(char toconv)
68 {
69 1 if (toconv<0x0A)
70 1 {
71 2 toconv += 0x30;
72 2 }
73 1 else
74 1 {
75 2 toconv += 0x37;
76 2 }
77 1
78 1 return (toconv);
79 1 }
80
81 void ADCpoweron(int time)
82 {
83 1 ADCCON = 0x20; // power-on the ADC
84 1 while (time >=0) // wait for ADC to be fully powered on
85 1 time--;
86 1 }
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC senddata?T
PUBLIC ADCpoweron?T
PUBLIC hex2ascii?T
PUBLIC main
*** CODE SEGMENT '?PR?main?ADCsing':
22: int main (void) {
00000000 B500 PUSH {LR}
24: ADCpoweron(20000); // power on ADC
00000002 4800 LDR R0,=0x4E20
00000004 F7FF BL ADCpoweron?T ; T=0x0001 (1)
00000006 FFFC BL ADCpoweron?T ; T=0x0001 (2)
25: ADCCP = 0x00; //
00000008 2100 MOV R1,#0x0
0000000A 4800 LDR R0,=0xFFFF0504
0000000C 6001 STR R1,[R0,#0x0]
26: REFCON = 0x01; // connect internal 2.5V reference to Vref pin
0000000E 2101 MOV R1,#0x1
00000010 4800 LDR R0,=0xFFFF048C
00000012 6001 STR R1,[R0,#0x0]
28: GP0CON = 0x010100000; // enable ECLK output on P0.7, and ADCbusy on P0.5
00000014 4800 LDR R1,=0x10100000
00000016 4800 LDR R0,=0xFFFFF400
00000018 6001 STR R1,[R0,#0x0]
30: GP4DAT = 0x04040000; // P4.2 configured as an output. LED is turned on
0000001A 4800 LDR R1,=0x4040000
0000001C 4800 LDR R0,=0xFFFFF460
0000001E 6001 STR R1,[R0,#0x0]
32: GP1CON = 0x011; // Setup tx & rx pins on P1.0 and P1.1
00000020 2111 MOV R1,#0x11
00000022 4800 LDR R0,=0xFFFFF404
00000024 6001 STR R1,[R0,#0x0]
35: COMCON0 = 0x80; // Setting DLAB
00000026 2180 MOV R1,#0x80
00000028 4800 LDR R0,=0xFFFF070C
0000002A 6001 STR R1,[R0,#0x0]
36: COMDIV0 = 0x88; //
0000002C 2188 MOV R1,#0x88
0000002E 4800 LDR R0,=0xFFFF0700
00000030 6001 STR R1,[R0,#0x0]
37: COMDIV1 = 0x00;
00000032 2100 MOV R1,#0x0
00000034 4800 LDR R0,=0xFFFF0704
00000036 6001 STR R1,[R0,#0x0]
38: COMCON0 = 0x07; // Clearing DLAB
00000038 2107 MOV R1,#0x7
0000003A 4800 LDR R0,=0xFFFF070C
0000003C 6001 STR R1,[R0,#0x0]
40: while(1)
0000003E L_3:
42: ADCCON = 0x7E3; // ADC config: fADC/2, acq. time = 16 clocks => ADC Speed = 1MSPS
0000003E 4800 LDR R1,=0x7E3
00000040 4800 LDR R0,=0xFFFF0500
00000042 6001 STR R1,[R0,#0x0]
43: while (!ADCSTA){} // wait for end of conversion
00000044 L_5:
00000044 4800 LDR R0,=0xFFFF050C
00000046 6800 LDR R0,[R0,#0x0]
00000048 2800 CMP R0,#0x0
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 4
0000004A D0FB BEQ L_5 ; T=0x00000044
44: senddata (ADCDAT >> 16);
0000004C 4800 LDR R0,=0xFFFF0510
0000004E 6800 LDR R0,[R0,#0x0]
00000050 0C00 LSR R0,R0,#0x10
00000052 F7FF BL senddata?T ; T=0x0001 (1)
00000054 FFD5 BL senddata?T ; T=0x0001 (2)
45: GP4DAT ^= 0x00040000; // Complement P4.2
00000056 4800 LDR R2,=0x40000
00000058 4800 LDR R0,=0xFFFFF460
0000005A 6801 LDR R1,[R0,#0x0]
0000005C 4051 EOR R1,R2
0000005E 6001 STR R1,[R0,#0x0]
46: }
00000060 E7ED B L_3 ; T=0x0000003E
47: }
00000062 BC08 POP {R3}
00000064 4718 BX R3
00000066 ENDP ; 'main'
*** CODE SEGMENT '?PR?senddata?T?ADCsing':
50: void senddata(short to_send)
00000000 B510 PUSH {R4,LR}
00000002 1C04 MOV R4,R0 ; to_send
00000004 ---- Variable 'to_send' assigned to Register 'R4' ----
52: while(!(0x020==(COMSTA0 & 0x020))){}
00000004 L_9:
00000004 4800 LDR R0,=0xFFFF0714
00000006 6800 LDR R0,[R0,#0x0]
00000008 2120 MOV R1,#0x20
0000000A 4208 TST R0,R1
0000000C D0FA BEQ L_9 ; T=0x00000004
53: COMTX = 0x0A; // output LF
0000000E 210A MOV R1,#0xA
00000010 4800 LDR R0,=0xFFFF0700
00000012 6001 STR R1,[R0,#0x0]
54: while(!(0x020==(COMSTA0 & 0x020))){}
00000014 L_13:
00000014 4800 LDR R0,=0xFFFF0714
00000016 6800 LDR R0,[R0,#0x0]
00000018 2120 MOV R1,#0x20
0000001A 4208 TST R0,R1
0000001C D0FA BEQ L_13 ; T=0x00000014
55: COMTX = 0x0D; // output CR
0000001E 210D MOV R1,#0xD
00000020 4800 LDR R0,=0xFFFF0700
00000022 6001 STR R1,[R0,#0x0]
56: while(!(0x020==(COMSTA0 & 0x020))){}
00000024 L_17:
00000024 4800 LDR R0,=0xFFFF0714
00000026 6800 LDR R0,[R0,#0x0]
00000028 2120 MOV R1,#0x20
0000002A 4208 TST R0,R1
0000002C D0FA BEQ L_17 ; T=0x00000024
57: COMTX = hex2ascii ((to_send >> 8) & 0x0F);
0000002E 1C20 MOV R0,R4 ; to_send
00000030 0400 LSL R0,R0,#0x10 ; to_send
00000032 1400 ASR R0,R0,#0x10
00000034 1200 ASR R0,R0,#0x8
00000036 210F MOV R1,#0xF
00000038 4008 AND R0,R1
0000003A F7FF BL hex2ascii?T ; T=0x0001 (1)
0000003C FFE1 BL hex2ascii?T ; T=0x0001 (2)
0000003E 0601 LSL R1,R0,#0x18 ; hex2ascii?T
00000040 0E09 LSR R1,R1,#0x18
00000042 4800 LDR R0,=0xFFFF0700
00000044 6001 STR R1,[R0,#0x0]
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 5
58: while(!(0x020==(COMSTA0 & 0x020))){}
00000046 L_21:
00000046 4800 LDR R0,=0xFFFF0714
00000048 6800 LDR R0,[R0,#0x0]
0000004A 2120 MOV R1,#0x20
0000004C 4208 TST R0,R1
0000004E D0FA BEQ L_21 ; T=0x00000046
59: COMTX = hex2ascii ((to_send >> 4) & 0x0F);
00000050 1C20 MOV R0,R4 ; to_send
00000052 0400 LSL R0,R0,#0x10 ; to_send
00000054 1400 ASR R0,R0,#0x10
00000056 1100 ASR R0,R0,#0x4
00000058 210F MOV R1,#0xF
0000005A 4008 AND R0,R1
0000005C F7FF BL hex2ascii?T ; T=0x0001 (1)
0000005E FFD0 BL hex2ascii?T ; T=0x0001 (2)
00000060 0601 LSL R1,R0,#0x18 ; hex2ascii?T
00000062 0E09 LSR R1,R1,#0x18
00000064 4800 LDR R0,=0xFFFF0700
00000066 6001 STR R1,[R0,#0x0]
60: while(!(0x020==(COMSTA0 & 0x020))){}
00000068 L_25:
00000068 4800 LDR R0,=0xFFFF0714
0000006A 6800 LDR R0,[R0,#0x0]
0000006C 2120 MOV R1,#0x20
0000006E 4208 TST R0,R1
00000070 D0FA BEQ L_25 ; T=0x00000068
61: COMTX = hex2ascii (to_send & 0x0F);
00000072 1C20 MOV R0,R4 ; to_send
00000074 0400 LSL R0,R0,#0x10 ; to_send
00000076 1400 ASR R0,R0,#0x10
00000078 210F MOV R1,#0xF
0000007A 4008 AND R0,R1
0000007C F7FF BL hex2ascii?T ; T=0x0001 (1)
0000007E FFC0 BL hex2ascii?T ; T=0x0001 (2)
00000080 0601 LSL R1,R0,#0x18 ; hex2ascii?T
00000082 0E09 LSR R1,R1,#0x18
00000084 4800 LDR R0,=0xFFFF0700
00000086 6001 STR R1,[R0,#0x0]
64: }
00000088 BC10 POP {R4}
0000008A BC08 POP {R3}
0000008C 4718 BX R3
0000008E ENDP ; 'senddata?T'
*** CODE SEGMENT '?PR?hex2ascii?T?ADCsing':
67: char hex2ascii(char toconv)
00000000 1C01 MOV R1,R0 ; toconv
00000002 ---- Variable 'toconv' assigned to Register 'R1' ----
69: if (toconv<0x0A)
00000002 1C08 MOV R0,R1 ; toconv
00000004 0600 LSL R0,R0,#0x18 ; toconv
00000006 0E00 LSR R0,R0,#0x18
00000008 280A CMP R0,#0xA
0000000A DA03 BGE L_29 ; T=0x00000014
71: toconv += 0x30;
0000000C 3130 ADD R1,#0x30
0000000E 0609 LSL R1,R1,#0x18
00000010 0E09 LSR R1,R1,#0x18
72: }
00000012 E002 B L_30 ; T=0x0000001A
00000014 L_29:
75: toconv += 0x37;
00000014 3137 ADD R1,#0x37
00000016 0609 LSL R1,R1,#0x18
00000018 0E09 LSR R1,R1,#0x18
76: }
ARM COMPILER V2.32c, ADCsing 10/09/05 18:07:32 PAGE 6
0000001A L_30:
78: return (toconv);
0000001A 1C08 MOV R0,R1 ; toconv
0000001C 0600 LSL R0,R0,#0x18 ; toconv
0000001E 0E00 LSR R0,R0,#0x18
79: }
00000020 4770 BX R14
00000022 ENDP ; 'hex2ascii?T'
*** CODE SEGMENT '?PR?ADCpoweron?T?ADCsing':
81: void ADCpoweron(int time)
00000000 ---- Variable 'time' assigned to Register 'R0' ----
83: ADCCON = 0x20; // power-on the ADC
00000000 2220 MOV R2,#0x20
00000002 4800 LDR R1,=0xFFFF0500
00000004 600A STR R2,[R1,#0x0]
84: while (time >=0) // wait for ADC to be fully powered on
00000006 E000 B L_32 ; T=0x0000000A
00000008 L_34:
00000008 3801 SUB R0,#0x1
0000000A L_32:
0000000A 1C01 MOV R1,R0 ; time
0000000C 2900 CMP R1,#0x0 ; time
0000000E DAFB BGE L_34 ; T=0x00000008
86: }
00000010 4770 BX R14
00000012 ENDP ; 'ADCpoweron?T'
Module Information Static
----------------------------------
code size = ------
data size = ------
const size = ------
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -