📄 rtc.lst
字号:
C166 COMPILER V6.04, RTC 08/27/2006 21:22:42 PAGE 1
C166 COMPILER V6.04, COMPILATION OF MODULE RTC
OBJECT MODULE PLACED IN RTC.OBJ
COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE RTC.C MODV2 LARGE BROWSE MODV2 DEBUG
stmt lvl source
1 //****************************************************************************
2 // @Module Real Timer Clock (RTC)
3 // @Filename RTC.C
4 // @Project rtc.dav
5 //----------------------------------------------------------------------------
6
7
8
9
10 //****************************************************************************
11 // @Project Includes
12 //****************************************************************************
13
14 #include "MAIN.H"
15 extern int n;
16
17 /*********************************************************************************************************
-*******
18 @Function void RTC_vInit(void)
19
20
21
22 **********************************************************************************************************
-*******/
23
24
25
26
27 void RTC_vInit(void)
28 {
29 1
30 1
31 1 MAIN_vUnlockProtecReg(); //unlock SYSCON0
32 1 SYSCON0_RTCCM = 0; // enable access to control bits
33 1
34 1 /// -----------------------------------------------------------------------
35 1 /// Configuration of the RTC Counter:
36 1 /// -----------------------------------------------------------------------
37 1 /// - RTC input frequency is 375.000 kHz
38 1 /// - the input clock is divided by factor 8
39 1 /// - counter is started after initialization
40 1
41 1 while((RTC_CON & 0x8000) == 0x0000); // wait until access is possible
42 1 RTC_CON = 0x0002; // load RTC control register
43 1
44 1 /// - overflow period on T14: 10.0053 [ms]
45 1 /// - overflow period on CNT0: 40.0213 [ms]
46 1 /// - overflow period on CNT1: 2.5614 [s]
47 1 /// - overflow period on CNT2: 2.7321 [min]
48 1 /// - overflow period on CNT3: 1.9428 [days]
49 1
50 1 RTC_T14REL = 0xFE2B; // load T14 count/reload register
51 1 RTC_RTCL = 0x03FC; // load RTC low register
52 1 RTC_RELL = 0x03FC; // load RTC reload low register
53 1 RTC_RTCH = 0x0000; // load RTC high register
C166 COMPILER V6.04, RTC 08/27/2006 21:22:42 PAGE 2
54 1 RTC_RELH = 0x0000; // load RTC reload high register
55 1
56 1 /// -----------------------------------------------------------------------
57 1 /// Configuration of the used RTC Interrupts:
58 1 /// -----------------------------------------------------------------------
59 1 /// RTC service request node configuration:
60 1 /// - RTC interrupt priority level (ILVL) = 13
61 1 /// - RTC interrupt group level (GLVL) = 1
62 1 /// - RTC group priority extension (GPX) = 0
63 1
64 1 RTC_IC = 0x0075;
65 1
66 1 RTC_ISNC = 0x0004; // load RTC interrupt sub node register
67 1
68 1 RTC_CON_RUN = 1; // starts the counter
69 1
70 1 // USER CODE BEGIN (Init,3)
71 1
72 1 // USER CODE END
73 1
74 1 } // End of function RTC_vInit
75
76
77 //****************************************************************************
78 // @Function void RTC_viRTC(void)
79 //
80 //----------------------------------------------------------------------------
81 // @Description This is the RTC interrupt service routine. It is called up
82 // when:
83 // - counter T14 overflows and is reloaded
84 // - counter CNT0 overflows and is reloaded
85 // - counter CNT1 overflows and is reloaded
86 // - counter CNT2 overflows and is reloaded
87 // - counter CNT3 overflows and is reloaded
88 // This interrupt request may eg. be used to provide a system
89 // time tick independent of the CPU frequency, or to wake up
90 // regularly from idle mode.
91 //
92 // Please note that you have to add application specific code
93 // to this function.
94
95
96 //****************************************************************************
97
98
99 void RTC_viRTC(void) interrupt RTCINT
100 {
101 1
102 1
103 1 if(RTC_ISNC_0IR) // if counter CNT0 overflow
104 1 {
105 2
106 2 // USER CODE BEGIN (RTC,4)
107 2
108 2 // USER CODE END
109 2
110 2 RTC_ISNC_0IR = 0;
111 2
112 2 }
113 1
114 1
115 1 if(n%2)
C166 COMPILER V6.04, RTC 08/27/2006 21:22:42 PAGE 3
116 1 {
117 2 P1H = 0x00FF;
118 2 P1L = 0x0000;
119 2 }
120 1 else
121 1 {
122 2 P1H = 0x0000;
123 2 P1L = 0x00FF;
124 2 }
125 1 n++;
126 1
127 1 }
128 // End of function RTC_viRTC
129
130
131
132
133 // USER CODE BEGIN (RTC_General,10)
134
135 // USER CODE END
136
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 184 --------
NEAR-CONST SIZE = -------- --------
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 + -