📄 system.lst
字号:
C51 COMPILER V7.10 SYSTEM 03/20/2007 22:53:09 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE SYSTEM
OBJECT MODULE PLACED IN .\system.obj
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE ..\SourceFile\system.c BROWSE DEBUG OBJECTEXTEND PRINT(.\syst
-em.lst) OBJECT(.\system.obj)
line level source
1
2
3 /******************************************************************************
4 * File Name : system.c
5 * Description : The system core,include timer2 interrupt, message manage
6 * and general purpose function
7 * Created : 2005.6.1 by wangsw
8 * Modefied : -
9 ******************************************************************************/
10
11 #include <intrins.h>
12
13 #include "define.h"
14 #include "rtc.h"
15 #include "routine.h"
16 #include "key.h"
17 #include "timer.h"
18
19 static bool bEA;
20 static byte data i;
21 static byte data MsgPoolPoint=0;
22 static MSGTYPE data msgType;
23 static byte data MsgPool[MSG_STACK_DEPTH][2];
24
25 static byte data RTCCounter = 0;
26
27
28 U8 data g_MsgReturnValue=0; /*for msg_queue_out return point*/
29
30 /******************************************************************************
31 * Function Name : Timer2Server
32 * Parameter : none
33 * Return Value : void
34 * Description : Timer2 interrupt as system timer,It is importance
35 * Created : 2005.6.1 by wangsw
36 * Modified : -
37 ******************************************************************************/
38 static void Timer2Server(void) interrupt 5 /*不要带指定寄存器,否则将产生移位指令出错*/
39 {
40 1 ET2 = 0; /*close interrupt*/
41 1 TF2 = 0; /*clear interrupt flag*/
42 1
43 1 if(++RTCCounter == 50)
44 1 {
45 2 RTCCounter = 0;
46 2 rtc_soft_routine(); /*定时器例行程序*/
47 2 }
48 1
49 1 key_check();
50 1
51 1 if(MSTimerIDRegister > 0)
52 1 {
53 2 MSTimer_server();
54 2 }
C51 COMPILER V7.10 SYSTEM 03/20/2007 22:53:09 PAGE 2
55 1
56 1
57 1 routine_process(); /*运行例行任务程序*/
58 1
59 1 ET2 = 1;
60 1 }
61
62
63 /******************************************************************************
64 * Function Name : hex_to_bcd
65 * Parameter : val
66 * Return Value : byte
67 * Description : hex to bcd
68 * Created : 2005.6.2 by wangsw
69 * Modified : -
70 ******************************************************************************/
71 byte hex_to_bcd(byte val)
72 {
73 1 if(val < 100)
74 1 {
75 2 return(((val / 10) << 4)+ (val % 10));
76 2 }
77 1 else
78 1 {
79 2 ERRprintf("hex_to_bcd\n");
80 2 }
81 1 }
82
83
84 /******************************************************************************
85 * Function Name : bcd_to_hex
86 * Parameter : val
87 * Return Value : byte
88 * Description : bcd to hex
89 * Created : 2005.6.2 by wangsw
90 * Modified : -
91 ******************************************************************************/
92 byte bcd_to_hex(byte val)
93 {
94 1 return(((val >> 4) * 10) + (val & 0x0F));
95 1 }
96
97
98 /******************************************************************************
99 * Function Name : number_to_ascii
100 * Parameter : val
101 * Return Value : void
102 * Description : Convert number to ASCII
103 * Created : 2005.6.2 by wangsw
104 * Modified : -
105 ******************************************************************************/
106 byte number_to_ascii(byte val)
107 {
108 1 if(val < 10)
109 1 {
110 2 return(0x30 + val);
111 2 }
112 1 else if(val < 16)
113 1 {
114 2 return(55 + val);
115 2 }
116 1 else
C51 COMPILER V7.10 SYSTEM 03/20/2007 22:53:09 PAGE 3
117 1 {
118 2 ERRprintf("number_to_ascii\n");
119 2 }
120 1 }
121
122
123 /******************************************************************************
124 * Function Name : ascii_to_number
125 * Parameter : val
126 * Return Value : void
127 * Description : Convert ASCII to number
128 * Created : 2005.6.1 by wangsw
129 * Modified : -
130 ******************************************************************************/
131 byte ascii_to_number(byte val)
132 {
133 1 if(val < 0x3A)
134 1 {
135 2 if(val > 0x2F)
136 2 {
137 3 return(val - 0x30);
138 3 }
139 2 }
140 1 else if(val < 'G')
141 1 {
142 2 if(val > '@')
143 2 {
144 3 return(val - 0x37);
145 3 }
146 2 }
147 1 else if(val < 'g')
148 1 {
149 2 if(val > 0x60)
150 2 {
151 3 return(val - 0x57);
152 3 }
153 2 }
154 1 else
155 1 {
156 2 ERRprintf("ascii_to_number\n");
157 2 }
158 1 }
159
160
161 /******************************************************************************
162 * Function Name : delay
163 * Parameter : wVal
164 * Return Value : void
165 * Description : general purpose function for delay
166 * Created : 2005.6.1 by wangsw
167 * Modified : -
168 ******************************************************************************/
169 void delay(word wVal)
170 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -