📄 a_canx1.lst
字号:
C166 COMPILER V3.10b, A_CANX1 27/11/97 13:31:42 PAGE 1
DOS C166 COMPILER V3.10b, COMPILATION OF MODULE A_CANX1
OBJECT MODULE PLACED IN A_CANX1.OBJ
COMPILER INVOKED BY: C:\C166EVAL\BIN\C166.EXE A_CANX1.C CD DB M167 WL(3)
stmt level source
1 /******************************************************************************
2 C167CR CAN Ap. Note project
3 Main - a_canx1
4
5 This is an example program showing how to use the CAN interface on the Keil
6 MCB167 evaluation board.
7
8 Copyright (c) 1997 Keil Software
9 ******************************************************************************/
10 #include <stdio.h>
11 #include <intrins.h>
12 #include "can_ifc.h"
13 #include "timer.h"
14 #include "can_msgs.h"
15
16 #define TIME_MO 1 /* message object number for time message */
17
18
19 /******************************************************************************
20 Setup CAN controller
21
22 Returns: nothing
23 -----------------------------------------------------------------------------*/
24 void
25 setup_can(void)
26 {
27 1 begin_can_init();
28 1
29 1 /* These mask values tell the CAN controller that all bits in a
30 1 message id. are significant when comparing the id of a received message
31 1 to the id's in the arbitration registers of the message objects.
32 1 */
33 1 CAN_MASK_SHORT = 0xffff;
34 1 CAN_UMASK_LONG = 0xffff;
35 1 CAN_LMASK_LONG = 0xf8ff;
36 1
37 1 /* Since this program doesn't use message object 15, it is unnecessary
38 1 to initialize the 'mask of last message' registers (CAN_UMASK_LAST and
39 1 CAN_LMASK_LAST).
40 1 */
41 1
42 1 CAN_MSGOBJ[TIME_MO].msg_ctl = MSGVAL_CLR;
43 1 CAN_MSGOBJ[TIME_MO].arbitr = ARBITR(CAN_TIME_MSG);
44 1 CAN_MSGOBJ[TIME_MO].msg_cfg = MSG_CFG(LEN_CAN_TIME_MSG, CANDIR_TRANSMIT, 0);
45 1 /* We're not initializing the data field right now, so we set
46 1 CPUUPD to prevent the message from being transmitted in
47 1 response to a remote frame.
48 1 */
49 1 CAN_MSGOBJ[TIME_MO].msg_ctl =
50 1 /* clear bits set bits */
51 1 INTPND_CLR &
52 1 RXIE_CLR &
53 1 TXIE_CLR &
54 1 MSGVAL_SET &
55 1 NEWDAT_CLR &
56 1 CPUUPD_SET &
57 1 TXRQ_CLR &
58 1 RMTPND_CLR;
59 1
C166 COMPILER V3.10b, A_CANX1 27/11/97 13:31:42 PAGE 2
60 1 /* CAN_IE_ must be set for any CAN interrupts to occur.
61 1 CAN_EIE_ must be set for CAN error status change interrupts to occur.
62 1 */
63 1 end_can_init(CAN_IE_ | CAN_EIE_);
64 1 }
65
66
67 /******************************************************************************
68 main
69
70 This program does the following:
71 Set up the CAN controller, with a message object for the time stamp message
72 as a transmit object.
73 Setup a timer to generate periodic interrupts.
74 Loop forever, periodically updating the time stamp message object.
75
76 The CAN controller will transmit the time stamp message when it receives a
77 remote frame for it, without any intervention from the CPU.
78
79 Returns: never
80 -----------------------------------------------------------------------------*/
81 void
82 main(void)
83 {
84 1 printf("Program A start\n");
85 1
86 1
87 1 /* Set up */
88 1 setup_can(); /* set up CAN interface */
89 1 init_timer(); /* initialize timing */
90 1
91 1 /* Run */
92 1 while (1) { /* infinite loop */
93 2 unsigned long t;
94 2
95 2 t = timer();
96 2 update_can_transmit_message(TIME_MO, &t, LEN_CAN_TIME_MSG);
97 2
98 2 /* Put the processor in idle mode to conserve power.
99 2 The next interrupt (from the timer) will wake it up again.
100 2 */
101 2 _idle_();
102 2 }
103 1 }
C166 COMPILER V3.10b, A_CANX1 27/11/97 13:31:42 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION setup_can (BEGIN RMASK = @0x7FFF)
; SOURCE LINE # 25
; SOURCE LINE # 27
0000 CA000000 E CALLA cc_UC,begin_can_init
; SOURCE LINE # 33
0004 E6F4FFFF MOV R4,#0FFFFH
0008 F6F406EF MOV 0EF06H,R4
; SOURCE LINE # 34
000C F6F408EF MOV 0EF08H,R4
; SOURCE LINE # 35
0010 E6F4FFF8 MOV R4,#0F8FFH
0014 F6F40AEF MOV 0EF0AH,R4
; SOURCE LINE # 42
0018 E6F47FFF MOV R4,#0FF7FH
001C F6F410EF MOV 0EF10H,R4
; SOURCE LINE # 43
0020 E6F4AAA0 MOV R4,#0A0AAH
0024 E005 MOV R5,#00H
0026 F6F412EF MOV 0EF12H,R4
002A F6F514EF MOV 0EF14H,R5
; SOURCE LINE # 44
002E E7F84800 MOVB RL4,#048H
0032 F7F816EF MOVB 0EF16H,RL4
; SOURCE LINE # 58
0036 E6F49559 MOV R4,#05995H
003A F6F410EF MOV 0EF10H,R4
; SOURCE LINE # 63
003E E0A8 MOV R8,#0AH
0040 CA000000 E CALLA cc_UC,end_can_init
; SOURCE LINE # 64
0044 CB00 RET
; FUNCTION setup_can (END RMASK = @0x7FFF)
; FUNCTION main (BEGIN RMASK = @0x7FFF)
; SOURCE LINE # 82
0046 2804 SUB R0,#04H
; SOURCE LINE # 84
0048 E6F80000 R MOV R8,#SC?0
004C CA000000 E CALLA cc_UC,printf
; SOURCE LINE # 88
0050 BBD7 CALLR setup_can
; SOURCE LINE # 89
0052 CA000000 E CALLA cc_UC,init_timer
; SOURCE LINE # 92
0056 ?C0003:
; SOURCE LINE # 95
0056 CA000000 E CALLA cc_UC,timer
005A B840 MOV [R0],R4 ; t
005C C4500200 MOV [R0+#02H],R5 ; t+2
; SOURCE LINE # 96
0060 E04A MOV R10,#04H
0062 F090 MOV R9,R0
0064 E018 MOV R8,#01H
0066 CA000000 E CALLA cc_UC,update_can_transmit_message
; SOURCE LINE # 101
006A 87788787 IDLE
; SOURCE LINE # 102
006E 0DF3 JMPR cc_UC,?C0003
; FUNCTION main (END RMASK = @0x7FFF)
MODULE INFORMATION: INITIALIZED UNINITIALIZED
C166 COMPILER V3.10b, A_CANX1 27/11/97 13:31:42 PAGE 4
CODE SIZE = 112 --------
NEAR-CONST SIZE = 17 --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = -------- --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = -------- --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -