📄 main.lst
字号:
ARM COMPILER V2.53, main 26/12/07 11:36:09 PAGE 1
ARM COMPILER V2.53, COMPILATION OF MODULE main
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: d:\Keil\ARM\BIN\CA.exe main.c THUMB OPTIMIZE(7,SPEED) BROWSE DEBUG TABS(4)
stmt level source
1 /************************************************************/
2 /* PROJECT NAME: Thumb */
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 /* Demonstrates Timer 0 match interrupt and simple PWM */
18 /* modulation */
19 /* */
20 /* Oscillator frequency 12.000 Mhz */
21 /* Target board Keil MCB2100 */
22 /************************************************************/
23
24 #include <LPC21xx.H>
25
26 void T0isr(void) __irq;
27
28
29 int main(void)
30 {
31 1 VPBDIV = 0x00000002; // Configure the VPB divi
32 1
33 1 PINSEL0 = 0x00000800; //Match1 as output
34 1 T0PR = 0x00000902; //Load prescaler
35 1 T0TCR = 0x00000002; //Reset counter and prescaler
36 1 T0MCR = 0x00000003; //On match reset the counter and generate an interrupt
37 1 T0MR0 = 0x00000010; //Set the cycle time
38 1 T0MR1 = 0x00000008; //Set duty cycle to zero
39 1 T0EMR = 0x00000042; //On match clear MAT1
40 1 T0TCR = 0x00000001; //enable timer
41 1
42 1 VICVectAddr4 = (unsigned)T0isr; //Set the timer ISR vector address
43 1 VICVectCntl4 = 0x00000024; //Set channel
44 1 VICIntEnable |= 0x00000010; //Enable the interrupt
45 1
46 1 while(1);
47 1 }
48
49 void T0isr (void) __irq
50 {
51 1 T0EMR |= 0x00000002; //Set MAT1 high for begining of the cycle
52 1
53 1 //T0MR1++; //Increment PWM Duty cycle
54 1 //T0MR1 = T0MR1&0x000000F; //Limit duty cycle
55 1
56 1 T0IR |= 0x00000001; //Clear match 0 interrupt
57 1 VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
58 1 }
ARM COMPILER V2.53, main 26/12/07 11:36:09 PAGE 2
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC T0isr?A
PUBLIC main
*** CODE SEGMENT '?PR?main?main':
29: int main(void)
00000000 B500 PUSH {LR}
31: VPBDIV = 0x00000002; // Configure the VPB divi
00000002 2102 MOV R1,#0x2
00000004 4800 LDR R0,=0xE01FC100
00000006 7001 STRB R1,[R0,#0x0]
33: PINSEL0 = 0x00000800; //Match1 as output
00000008 4800 LDR R1,=0x800
0000000A 4800 LDR R0,=0xE002C000
0000000C 6001 STR R1,[R0,#0x0]
34: T0PR = 0x00000902; //Load prescaler
0000000E 4800 LDR R1,=0x902
00000010 4800 LDR R0,=0xE000400C
00000012 6001 STR R1,[R0,#0x0]
35: T0TCR = 0x00000002; //Reset counter and prescaler
00000014 2102 MOV R1,#0x2
00000016 4800 LDR R0,=0xE0004004
00000018 6001 STR R1,[R0,#0x0]
36: T0MCR = 0x00000003; //On match reset the counter and generate an interrupt
0000001A 2103 MOV R1,#0x3
0000001C 4800 LDR R0,=0xE0004014
0000001E 6001 STR R1,[R0,#0x0]
37: T0MR0 = 0x00000010; //Set the cycle time
00000020 2210 MOV R2,#0x10
00000022 4800 LDR R0,=0xE0004018
00000024 6002 STR R2,[R0,#0x0]
38: T0MR1 = 0x00000008; //Set duty cycle to zero
00000026 2108 MOV R1,#0x8
00000028 4800 LDR R0,=0xE000401C
0000002A 6001 STR R1,[R0,#0x0]
39: T0EMR = 0x00000042; //On match clear MAT1
0000002C 2142 MOV R1,#0x42
0000002E 4800 LDR R0,=0xE000403C
00000030 6001 STR R1,[R0,#0x0]
40: T0TCR = 0x00000001; //enable timer
00000032 2101 MOV R1,#0x1
00000034 4800 LDR R0,=0xE0004004
00000036 6001 STR R1,[R0,#0x0]
42: VICVectAddr4 = (unsigned)T0isr; //Set the timer ISR vector address
00000038 4900 LDR R1,=T0isr?A ; T0isr?A
0000003A 4800 LDR R0,=0xFFFFF110
0000003C 6001 STR R1,[R0,#0x0]
43: VICVectCntl4 = 0x00000024; //Set channel
0000003E 2124 MOV R1,#0x24
00000040 4800 LDR R0,=0xFFFFF210
00000042 6001 STR R1,[R0,#0x0]
44: VICIntEnable |= 0x00000010; //Enable the interrupt
00000044 4800 LDR R0,=0xFFFFF010
00000046 6801 LDR R1,[R0,#0x0]
00000048 4311 ORR R1,R2
0000004A 6001 STR R1,[R0,#0x0]
46: while(1);
0000004C L_1:
0000004C E7FE B L_1 ; T=0x0000004C
47: }
ARM COMPILER V2.53, main 26/12/07 11:36:09 PAGE 3
0000004E BC08 POP {R3}
00000050 4718 BX R3
00000052 ENDP ; 'main'
*** CODE SEGMENT '?PR?T0isr?A?main':
49: void T0isr (void) __irq
00000000 E92D0003 STMDB R13!,{R0-R1}
51: T0EMR |= 0x00000002; //Set MAT1 high for begining of the cycle
00000004 E5100000 LDR R0,=0xE000403C
00000008 E5901000 LDR R1,[R0,#0x0]
0000000C E3811002 ORR R1,R1,#0x0002
00000010 E5801000 STR R1,[R0,#0x0]
56: T0IR |= 0x00000001; //Clear match 0 interrupt
00000014 E5100000 LDR R0,=0xE0004000
00000018 E5901000 LDR R1,[R0,#0x0]
0000001C E3811001 ORR R1,R1,#0x0001
00000020 E5801000 STR R1,[R0,#0x0]
57: VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
00000024 E3A01000 MOV R1,#0x0
00000028 E5100000 LDR R0,=0xFFFFF030
0000002C E5801000 STR R1,[R0,#0x0]
58: }
00000030 E8BD0003 LDMIA R13!,{R0-R1}
00000034 E25EF004 SUBS R15,R14,#0x0004
00000038 ENDP ; 'T0isr?A'
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 + -