📄 main.lst
字号:
ARM COMPILER V2.00f, main 20/02/05 14:46:36 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: CANRX */
3 /* Project: LPC2100 Training course */
4 /* Engineer: T Martin tmartin@hitex.co.uk */
5 /* Filename: main.c */
6 /* Language: C */
7 /* Compiler: Keil ARM V1.3 */
8 /* Assembler: */
9 /* */
10 /************************************************************/
11 /* COPYRIGHT: Hitex UK Ltd 2004 */
12 /* LICENSE: THIS VERSION CREATED FOR FREE DISTRIBUTION */
13 /************************************************************/
14 /* Function: CAN receive example */
15 /* */
16 /* Example */
17 /* */
18 /* Demonstrates the use of the Standard message acceptance */
19 /* and receiving a CAN packet */
20 /* */
21 /* Oscillator frequency 12.000 Mhz */
22 /* Target board Keil MCB21000 */
23 /************************************************************/
24
25
26 #include <LPC21xx.H>
27 extern void init_CAN2(void);
28 extern void TX_CAN2(void);
29 void CAN1IRQ (void)__irq; //Declare the RX IRQ
30
31
32 unsigned int StandardFilter[2] _at_ 0xE0038000; //Declare the standard acceptance filter table
33 unsigned int GroupStdFilter[2] _at_ 0xE0038008;
34 unsigned int IndividualExtFilter[2] _at_ 0xE0038010;
35 unsigned int GroupExtFilter[2] _at_ 0xE0038018;
36
37
38 int main(void)
39 {
40 1 init_CAN2();
41 1
42 1 VPBDIV = 0x00000001; //Set PClk to 60Mhz
43 1 IODIR1 = 0x00FF0000; // set all ports to output
44 1 PINSEL1 |= 0x00040000; //Enable Pin 0.25 as CAN1 RX
45 1 C1MOD = 0x00000001; //Set CAN controller into reset
46 1 C1BTR = 0x001C001D; //Set bit timing to 125k
47 1 C1IER = 0x00000001; //Enable the Receive interrupt
48 1 VICVectCntl0 = 0x0000003A; //select a priority slot for a given interrupt
49 1 VICVectAddr0 = (unsigned)CAN1IRQ; //pass the address of the IRQ into the VIC slot
50 1 VICIntEnable = 0x04000000; //enable interrupt
51 1 AFMR = 0x00000001; //Disable the Acceptance filters to allow setup of the table
52 1 StandardFilter[0] = 0x20012002;
53 1 StandardFilter[1] = 0x20032004;
54 1 GroupStdFilter[0] = 0x2009200F;
55 1 GroupStdFilter[1] = 0x20112020;
56 1 IndividualExtFilter[0] = 0x40010000;
57 1 IndividualExtFilter[1] = 0x40020000;
58 1 GroupExtFilter[0] = 0x40030000;
59 1 GroupExtFilter[2] = 0x40040000;
ARM COMPILER V2.00f, main 20/02/05 14:46:36 PAGE 2
60 1 SFF_sa = 0x00000000; //Set start address of Standard table
61 1 SFF_GRP_sa = 0x00000010; //Set start address of Standard group table
62 1 EFF_sa = 0x00000018; //Set start address of Extended table
63 1 EFF_GRP_sa = 0x00000020; //Set start address of Extended group table
64 1 ENDofTable = 0x00000028; //Set end of table address
65 1 AFMR = 0x00000000; //Enable Acceptance filters
66 1
67 1 C1MOD = 0x00000000; //Release CAN controller
68 1
69 1 while(1)
70 1 {
71 2 TX_CAN2();
72 2 }
73 1 }
74
75 void CAN1IRQ (void) __irq
76 {
77 1
78 1 IOCLR1 = ~C1RDA<<8; //clear output pins
79 1 IOSET1 = C1RDA<<8; //set output pins
80 1 C1CMR = 0x00000004; //release the recieve buffer
81 1 VICVectAddr = 0x00000000; //Signal the end of interrupt
82 1 }
83
ARM COMPILER V2.00f, main 20/02/05 14:46:36 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (init_CAN2?T)
EXTERN CODE16 (TX_CAN2?T)
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC CAN1IRQ?A
PUBLIC main
PUBLIC StandardFilter
PUBLIC GroupStdFilter
PUBLIC IndividualExtFilter
PUBLIC GroupExtFilter
*** DATA SEGMENT '?DT0?AT_E0038000_?1?main':
E0038000 StandardFilter:
E0038000 DS 8
*** DATA SEGMENT '?DT0?AT_E0038008_?2?main':
E0038008 GroupStdFilter:
E0038008 DS 8
*** DATA SEGMENT '?DT0?AT_E0038010_?3?main':
E0038010 IndividualExtFilter:
E0038010 DS 8
*** DATA SEGMENT '?DT0?AT_E0038018_?4?main':
E0038018 GroupExtFilter:
E0038018 DS 8
*** CODE SEGMENT '?PR?main?main':
38: int main(void)
00000000 B500 PUSH {LR}
40: init_CAN2();
00000002 F7FF BL init_CAN2?T ; T=0x0001 (1)
00000004 FFFD BL init_CAN2?T ; T=0x0001 (2)
42: VPBDIV = 0x00000001; //Set PClk to 60Mhz
00000008 2101 MOV R1,#0x1
0000000A 4800 LDR R0,=0xE01FC100
0000000C 7001 STRB R1,[R0,#0x0]
43: IODIR1 = 0x00FF0000; // set all ports to output
0000000E 4800 LDR R1,=0xFF0000
00000010 4800 LDR R0,=0xE0028018
00000012 6001 STR R1,[R0,#0x0]
44: PINSEL1 |= 0x00040000; //Enable Pin 0.25 as CAN1 RX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -