📄 main.lst
字号:
ARM COMPILER V2.00f, main 20/02/05 12:31:00 PAGE 1
ARM COMPILER V2.00f, COMPILATION OF MODULE main
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe main.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG TABS(4)
stmt level source
1 /************************************************************/
2 /* PROJECT NAME: RTC */
3 /* Project: LPC2100 Training course */
4 /* Engineer: T Martin tmartin@hitex.co.uk */
5 /* Filename: main.c */
6 /* Language: C */
7 /* Compiler: Keil ARM V2.00b */
8 /* Assembler: */
9 /* */
10 /************************************************************/
11 /* COPYRIGHT: Hitex UK Ltd 2005 */
12 /* LICENSE: THIS VERSION CREATED FOR FREE DISTRIBUTION */
13 /************************************************************/
14 /* Function: */
15 /* */
16 /* */
17 /* */
18 /* Demonstrates configuration and use of the RTC */
19 /* */
20 /* Oscillator frequency 12.000 Mhz */
21 /* Target board Keil MCB2100 */
22 /************************************************************/
23
24 #include <LPC21xx.H>
25
26 void clock(void);
27 void RTC_isr(void)__irq;
28 unsigned counter = 0;
29
30 int main(void)
31 {
32 1 IODIR1 = 0x00FF0000; // set LED ports to output
33 1 IOCLR1 = 0x00FF0000;
34 1 PREINT = 0x00000392; //Set RTC prescaler for 12.000Mhz Xtal
35 1 PREFRAC = 0x00004380;
36 1 CIIR = 0x00000001; //Enable seconds counter interrupt
37 1 SEC = 0x00000000;
38 1 ALSEC = 0x00000003; //Set alarm register for 3 seconds
39 1 AMR = 0x000000FE; //Enable seconds Alarm
40 1 CCR = 0x00000001; //Start the RTC
41 1
42 1 VICVectAddr13 = (unsigned)RTC_isr; //Set the timer ISR vector address
43 1 VICVectCntl13 = 0x0000002D; //Set channel
44 1 VICIntEnable = 0x00002000; //Enable the interrupt
45 1
46 1
47 1
48 1 while(1)
49 1 {
50 2 counter++;
51 2 }
52 1
53 1 }
54
55
56
57
58 void RTC_isr(void) __irq
59 {
ARM COMPILER V2.00f, main 20/02/05 12:31:00 PAGE 2
60 1 unsigned led;
61 1
62 1
63 1 if(ILR&0x00000001) //Test for RTC counter interrupt
64 1 {
65 2 led = IOPIN1; //read the current state of the IO pins
66 2 IOSET1 = 0x00010000; //Set the idle LED
67 2 ILR = 0x00000001; //Clear the interrupt register
68 2 }
69 1
70 1 if(ILR & 0x00000002)
71 1 {
72 2 IOSET1 = 0x00100000; //Set LED 0.7
73 2 ILR = 0x00000002;
74 2 }
75 1 VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
76 1 }
77
ARM COMPILER V2.00f, main 20/02/05 12:31:00 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC RTC_isr?A
PUBLIC main
PUBLIC counter
*** DATA SEGMENT '?DT0?main':
00000000 counter:
00000000 BEGIN_INIT
00000000 00000000 DD 0x0
00000004 END_INIT
*** CODE SEGMENT '?PR?main?main':
30: int main(void)
00000000 B500 PUSH {LR}
32: IODIR1 = 0x00FF0000; // set LED ports to output
00000002 4800 LDR R1,=0xFF0000
00000004 4800 LDR R0,=0xE0028018
00000006 6001 STR R1,[R0,#0x0]
33: IOCLR1 = 0x00FF0000;
00000008 4800 LDR R1,=0xFF0000
0000000A 4800 LDR R0,=0xE002801C
0000000C 6001 STR R1,[R0,#0x0]
34: PREINT = 0x00000392; //Set RTC prescaler for 12.000Mhz Xtal
0000000E 4800 LDRH R1,=0x392
00000010 4800 LDR R0,=0xE0024080
00000012 8001 STRH R1,[R0,#0x0]
35: PREFRAC = 0x00004380;
00000014 4800 LDRH R1,=0x4380
00000016 4800 LDR R0,=0xE0024084
00000018 8001 STRH R1,[R0,#0x0]
36: CIIR = 0x00000001; //Enable seconds counter interrupt
0000001A 2101 MOV R1,#0x1
0000001C 4800 LDR R0,=0xE002400C
0000001E 7001 STRB R1,[R0,#0x0]
37: SEC = 0x00000000;
00000020 2100 MOV R1,#0x0
00000022 4800 LDR R0,=0xE0024020
00000024 7001 STRB R1,[R0,#0x0]
38: ALSEC = 0x00000003; //Set alarm register for 3 seconds
00000026 2103 MOV R1,#0x3
00000028 4800 LDR R0,=0xE0024060
0000002A 7001 STRB R1,[R0,#0x0]
39: AMR = 0x000000FE; //Enable seconds Alarm
0000002C 21FE MOV R1,#0xFE
0000002E 4800 LDR R0,=0xE0024010
00000030 7001 STRB R1,[R0,#0x0]
40: CCR = 0x00000001; //Start the RTC
00000032 2101 MOV R1,#0x1
00000034 4800 LDR R0,=0xE0024008
00000036 7001 STRB R1,[R0,#0x0]
42: VICVectAddr13 = (unsigned)RTC_isr; //Set the timer ISR vector address
00000038 4900 LDR R1,=RTC_isr?A ; RTC_isr?A
0000003A 4800 LDR R0,=0xFFFFF134
0000003C 6001 STR R1,[R0,#0x0]
43: VICVectCntl13 = 0x0000002D; //Set channel
0000003E 212D MOV R1,#0x2D
00000040 4800 LDR R0,=0xFFFFF234
00000042 6001 STR R1,[R0,#0x0]
44: VICIntEnable = 0x00002000; //Enable the interrupt
00000044 4800 LDR R1,=0x2000
ARM COMPILER V2.00f, main 20/02/05 12:31:00 PAGE 4
00000046 4800 LDR R0,=0xFFFFF010
00000048 6001 STR R1,[R0,#0x0]
48: while(1)
0000004A L_3:
50: counter++;
0000004A 4800 LDR R0,=counter ; counter
0000004C 6801 LDR R1,[R0,#0x0] ; counter
0000004E 3101 ADD R1,#0x1
00000050 6001 STR R1,[R0,#0x0] ; counter
51: }
00000052 E7FA B L_3 ; T=0x0000004A
00000054 BC08 POP {R3}
00000056 4718 BX R3
00000058 ENDP ; 'main'
*** CODE SEGMENT '?PR?RTC_isr?A?main':
58: void RTC_isr(void) __irq
00000000 E92D0003 STMDB R13!,{R0-R1}
59: {
00000004 ; SCOPE-START
63: if(ILR&0x00000001) //Test for RTC counter interrupt
00000004 E5100000 LDR R0,=0xE0024000
00000008 E5D00000 LDRB R0,[R0,#0x0]
0000000C E3100001 TST R0,#0x0001
00000010 0A000007 BEQ L_5 ; Targ=0x34
65: led = IOPIN1; //read the current state of the IO pins
00000014 E5100000 LDR R0,=0xE0028010
00000018 E5900000 LDR R0,[R0,#0x0]
66: IOSET1 = 0x00010000; //Set the idle LED
0000001C E3A01801 MOV R1,#0x10000
00000020 E5100000 LDR R0,=0xE0028014
00000024 E5801000 STR R1,[R0,#0x0]
67: ILR = 0x00000001; //Clear the interrupt register
00000028 E3A01001 MOV R1,#0x1
0000002C E5100000 LDR R0,=0xE0024000
00000030 E5C01000 STRB R1,[R0,#0x0]
68: }
00000034 L_5:
70: if(ILR & 0x00000002)
00000034 E5100000 LDR R0,=0xE0024000
00000038 E5D00000 LDRB R0,[R0,#0x0]
0000003C E3100002 TST R0,#0x0002
00000040 0A000005 BEQ L_6 ; Targ=0x5C
72: IOSET1 = 0x00100000; //Set LED 0.7
00000044 E3A01601 MOV R1,#0x100000
00000048 E5100000 LDR R0,=0xE0028014
0000004C E5801000 STR R1,[R0,#0x0]
73: ILR = 0x00000002;
00000050 E3A01002 MOV R1,#0x2
00000054 E5100000 LDR R0,=0xE0024000
00000058 E5C01000 STRB R1,[R0,#0x0]
74: }
0000005C L_6:
75: VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
0000005C E3A01000 MOV R1,#0x0
00000060 E5100000 LDR R0,=0xFFFFF030
00000064 E5801000 STR R1,[R0,#0x0]
00000068 ; SCOPE-END
76: }
00000068 E8BD0003 LDMIA R13!,{R0-R1}
0000006C E25EF004 SUBS R15,R14,#0x0004
00000070 ENDP ; 'RTC_isr?A'
Module Information Static
----------------------------------
code size = ------
data size = 4
ARM COMPILER V2.00f, main 20/02/05 12:31:00 PAGE 5
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 + -